
1. Re: WRONG MATH : Multiplying by 100 change the result of decimal numbers, loss of precision
Markus Schneider May 21, 2014 4:23 AM (in response to Vincent_L)strange... I copied the formula into a FileMaker textfield and calculated using the 'calculate' function  result: 70
must be a problem with decimal values

2. Re: WRONG MATH : Multiplying by 100 change the result of decimal numbers, loss of precision
Vincent_L May 21, 2014 5:15 AM (in response to Vincent_L)Just noticed I posted it in french, which as comma decimal separators.
Here are the calc with us decimal separators
11.975/6.5833333333333333 = .7(11.975/6.5833333333333333) *100 = 69.9999999999999998Floor( (11.975/6.5833333333333333) *100) = 69Markus, you have to test this one (11.975/6.5833333333333333) *100 the problem occurs when multiplying 
3. Re: WRONG MATH : Multiplying by 100 change the result of decimal numbers, loss of precision
Vincent_L May 21, 2014 5:26 AM (in response to Vincent_L)Thanks to your post Markus I noticed that the issue only trigger if the decimal separator is a COMMA
Big thanks

4. Re: WRONG MATH : Multiplying by 100 change the result of decimal numbers, loss of precision
TSGal May 21, 2014 1:22 PM (in response to Vincent_L)Glitchtracker:
Thank you for your post.
The issue occurs regardless if comma or period is used as the decimal point. Since FileMaker Pro has greater precision than other applications/utilities, it is less forgiving. With your example, since 6.58333333... is unending, you are slightly rounding down. However, if you add one more "3" to the value 6.58333333...., it will then display 70. That is, 6.58 followed by fifteen 3's.
TSGal
FileMaker, Inc. 
5. Re: WRONG MATH : Multiplying by 100 change the result of decimal numbers, loss of precision
Vincent_L May 21, 2014 1:47 PM (in response to Vincent_L)Sorry,
1a/b =c
then (1a/b) * 100 has to be equal, in all system in the world, to c*100 otherwise that's a BUG.
If Filemaker has greater precision, then c should be higher precision.

6. Re: WRONG MATH : Multiplying by 100 change the result of decimal numbers, loss of precision
Vincent_L May 21, 2014 2:22 PM (in response to Vincent_L)Furthermore, I can't "add a 3", because filemaker it's filemaker that decided to store it that way :actually user input 7,9 in a dialog then there's a set field that sets a field to 7,9/1,2so the set fields stores in the filemaker database 6.5833333333333333If Filemaker is more precise than other tools, then it should have stored another 3. But of course you can't store that much decimalHOWEVER, and here lies the BUG to me, Filemaker calc engine should be aware of its precision limits and then do the calks accordingly.It seems to me that there's inconstancy here 
7. Re: WRONG MATH : Multiplying by 100 change the result of decimal numbers, loss of precision
TSGal May 21, 2014 2:25 PM (in response to Vincent_L)Glitchtracker:
Since computers are binary, most decimal numbers cannot be truly represented in accurate binary form, so there is some error. If you use your calculation of (1  1.975 / 6.5833333333333333), the last digit in the rounding sequence will round up to the next value, and 0.7 will display, even though it is slightly lower internally. If you combine this answer by multiplying by 100 in the same formula, then the precision from the last digit from the first part of the calculation is shifted by two decimal places. Thereby giving the answer you see. If you add one more 3 to that initial value, it pushes the edge of the precision to round up to 70.
Additionally, using your initial calculation without multiplying by 100 (leaving 0.7), and then create another calculation field that multiplies 100 by that first value, you will then get the desired result of 70. That is because the two calculations are acting separately and not as one unit.
If I set the precision on the calculation field to 25 digits, using your calculation, I show 69.9999999999999998000000000.
Interestingly, I launched Excel and created a cell with the same calculation and set the precision to 25 digits, it shows 70.0000000000000000000000000, even though it is incorrect. In fact, it will show 70 if you reduce the number of 3's by two to 12.
If you want more about converting decimal to binary, there are several articles that can be found. Doing a quick search on the internet, I found:
http://cs.furman.edu/digitaldomain/more/ch6/dec_frac_to_bin.htm
TSGal
FileMaker, Inc. 
8. Re: WRONG MATH : Multiplying by 100 change the result of decimal numbers, loss of precision
Vincent_L May 21, 2014 2:25 PM (in response to Vincent_L)Excel does it right
A1=11,975/6,58333333333333
100*A1 = 70
So that's a bug.
And this bug practically kills the Floor function (but of course can have even worse consequences)

