Re: No correct float calc although multiplied by 1
Quote:
Originally Posted by Jamie
Jeff is the US sales manager, not a programmer- I'm not sure if him not knowing is anything to XD about.
I also asked other people in gwerdychat about it (the people with the crazy stars next to it). Didn't get any anwers.
To be completely honest. The emotion "XD" was not really the part of my post i wanted you to take note on. But you can argue with me if you like.
Re: No correct float calc although multiplied by 1
Sorry to dig this out again. But i get mad here.
Why does 1.0*(value counter 1)/(value counter 2) result in 0?
Why does 1.0*4/59 result in 0?
What can i do to convince those goddamn counters to calculate with floats?
Re: No correct float calc although multiplied by 1
From what I remember, build 247 has a bug which is fixed in 248
Re: No correct float calc although multiplied by 1
I use Build 248 now. But i cannot convince the counter to show a float result. It shows zero :(
Re: No correct float calc although multiplied by 1
Re: No correct float calc although multiplied by 1
Re: No correct float calc although multiplied by 1
I think in MMF division has priority, so 1.0*4/59 is equal to (1.0)*(4/59). Technically they should be equal priority, and mathematically there is no difference between doing the division first and doing it in the same pass as multiplication, but because MMF has two kinds of division (integer divide and floating point divide) the order of operations can affect your result.
Re: No correct float calc although multiplied by 1
I got it working. For this time.
4*1.0/59 gives my needed floating point value. Don't ask me why. And from what i can read from the answers i am not the only one :grin:
Please Please Please give us another solution for floats. The current method is try and pray. And that's nasty.
Re: No correct float calc although multiplied by 1
I already explained why, but possibly not clearly:
1: In MMF, integer/integer (eg 3/4) rounds down to give an integer answer (in this case 0.75 rounds to 0).
2: You can convert an integer to a floating point (float) value by multiplying it by 1.0.
3: In MMF, division is done before multiplication (instead of in the order they appear)
"3" means that 1.0*4/59 doesn't work, because it does (4/59) first, rounding down to an integer because both numbers were integers, instead of doing (1.0*4) first, and getting a float, then doing 4.0/59, and getting the expected float answer (no rounding).
4*1.0/59 works, because it does (1.0/59) first.
Re: No correct float calc although multiplied by 1
As described just above by Dynasoft, to illustrate:
For MMF2: 4*1.0/59 means 4*(1.0/59) so you got a float because you divide by 59 the float 1.0.