mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-03 10:00:51 +00:00
fix (and test) for bug #43722
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38213 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
f9d7d1a577
commit
a75ab40fec
3 changed files with 29 additions and 9 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2014-11-29 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/NSScanner.m: Fixup error in scanning doubles with excess
|
||||||
|
precision (bug #43722).
|
||||||
|
|
||||||
2014-11-28 johannes@brilliantservice.co.jp
|
2014-11-28 johannes@brilliantservice.co.jp
|
||||||
|
|
||||||
* Source/NSThread.m: Set thread name visible to OS
|
* Source/NSThread.m: Set thread name visible to OS
|
||||||
|
@ -19,7 +24,7 @@
|
||||||
|
|
||||||
2014-11-20 Richard Frith-Macdonald <rfm@gnu.org>
|
2014-11-20 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/NSRunLoop.m: Avoinf some unnecessary retain/release cycles.
|
* Source/NSRunLoop.m: Avoind some unnecessary retain/release cycles.
|
||||||
|
|
||||||
2014-11-05 Richard Frith-Macdonald <rfm@gnu.org>
|
2014-11-05 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
|
|
@ -1243,6 +1243,7 @@ GSScanDouble(unichar *buf, unsigned length, double *result)
|
||||||
int exponent = 0;
|
int exponent = 0;
|
||||||
BOOL negativeMantissa = NO;
|
BOOL negativeMantissa = NO;
|
||||||
BOOL negativeExponent = NO;
|
BOOL negativeExponent = NO;
|
||||||
|
BOOL extra = NO;
|
||||||
unsigned pos = 0;
|
unsigned pos = 0;
|
||||||
int mantissaLength;
|
int mantissaLength;
|
||||||
int dotPos = -1;
|
int dotPos = -1;
|
||||||
|
@ -1301,14 +1302,8 @@ GSScanDouble(unichar *buf, unsigned length, double *result)
|
||||||
{
|
{
|
||||||
/* Mantissa too long ... ignore excess.
|
/* Mantissa too long ... ignore excess.
|
||||||
*/
|
*/
|
||||||
if (19 == mantissaLength && (dotPos < 0 || dotPos >= mantissaLength))
|
mantissaLength = 18;
|
||||||
{
|
extra = YES;
|
||||||
mantissaLength--;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mantissaLength = 19;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (dotPos < 0)
|
if (dotPos < 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,6 +28,26 @@ int main()
|
||||||
d = [@" 1.2" doubleValue];
|
d = [@" 1.2" doubleValue];
|
||||||
PASS(d > 1.199999 && d < 1.200001, "doubleValue with leading space works");
|
PASS(d > 1.199999 && d < 1.200001, "doubleValue with leading space works");
|
||||||
|
|
||||||
|
s = @"50.6468746467461646";
|
||||||
|
sscanf([s UTF8String], "%lg", &d);
|
||||||
|
PASS(EQ([s doubleValue], d), "50.6468746467461646 -doubleValue OK");
|
||||||
|
|
||||||
|
s = @"50.64687464674616461";
|
||||||
|
sscanf([s UTF8String], "%lg", &d);
|
||||||
|
PASS(EQ([s doubleValue], d), "50.64687464674616461 -doubleValue OK");
|
||||||
|
|
||||||
|
s = @"0.646874646746164616898211";
|
||||||
|
sscanf([s UTF8String], "%lg", &d);
|
||||||
|
PASS(EQ([s doubleValue], d), "0.646874646746164616898211 -doubleValue OK");
|
||||||
|
|
||||||
|
s = @"502.646874646746164";
|
||||||
|
sscanf([s UTF8String], "%lg", &d);
|
||||||
|
PASS(EQ([s doubleValue], d), "502.646874646746164 -doubleValue OK");
|
||||||
|
|
||||||
|
s = @"502.6468746467461646";
|
||||||
|
sscanf([s UTF8String], "%lg", &d);
|
||||||
|
PASS(EQ([s doubleValue], d), "502.6468746467461646 -doubleValue OK");
|
||||||
|
|
||||||
s = [NSString stringWithCharacters: &u length: 1];
|
s = [NSString stringWithCharacters: &u length: 1];
|
||||||
PASS_EQUAL(s, @"£", "UTF-8 string literal matches 16bit unicode string");
|
PASS_EQUAL(s, @"£", "UTF-8 string literal matches 16bit unicode string");
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue