mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
Bug 767519 - Add NS_flooredModulo to nsMathUtils. r=bz
--HG-- extra : rebase_source : d16e5d8e94a50c1e3319d866e3aa27ae6160edd8
This commit is contained in:
parent
d09719cb78
commit
a643785d84
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user