Bug 767519 - Add NS_flooredModulo to nsMathUtils. r=bz

--HG--
extra : rebase_source : d16e5d8e94a50c1e3319d866e3aa27ae6160edd8
This commit is contained in:
Mounir Lamouri 2012-07-05 16:18:37 +02:00
Родитель d09719cb78
Коммит a643785d84
1 изменённых файлов: 11 добавлений и 0 удалений

Просмотреть файл

@ -107,4 +107,15 @@ inline NS_HIDDEN_(bool) NS_finite(double d)
#endif
}
/**
* Returns the result of the modulo of x by y using a floored division.
* fmod(x, y) is using a truncated division.
* The main difference is that the result of this method will have the sign of
* y while the result of fmod(x, y) will have the sign of x.
*/
inline NS_HIDDEN_(double) NS_floorModulo(double x, double y)
{
return (x - y * floor(x / y));
}
#endif