[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
rem and mod
From: |
Paul Soderlind |
Subject: |
rem and mod |
Date: |
Thu, 26 Jun 2014 03:45:33 -0700 (PDT) |
Hi all,
rem(0.94,0.01) gives the answer 0.01 (in 3.8.1-4 from mxeoctave.osuv.de, but
also in other windows binaries), but I had expected to get 0. mod is
similar.
The reason seems to be related to that fix(0.94/0.01) = 93, since 0.94/0.01
- 94 is evaluated to be -1.4211e-14. Clearly, floating point precision
playing tricks. rem(94,1) does the right thing
Is this to be expected? (...matlab gives 0 and Octave''s ) Would be good to
know. Thanks
Paul Söderlind
--
View this message in context:
http://octave.1599824.n4.nabble.com/rem-and-mod-tp4665069.html
Sent from the Octave - General mailing list archive at Nabble.com.
- rem and mod,
Paul Soderlind <=