2 registered members (AndrewAMD, Akow),
1,371
guests, and 10
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Variable accuracy for calculations
#141867
07/18/07 14:39
07/18/07 14:39
|
Joined: Aug 2005
Posts: 119 Madison, WI
JakeL
OP
Member
|
OP
Member
Joined: Aug 2005
Posts: 119
Madison, WI
|
I am making an educational mathematic game. The game must have a calculator and be able to be as accurate with calculations as possible.
With the var I have found that when using decimals, the results are rarely accurate. I have scripted a calculator but had to remove decimal functionality due to the .2 being seen as .199. So, if the player multiplies .2 and 1 the answer on the calculator screen is “.199”! There are many other examples of this with other decimals. The manual does say calculations are inaccurate, but I wasn’t expecting the above to be true.
So what I guess I’m looking for is some help. Is there a workaround that can add accuracy? I need to add, subtract, multiply, divide, and take the square root on both the calculator and other calculations throughout the game. I would like accuracy to two decimals if possible. The engine always calculates the same which is good, but if the player compares the answers to a calculator, they are generally incorrect. This is not acceptable for a game which teaches math.
Would a .dll be what I’m looking for?
|
|
|
Re: Variable accuracy for calculations
[Re: JakeL]
#141870
07/18/07 17:52
07/18/07 17:52
|
Joined: Jan 2002
Posts: 4,225 Germany / Essen
Uhrwerk
Expert
|
Expert
Joined: Jan 2002
Posts: 4,225
Germany / Essen
|
Then you should probably change to Lite-C. The type "double" should provide much more accuracy.
Always learn from history, to be sure you make the same mistakes again...
|
|
|
Re: Variable accuracy for calculations
[Re: Matt_Aufderheide]
#141873
07/19/07 07:45
07/19/07 07:45
|
Joined: Mar 2006
Posts: 3,538 WA, Australia
JibbSmart
Expert
|
Expert
Joined: Mar 2006
Posts: 3,538
WA, Australia
|
a7 is officially released, and relatively bug free.
in your case where conversion isn't an option, matt's suggestion is the best ^^
julz
Formerly known as JulzMighty. I made KarBOOM!
|
|
|
Re: Variable accuracy for calculations
[Re: Uhrwerk]
#141875
07/19/07 11:23
07/19/07 11:23
|
Joined: Mar 2006
Posts: 3,538 WA, Australia
JibbSmart
Expert
|
Expert
Joined: Mar 2006
Posts: 3,538
WA, Australia
|
yeh whoops, i shoulda thought of that too but zeitwerk's right. unless you want to handle the entire calculator part in the dll.
julz
Formerly known as JulzMighty. I made KarBOOM!
|
|
|
|