Overview
Comment: | OFString: Manually handle NaN
strtod() on HP-UX does not accept NaN. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
cd4fd689d629d695d179ad7a2cabf37b |
User & Date: | js on 2021-01-01 22:11:33 |
Other Links: | manifest | tags |
Context
2021-01-01
| ||
22:15 | Exclude HP-UX from 0x test for -[doubleValue] check-in: 142f0d1242 user: js tags: trunk | |
22:11 | OFString: Manually handle NaN check-in: cd4fd689d6 user: js tags: trunk | |
21:53 | platform.h: Add a define for HP-UX check-in: d94fe339fc user: js tags: trunk | |
Changes
Modified src/OFString.m from [7e6178bd46] to [3d251eedbb].
︙ | |||
2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 | 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 | + + + + | if ([stripped caseInsensitiveCompare: @"INF"] == OF_ORDERED_SAME || [stripped caseInsensitiveCompare: @"INFINITY"] == OF_ORDERED_SAME) return INFINITY; if ([stripped caseInsensitiveCompare: @"-INF"] == OF_ORDERED_SAME || [stripped caseInsensitiveCompare: @"-INFINITY"] == OF_ORDERED_SAME) return -INFINITY; if ([stripped caseInsensitiveCompare: @"NAN"] == OF_ORDERED_SAME) return NAN; if ([stripped caseInsensitiveCompare: @"-NAN"] == OF_ORDERED_SAME) return -NAN; #ifdef HAVE_STRTOF_L const char *UTF8String = self.UTF8String; #else /* * If we have no strtof_l, we have no other choice but to replace "." * with the locale's decimal point. |
︙ | |||
2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 | 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 | + + + + | if ([stripped caseInsensitiveCompare: @"INF"] == OF_ORDERED_SAME || [stripped caseInsensitiveCompare: @"INFINITY"] == OF_ORDERED_SAME) return INFINITY; if ([stripped caseInsensitiveCompare: @"-INF"] == OF_ORDERED_SAME || [stripped caseInsensitiveCompare: @"-INFINITY"] == OF_ORDERED_SAME) return -INFINITY; if ([stripped caseInsensitiveCompare: @"NAN"] == OF_ORDERED_SAME) return NAN; if ([stripped caseInsensitiveCompare: @"-NAN"] == OF_ORDERED_SAME) return -NAN; #ifdef HAVE_STRTOD_L const char *UTF8String = self.UTF8String; #else /* * If we have no strtod_l, we have no other choice but to replace "." * with the locale's decimal point. |
︙ |
Modified tests/OFStringTests.m from [7e0dbd9c91] to [27d0709520].
︙ | |||
1106 1107 1108 1109 1110 1111 1112 | 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 | - + + | * These test numbers can be generated without rounding if we have IEEE * floating point numbers, thus we can use == on them. */ TEST(@"-[floatValue]", C(@"\t-0.25 ").floatValue == -0.25 && C(@"\r\n\tINF\t\n").floatValue == INFINITY && C(@"\r -INFINITY\n").floatValue == -INFINITY && |
︙ |