Hi qWord!
The rrr postulate become true, and so many macros bring a Ghost to live :biggrin:
I think is a little less glamorous but ...
In this loop I obtein 166.0 mod 1.0 = 1.0 wich have non sense. (always is 1.0 instead of 0.0)
165.700000 1.000000 mod = 0.700000
165.800000 1.000000 mod = 0.800000
165.900000 1.000000 mod = 0.900000
166.000000 1.000000 mod = 1.000000
x = 166.000000
166.100000 1.000000 mod = 0.100000
166.200000 1.000000 mod = 0.200000
166.300000 1.000000 mod = 0.300000
166.400000 1.000000 mod = 0.400000
166.500000 1.000000 mod = 0.500000
166.600000 1.000000 mod = 0.600000
166.700000 1.000000 mod = 0.700000
166.800000 1.000000 mod = 0.800000
166.900000 1.000000 mod = 0.900000
167.000000 1.000000 mod = 1.000000
x = 167.000000
167.100000 1.000000 mod = 0.100000
167.200000 1.000000 mod = 0.200000
Surely my error, but key operations depends on this function.
Thanks. HSE
Same results with independ modulus calculation. The problem is not mod().
Logical conclusion: ureal8$ it's alive and it's occulting the true numbers :shock: :shock: :shock:
Some rounding previous to mod() is nedeed.
Thanks.
Even if you go for REAL10, there is a point where rounding errors creep in - you can't avoid it completely.
Unless, of course, your data allow multiplying by a fixed value, e.g. 1000000, to let them become integers.
If you need to round to integers, add the following macro declaration somewhere after including math.inc.
; round to integer in current rounding mode
fslv_fnc_rndint macro
frndint
endm
default_fnc_dscptr2 <rndint>,nArgs=1,fpu=-1,x64=-1
The function is rndint(x).
For some time (perhaps) the minimum interval will not fall below 0.0001. In the classical problem is 0.002. Only is needed divide the numbers by the interval before to round them.
Sorry the in vivo transmition :biggrin: but now (inside the "get to clever" thing) the mod() SmplMath is not working very well, the alternative perfect:
fld temp1
fdiv temp2
fRndDn ; the ObjAsm32 function with setting round to floor
fmul temp2
fsubr temp1
fstp tempr15
Thanks qWord! Exactly in this part readability it's not an issue.
I use that sooner than expected!
fSlv4 INTIME = rndint(TIME*1/CINT) {i4}
Thanks :t