Support Board
Date/Time: Fri, 29 Nov 2024 16:33:02 +0000
Post From: Pers Double not providing the expected outcome.
[2023-01-31 08:47:00] |
User92573 - Posts: 530 |
Dear Support I'm obviously missing something simple but as I'm not a programmer this is a little confusing. Can someone help explain why the increased precision results in a 0? float& Simple_calc1 = sc.GetPersistentFloat(1); double& Simple_calc2 = sc.GetPersistentDouble(1); Simple_calc1 = 10/5; // ignoring use of 10.0f/5.0f Simple_calc2 = 10/5; msg.Format("Simple Calculation using float = %f",Simple_calc1); sc.AddMessageToLog(msg,1); msg.Format("Simple Calculation using double = %d",Simple_calc2); sc.AddMessageToLog(msg,1); Message Log output: Simple Calculation using float = 2.0 Simple Calculation using double = 0 //? Many thanks for any help. |