9. Re: WRONG MATH : Multiplying by 100 change the result of decimal numbers, loss of precision
Vincent_L May 21, 2014 2:41 PM (in response to Vincent_L)I don't understand why Filemaker internally computes to whatever precision let's say 25, but decides to store only 14 decimals
So if filemaker internal calc engine pecision is 25, then it should store 25 decimals. If it can only strs 14 decimals, so it must calc with 14 decimals.
You may think Excel behavior is wrong, but actually it's right : because it corrects what's it's fraction to binary limitation introduces
Moreover having 2 fields not giving the same results than one is VERY strange

10. Re: WRONG MATH : Multiplying by 100 change the result of decimal numbers, loss of precision
TSGal May 21, 2014 2:50 PM (in response to Vincent_L)Glitchtracker:
FileMaker will store 16 decimals. Using SetPrecision, you can increase this number. For example, if you create the calculation:
SetPrecision ( Pi ; 100 )
... the resulting calculation will show 100 digits of Pi.
Therefore, if the user enters 7,9 and you divide by 1,2, then use SetPrecision on that calculation to 20 places (as overkill). Then, when you perform the calculation again, you will see 70.
TSGal
FileMaker, Inc. 
11. Re: WRONG MATH : Multiplying by 100 change the result of decimal numbers, loss of precision
Vincent_L May 21, 2014 2:50 PM (in response to Vincent_L)Apparently MySQL does it right also
http://sqlfiddle.com/#!2/b1698/49
You can't have a system that behaves differently doing computation and storing data. That's a BUG.
And how should I do my floor ?

12. Re: WRONG MATH : Multiplying by 100 change the result of decimal numbers, loss of precision
Vincent_L May 21, 2014 2:55 PM (in response to Vincent_L)The only valid way is to store as the same precision that Filemaker computes.
So what's the computational precision of Filemaker ?
Do FMI really thinks that's it good to force all user in the world to use that set precision calc just to do VAT to non VAT price conversion. I'm not launching a spaceship.

13. Re: WRONG MATH : Multiplying by 100 change the result of decimal numbers, loss of precision
jbante Dec 15, 2016 12:25 PM (in response to Vincent_L)1 of 1 people found this helpfulI just independently ran into the same issue, and I'm satisfied by TSGal's response. The issue as she describes it is not that storage precision and calculation precision are different. It's that calculation/storage precision is binary, whereas display precision is decimal. It isn't mathematically possible for precisions in those bases to map cleanly to each other.
There's another behavior that may be affecting results that TSGal did not comment on, and can easily lead to the different results you get between FileMaker and other environments. FileMaker uses fixedpoint arithmetic. (See: About number fields.) Most other software that doesn't place a high priority on the finer points of numerical computing uses floating point arithmetic, which sometimes leads to different results, and can be similarly "wrong" in different calculations. Both approaches are only approximations of rational and realnumber arithmetic. Only symbolic arithmetic, limited to specialized software, gets it right every time.

14. Re: WRONG MATH : Multiplying by 100 change the result of decimal numbers, loss of precision
Vincent_L Dec 15, 2016 2:54 PM (in response to jbante)Thank Jbante, but I think it's annoying that Filemaker gives different results than Excel, Mysql and what we intuitively expect. If none are absolutely correct, then Filemaker is in the bad, or impractical side of wrong