--- a/ShortFloat.st Fri Oct 26 21:08:58 2018 +0200
+++ b/ShortFloat.st Sat Oct 27 08:50:24 2018 +0200
@@ -261,21 +261,21 @@
"return the next ShortFloat from the string starting at startIndex.
No spaces are skipped.
- This is a specially tuned entry (using a low-level C-call), which
+ This is a specially tuned entry (using a low-level C-call to atof), which
returns garbage if the argument string is not a valid float number.
It has been added to allow higher speed string decomposition into numbers,
especially for mass-data."
%{ /* NOCONTEXT */
if (__isStringLike(aString) && __isSmallInteger(startIndex)) {
- char *cp = (char *)(__stringVal(aString));
- int idx = __intVal(startIndex) - 1;
- double atof(const char *);
-
- if ((unsigned)idx < __stringSize(aString)) {
- double val = atof(cp + idx);
- RETURN (__MKSFLOAT(val));
- }
+ char *cp = (char *)(__stringVal(aString));
+ int idx = __intVal(startIndex) - 1;
+ double atof(const char *);
+
+ if ((unsigned)idx < __stringSize(aString)) {
+ double val = atof(cp + idx);
+ RETURN (__MKSFLOAT(val));
+ }
}
%}.
self primitiveFailed.
@@ -295,19 +295,21 @@
ShortFloat fastFromString:'hello123.45E4' at:1
Time millisecondsToRun:[
- 100000 timesRepeat:[
- ShortFloat readFrom:'123.45'
- ]
+ 100000 timesRepeat:[
+ ShortFloat readFrom:'123.45'
+ ]
]
"
"
Time millisecondsToRun:[
- 100000 timesRepeat:[
- ShortFloat fastFromString:'123.45' at:1
- ]
+ 100000 timesRepeat:[
+ ShortFloat fastFromString:'123.45' at:1
+ ]
]
"
+
+ "Modified: / 27-10-2018 / 08:50:00 / Claus Gittinger"
!
fromIEEE32Bit: anInteger
@@ -352,6 +354,7 @@
"Modified (comment): / 10-05-2018 / 01:09:13 / stefan"
! !
+
!ShortFloat class methodsFor:'binary storage'!
readBinaryIEEESingleFrom:aStream
@@ -583,6 +586,7 @@
"Modified: 23.4.1996 / 09:26:45 / cg"
! !
+
!ShortFloat class methodsFor:'queries'!
defaultPrintPrecision