Avoid minor rounding errors.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@22807 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2006-04-24 15:43:21 +00:00
parent 504edc1c85
commit 4185b2524b
2 changed files with 18 additions and 13 deletions

View file

@ -1,3 +1,8 @@
2006-04-24 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSCalendarDate.m: Avoid a couple of minor rounding errors
by using floating point constants for millisecond multipliers.
2006-04-24 Alex Perez <aperez@alexperez.com>
* Source/NSProcessInfo.m: Elaborated upon the

View file

@ -268,7 +268,7 @@ GSBreakTime(NSTimeInterval when, int *year, int *month, int *day,
m = m * 60;
c = a - h - m;
*second = (int)c;
*mil = (a - h - m - c) * 1000;
*mil = (int)((a - h - m - c) * 1000.0);
}
/**
@ -1897,7 +1897,7 @@ static void Grow(DescriptionInfo *info, unsigned size)
s -= (_seconds_since_ref + offset(_time_zone, self));
s = fabs(s);
s -= floor(s);
v = (int)(s * 1000);
v = (int)(s * 1000.0);
}
Grow(info, 3);
info->t[info->offset+2] = (v%10) + '0';