Make sure that data functions return 0 instead of -0 for a number of

date functions such as getHours for dates before 1970.

This is consistent with the behavior of other JavaScript engines.

Review URL: http://codereview.chromium.org/9770

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@732 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
ager@chromium.org 2008-11-11 13:30:05 +00:00
parent 8bea254650
commit f6911f6be8

View File

@ -50,6 +50,8 @@ function Day(time) {
// ECMA 262 - 5.2
function Modulo(value, remainder) {
var mod = value % remainder;
// Guard against returning -0.
if (mod == 0) return 0;
return mod >= 0 ? mod : mod + remainder;
}