octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #45481] rem and fmod may give very wrong resul


From: Alexander Klein
Subject: [Octave-bug-tracker] [bug #45481] rem and fmod may give very wrong results for large arguments
Date: Wed, 08 Jul 2015 09:22:19 +0000
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/534.59.10 (KHTML, like Gecko) Version/5.1.9 Safari/534.59.10

Follow-up Comment #3, bug #45481 (project octave):

The problem is similar to #42627, but it goes in the opposite direction:

While the problem there is that rounding may have nudged a number away from
being an integer, we have in our case numbers which are so large that their
being or not being integers cannot be decided, anyway.

Look at the following:

octave:233> printf ( "%62.5fn", 1e62 ./ [2 3 5 7 11 13 17 19 23] )
50000000000000001751099842971580586523040158899155912802435072.00000
33333333333333336403730152255666899093074731865430790378618880.00000
20000000000000001842238091353400139455844839119258474227171328.00000
14285714285714287437955120311274351342256590642183234843049984.00000
9090909090909090967973118230112855539046216263574686621761536.00000
7692307692307693235821987859916958415061241115021741838565376.00000
5882352941176471130070026868647099839954364446840727713873920.00000
5263157894736842064234558306593764730064337339464548234559488.00000
4347826086956522108589852626696554641307878733545426214977536.00000

Considering that 1e62 = 2^62 * 5^62, it is obvious that almost all of the
above results are wrong in apparently being integers. Even long doubles in
this region are so sparse, already, that integrity as a concept just crumbles
away, but most of the time we can just ignore this fact, or are led astray by
seeing decimal representations of binary encodings.

(Note: You may want to have a look at Floating-Point Arithmetic Besieged by
“Business Decisions” <http://www.cs.berkeley.edu/~wkahan/ARITH_17.pdf> and
How Futile are Mindless Assessments of Roundoff in Floating-Point Computation
? <http://www.cs.berkeley.edu/~wkahan/Mindless.pdf> by William Kahan, they are
both quite amusing to read.)

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?45481>

_______________________________________________
  Nachricht gesendet von/durch Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]