mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-26 03:35:33 +00:00
Bug 1222866: P1. Round second to closest microseconds. r=gerald.
Due to the internal double representation as per IEEE 754, during conversion the use of ints would have rounded down our value.
This commit is contained in:
parent
5b0d94ec87
commit
d316442a2d
@ -93,7 +93,9 @@ public:
|
||||
if (mozilla::IsInfinite<double>(aValue)) {
|
||||
return FromInfinity();
|
||||
}
|
||||
double val = aValue * USECS_PER_S;
|
||||
// Due to internal double representation, this
|
||||
// operation is not commutative, do not attempt to simplify.
|
||||
double val = (aValue + .0000005) * USECS_PER_S;
|
||||
if (val >= double(INT64_MAX)) {
|
||||
return FromMicroseconds(INT64_MAX);
|
||||
} else if (val <= double(INT64_MIN)) {
|
||||
|
Loading…
Reference in New Issue
Block a user