

Le 180902 à 20:27, Bald Eagle a écrit :
>
> So....
>
> I _just_ want to use mod (N, 0.1) in a loop of #for(N, 0, 1, 0.02).
>
> What's a good reliable way to implement an fmod() equivalent?
> Do I need to write a macro, or is there a straightforward function (){} that I
> can use?
>
> Sorry to be grappling with "computer science math" again.
> Thus, I return to the newusers section. :
>
> Some of the values I get are "0", others are "0.1".
> I'm challenged by the wide disparity between the two possibilities, and can't
> get anything to work reliably, especially when I try to use the mod(A, B) result
> in a select () statement.
>
>
>
I would multiply everything by 10 or 100, calculate the mod(A,B), then
divide by 10 or 100.
mod(A,B) stand for the remainder of an integer division. It don't play
well with a noninteger divisor. At least, that's what I tend to assume.
You can use something like :
#declare Something = mod(N*10, 1)/10;
This is functionally identical to what you want.
Post a reply to this message

