Differences From Artifact [3bd254e0cf]:
- File
src/OFNumber.m
— part of check-in
[0db281bf03]
at
2012-06-11 11:08:47
on branch trunk
— Improve -[OFNumber description].
The %f conversion specifier does not include a decimal point if none is
required. In such cases, append ".0" to indicate that the number is of a
floating point type. (user: js, size: 28581) [annotate] [blame] [check-ins using] [more...]
To Artifact [b82d9f97c4]:
- File src/OFNumber.m — part of check-in [8892ae9fcc] at 2012-07-12 01:28:46 on branch trunk — Don't access isa directly. (user: js, size: 28702) [annotate] [blame] [check-ins using]
︙ | |||
82 83 84 85 86 87 88 | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | - + | return (t)value.uintptr; \ case OF_NUMBER_FLOAT: \ return (t)value.float_; \ case OF_NUMBER_DOUBLE: \ return (t)value.double_; \ default: \ @throw [OFInvalidFormatException \ |
︙ | |||
166 167 168 169 170 171 172 | 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | - + | return [OFNumber numberWithFloat: \ value.float_ o [n floatValue]]; \ case OF_NUMBER_DOUBLE: \ return [OFNumber numberWithDouble: \ value.double_ o [n doubleValue]]; \ default: \ @throw [OFInvalidFormatException \ |
︙ | |||
245 246 247 248 249 250 251 | 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | - + - + | value.intptr o [n intPtrValue]]; \ case OF_NUMBER_UINTPTR: \ return [OFNumber numberWithUIntPtr: \ value.uintptr o [n uIntPtrValue]]; \ case OF_NUMBER_FLOAT: \ case OF_NUMBER_DOUBLE: \ @throw [OFNotImplementedException \ |
︙ | |||
310 311 312 313 314 315 316 | 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 | - + | return [OFNumber numberWithUIntPtr: value.uintptr o]; \ case OF_NUMBER_FLOAT: \ return [OFNumber numberWithFloat: value.float_ o]; \ case OF_NUMBER_DOUBLE: \ return [OFNumber numberWithDouble: value.double_ o]; \ default: \ @throw [OFInvalidFormatException \ |
︙ | |||
446 447 448 449 450 451 452 | 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 | - + | + numberWithDouble: (double)double_ { return [[[self alloc] initWithDouble: double_] autorelease]; } - init { |
︙ | |||
721 722 723 724 725 726 727 | 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 | - + - + - + | @try { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFString *typeString; if (![[element name] isEqual: [self className]] || ![[element namespace] isEqual: OF_SERIALIZATION_NS]) @throw [OFInvalidArgumentException |
︙ | |||
1125 1126 1127 1128 1129 1130 1131 | 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 | - + + | case OF_NUMBER_FLOAT: return [OFNumber numberWithFloat: fmodf(value.float_, [number floatValue])]; case OF_NUMBER_DOUBLE: return [OFNumber numberWithDouble: fmod(value.double_, [number doubleValue])]; default: |
︙ | |||
1185 1186 1187 1188 1189 1190 1191 | 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 | - + + | if (![ret containsString: @"."]) [ret appendString: @".0"]; [ret makeImmutable]; return ret; default: |
︙ | |||
1247 1248 1249 1250 1251 1252 1253 | 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 | - + + | [element addAttributeWithName: @"type" stringValue: @"double"]; [element setStringValue: [OFString stringWithFormat: @"%la", value.double_]]; break; default: |
︙ |