1 Pages (6 items)
mod function bug - Messages
#1 Posted: 7/1/2018 9:54:10 AM
Mod function is not working correctly when certain numbers are added to it.

Most values to be added work ok. But there are certain values that lead to wrong result. Note that the error occurs only when those values are assigned to a variable first, and then added. When they are added directly as numbers the are also OK. What could be the problem?
Most values to be added work ok. But there are certain values that lead to wrong result. Note that the error occurs only when those values are assigned to a variable first, and then added. When they are added directly as numbers the are also OK. What could be the problem?
#2 Posted: 7/1/2018 1:44:06 PM
WroteMost values to be added work ok. But there are certain values that lead to wrong result.
No rational number are exactly represented
4.34000000000001
is exactly equal to 3.40000000000000000000000000000000000000000000000 ...
Confirmed NO bug.
mod.sm (31 KiB) downloaded 35 time(s).
2 users liked this post
#3 Posted: 7/2/2018 7:14:14 AM
Thank you for your reply Jean, but I don't understand.
All of the above results are rationals, but only that value is represented as 4.340000...001
And, it is represented like that only when we add some values through a variable.
In any case, it's definetely not equal to 4.34, since problems occur with operations that follow. For example, b - d doesn't give an integer as a result and thus, if you put it as an argument in a function that needs integers as an argument, like Random(), you get an error
All of the above results are rationals, but only that value is represented as 4.340000...001
And, it is represented like that only when we add some values through a variable.
In any case, it's definetely not equal to 4.34, since problems occur with operations that follow. For example, b - d doesn't give an integer as a result and thus, if you put it as an argument in a function that needs integers as an argument, like Random(), you get an error
#4 Posted: 7/2/2018 3:28:22 PM
WroteThank you for your reply Jean, but I don't understand.
All of the above results are rationals, but only that value is represented as 4.340000...001
And, it is represented like that only when we add some values through a variable.
Patrick,
You will find infinitely many of such inexact numerical evaluations.
Only integer arithmetic is considered exact.
In numerical maths, not a single function exists, they are all approximations
... approximations wrt the 4 arithmetic operations [+, -, *, /].
In the first IBM MainFrame(s), only few functions could be implemented
... ln(x), SQRT(x), Trig ... They existed from high demanding maths,
in the form of Continued Fractions. Continued fractions origin from the
Mesopotamians, certainly doing something intelligible for Them.
In the post period to IBM MaiFrame typical but most probably the French
Bull system [remember Kennedy/De Gaulle war about Honeywell to purchase Bull],
Normalized Rational Fractions were implemented [Padé, recently passed away at 94 ?].
A normalized rational fraction has the form Pn(x)/[1+ Qn(x)] Qn or Q(n-1)
Thus, it enables parallel computation. The form, normalized [1+ Qn(x)] of the
denominator adds numerical stability ... That's not all, it starts here:
Many of the numerical math functions are built-in the processors,
... ln(x), exp(x), SQRT(x), Y^X [Power Fnct], trig ...
as implemented, they have theoretical 21 decimals accuracy, but uncertain in the
range 18 ... 21 D of which only 15 will be displayed to take care of multi-functions
computation and in full agreement to 15 D standard tables.
Inside calculations are all carried in full floating point accuracy.
In Engineering, results of 15 D is superfluous. They have no more meaning than 12 D
or much less Decimals as nothing is exact from whatever agreed formualtion.
Ah ! Your processor and mine disagree.
25 decimals are possible on some bigger processors. They are no more normalized
rational fractions. They are ChebyShev, extremely stable but more demanding in
numerical processing and don't allow parallel computation.
Higher accuracy were possible in Mathcad/Matsoft from their built-in Big-Engine.
Cheers Patrick ... Jean
2 users liked this post
#5 Posted: 7/2/2018 7:48:28 PM
WroteYou will find infinitely many of such inexact numerical evaluations.
Hart = 0.506915154862825
MCD ≡ 0.506915154862789
Who's right/wrong ? Abramowitz & Stegun
The 12th decimal is pretty small, as small as the leg of a fly 1 mm long
that you chop 1000, chop again 1000, chop again 1000.
1. A typical Normalized Rational Fraction [Bessel]
2. Typical "mod" RGB
Jean
Bessel JY.sm (64 KiB) downloaded 31 time(s).
Pattern Mandelbrot RGB.sm (693 KiB) downloaded 32 time(s).
1 users liked this post
Patrick Ps 7/4/2018 6:13:00 AM
#6 Posted: 7/4/2018 6:12:24 AM
Thanks again Jean, I think I get it now!
I'll check whether my problem is fixed if I ask my sheet to use less decimals accuracy.

I'll check whether my problem is fixed if I ask my sheet to use less decimals accuracy.

1 Pages (6 items)
-
New Posts
-
No New Posts