|
 |
kurtz le pirate <kur### [at] free fr> wrote:
>
> the modulo function returns.
>
> Try this :
>
> #declare a = 27.44;
> #declare b = 7.97;
>
> #while(a > b)
> #declare r = a - b;
> #debug concat("mod(",str(a,0,2),", ",str(b,0,2),") = ",str(r,0,2),"\n")
> #declare a = r;
> #end
>
> Which gives :
>
> mod(27.44, 7.97) = 19.47
> mod(19.47, 7.97) = 11.50
> mod(11.50, 7.97) = 3.53
>
> ...and 3.53 is of course equal to mod(27.44, 7.97)
>
That's a clever little demonstration; I'm going to keep it for reference.
Thanks!
Post a reply to this message
|
 |