зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
16757f4a4b
Коммит
7c8d6ceb7d
|
@ -93,7 +93,9 @@ public:
|
||||||
if (mozilla::IsInfinite<double>(aValue)) {
|
if (mozilla::IsInfinite<double>(aValue)) {
|
||||||
return FromInfinity();
|
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)) {
|
if (val >= double(INT64_MAX)) {
|
||||||
return FromMicroseconds(INT64_MAX);
|
return FromMicroseconds(INT64_MAX);
|
||||||
} else if (val <= double(INT64_MIN)) {
|
} else if (val <= double(INT64_MIN)) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче