lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> > > It can be improved by changing the formula used by Lua to calculate
> > modulo.
> >
> > Any suggestion?
> >
> > -- Roberto
> >
> >
> double modulo4Lua (double x, double y){
>    double m = fmod(x, y);
>    if ((m != 0.0) && (x*y < 0.0))
>       return y + m;
>    else
>       return m;}

Many thanks.

-- Roberto