Bug with mod(x,y) function?

Hi,

With Igor 6.37,
I was trying to use the mod function but it turns out funny, so I checked it step by step and found this:
print (mod(3.8e-6*1.2*1e9,2*8))
  16


where

print 3.8e-6*1.2*1e9/(2*8)
  285


Checking on Wolfram, the mod does give zero.
https://www.wolframalpha.com/input/?i=(mod(3.8e-6*1.2*1e9,2*8))
Am I missing something?

PS: Just tested in Igor 7.0.8, the same happens.
printf "%0.20f\r", 3.8e-6*1.2*1e9/(2*8)
  284.99999999999994315658
printf "%0.20f\r",  (mod(3.8e-6*1.2*1e9,2*8))
  15.99999999999909050530
printf "%0.20f\r",  (mod(3.8*1.2*1e3,2*8))
  0.00000000000000000000
tony wrote:
printf "%0.20f\r", 3.8e-6*1.2*1e9/(2*8)
  284.99999999999994315658
printf "%0.20f\r",  (mod(3.8e-6*1.2*1e9,2*8))
  15.99999999999909050530
printf "%0.20f\r",  (mod(3.8*1.2*1e3,2*8))
  0.00000000000000000000


Thanks for the idea, sounds like a precision issue.
In my case I can modify it to have 3.8, that should solve it for now.


Update: Not really, and I found another problem.
The above were a proc for a panel setVariable action entry.
1. If I type in a number 3.8e-5, the mod() returns zero and it works.
2. If I scroll using mouse from 3.7e-5 to 3.8e-5 (incre is 1e-6), the mod() returns something funny and cause problem.
print (mod(round(3.8*10^-6*1.2*1e9),2*8))
  0
print (mod(round(3.8*10e-6*1.2*1e9),2*8))
  0


--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH
jjweimer wrote:
print (mod(round(3.8*10^-6*1.2*1e9),2*8))
  0
print (mod(round(3.8*10e-6*1.2*1e9),2*8))
  0


--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH

Thanks a lot, this has solved it completely (even with scrolling).