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> 2006-04-24 Alex Perez <aperez@alexperez.com>
* Source/NSProcessInfo.m: Elaborated upon the * Source/NSProcessInfo.m: Elaborated upon the
@ -12,28 +17,28 @@
2006-04-14 Jeremy Bettis <jeremy@deadbeef.com> 2006-04-14 Jeremy Bettis <jeremy@deadbeef.com>
* Source/win32/GSFileHandleWin32.m: Fix background reading of pipes. * Source/win32/GSFileHandleWin32.m: Fix background reading of pipes.
Several changes for Openstep compatiblity: Don't queue notification, Several changes for Openstep compatiblity: Don't queue notification,
don't raise exception when asked to read while a background operation don't raise exception when asked to read while a background operation
is in progress. is in progress.
* Source/win32/GSRunLoopCtxt.m: If there are no handles to block on * Source/win32/GSRunLoopCtxt.m: If there are no handles to block on
but there is a timer, sleep until the timer needs to wake up. but there is a timer, sleep until the timer needs to wake up.
2006-04-12 Jeremy Bettis <jeremy@deadbeef.com> 2006-04-12 Jeremy Bettis <jeremy@deadbeef.com>
* Source/NSTimeZone.m: Use native time zone files under Solaris. * Source/NSTimeZone.m: Use native time zone files under Solaris.
* Source/GSFFCallInvocation.m: If the returning context is expecting * Source/GSFFCallInvocation.m: If the returning context is expecting
a void* but we have a different return type just cast it. This a void* but we have a different return type just cast it. This
normally is because the method was not declared and has defaulted normally is because the method was not declared and has defaulted
to returning id. to returning id.
* Source/win32/NSUserDefaultsWin32.m: Write defaults to registry as * Source/win32/NSUserDefaultsWin32.m: Write defaults to registry as
unicode strings, read in either unicode(REG_SZ) or ascii(REG_BINARY). unicode strings, read in either unicode(REG_SZ) or ascii(REG_BINARY).
* Source/win32-load.h: In mingw, fileSystemRepresentation is unicode * Source/win32-load.h: In mingw, fileSystemRepresentation is unicode
* Source/objc-load.m: In mingw, fileSystemRepresentation is unicode * Source/objc-load.m: In mingw, fileSystemRepresentation is unicode
* Source/NSPropertyList.m (propertyListFromData:mutabilityOption:format:errorDescription:): * Source/NSPropertyList.m (propertyListFromData:mutabilityOption:format:errorDescription:):
Don't call memcmp if the data is smaller than 8 bytes. Don't call memcmp if the data is smaller than 8 bytes.
* Source/NSFileManager.m (isExecutableFileAtPath:): * Source/NSFileManager.m (isExecutableFileAtPath:):
Added a comment Added a comment
* Source/NSBundle.m (objc_executable_location): * Source/NSBundle.m (objc_executable_location):
A cast was obsuring a misuse of fileSystemRepresentation A cast was obsuring a misuse of fileSystemRepresentation
2006-04-10 Fred Kiefer <FredKiefer@gmx.de> 2006-04-10 Fred Kiefer <FredKiefer@gmx.de>

View file

@ -268,7 +268,7 @@ GSBreakTime(NSTimeInterval when, int *year, int *month, int *day,
m = m * 60; m = m * 60;
c = a - h - m; c = a - h - m;
*second = (int)c; *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 -= (_seconds_since_ref + offset(_time_zone, self));
s = fabs(s); s = fabs(s);
s -= floor(s); s -= floor(s);
v = (int)(s * 1000); v = (int)(s * 1000.0);
} }
Grow(info, 3); Grow(info, 3);
info->t[info->offset+2] = (v%10) + '0'; info->t[info->offset+2] = (v%10) + '0';