Author |
Topic  |
|
andrewdsto
Australia
Posts |
Posted - 07/16/2015 : 03:15:28 AM
|
Origin Ver. 2015 and Service Release sr2 (Select Help-->About Origin): Operating System:Windows 7
Hi, Just a short question on the rmod function. I dont think it is working as it should, see below.
rmod(6,2)=; returns rmod(6,2)=0
All ok, same the mod function. now
5*4.2=; rmod(21,4.2)=;
we get
5*4.2=21 rmod(21,4.2)=4.2
however
rmod(21,5)=; returns rmod(21,5)=1
again ok and
rmod(21,4.1)=; returns rmod(21,4.1)=0.5
again ok
its only when the remainder is meant to be zero we instead get the divisor.
interestingly if we run the folowing 4.2*6=; 25.2-(6*4.2)=;
we get 4.2*6=25.2 25.2-(6*4.2)=-3.5527136788005E-15
that is we do not get zero but instead a very small number.
I am thinking that where the modulus is zero, the rmod funtion infact returns not zero but a number that is very close to, but just below, the divisor which gets returned as the divisor. But this is only for real numbers and not integers.
just a thought.
thanks Andrew |
|
SeanMao
China
288 Posts |
Posted - 07/16/2015 : 04:41:31 AM
|
Hi,
This is due to the rounding error, when you do rmod(21,4.2) you actually get remainder 4.199999... rather precise 0.
Regards!
Sean
OriginLab Tech. Service |
Edited by - SeanMao on 07/16/2015 04:42:12 AM |
 |
|
|
Topic  |
|
|
|