equal
deleted
inserted
replaced
318 |
318 |
319 %{ /* NOCONTEXT */ |
319 %{ /* NOCONTEXT */ |
320 int idx = __intVal(startIndex) - 1; |
320 int idx = __intVal(startIndex) - 1; |
321 |
321 |
322 if (__isStringLike(aString) && __isSmallInteger(startIndex)) { |
322 if (__isStringLike(aString) && __isSmallInteger(startIndex)) { |
323 char *cp = (char *)(__stringVal(aString)); |
323 char *cp = (char *)(__stringVal(aString)); |
324 double atof(); |
324 double val; |
325 double val; |
325 OBJ newFloat; |
326 OBJ newFloat; |
326 |
327 |
327 if ((unsigned)idx < __stringSize(aString)) { |
328 if ((unsigned)idx < __stringSize(aString)) { |
328 #ifndef NO_STRTOD |
329 val = atof(cp + idx); |
329 double strtod(const char *, char**); |
330 __qMKFLOAT(newFloat, val); |
330 val = strtod(cp+idx, NULL); |
331 RETURN (newFloat); |
331 #else |
332 } |
332 double atof(); |
|
333 val = atof(cp + idx); |
|
334 #endif |
|
335 __qMKFLOAT(newFloat, val); |
|
336 RETURN (newFloat); |
|
337 } |
333 } |
338 } |
334 %}. |
339 %}. |
335 self primitiveFailed. |
340 self primitiveFailed. |
336 |
341 |
337 " |
342 " |
361 Float fastFromString:'-Inf' |
366 Float fastFromString:'-Inf' |
362 " |
367 " |
363 |
368 |
364 " |
369 " |
365 Time millisecondsToRun:[ |
370 Time millisecondsToRun:[ |
366 1000000 timesRepeat:[ |
371 1000000 timesRepeat:[ |
367 Float readFrom:'123.45' |
372 Float readFrom:'123.45' |
368 ] |
373 ] |
369 ] |
374 ] |
370 " |
375 " |
371 |
376 |
372 " |
377 " |
373 Time millisecondsToRun:[ |
378 Time millisecondsToRun:[ |
374 1000000 timesRepeat:[ |
379 1000000 timesRepeat:[ |
375 Float fastFromString:'123.45' at:1 |
380 Float fastFromString:'123.45' at:1 |
376 ] |
381 ] |
377 ] |
382 ] |
378 " |
383 " |
379 |
384 |
380 "Modified (comment): / 21-06-2017 / 09:24:32 / cg" |
385 "Modified (comment): / 21-06-2017 / 09:24:32 / cg" |
381 "Modified (comment): / 20-03-2019 / 13:45:12 / Claus Gittinger" |
386 "Modified (comment): / 20-03-2019 / 13:45:12 / Claus Gittinger" |
1975 "Modified: / 16.11.2001 / 14:14:29 / cg" |
1980 "Modified: / 16.11.2001 / 14:14:29 / cg" |
1976 ! |
1981 ! |
1977 |
1982 |
1978 ldexp:exp |
1983 ldexp:exp |
1979 "multiply the receiver by an integral power of 2. |
1984 "multiply the receiver by an integral power of 2. |
1980 I.e. return self * (2 ^ exp)" |
1985 I.e. return self * (2 ^ exp). |
|
1986 This is also the operation to reconstruct the original float from its |
|
1987 mantissa and exponent: (f mantissa ldexp:f exponent) = f" |
1981 |
1988 |
1982 %{ /* NOCONTEXT */ |
1989 %{ /* NOCONTEXT */ |
1983 #ifndef __SCHTEAM__ |
1990 #ifndef __SCHTEAM__ |
1984 double val, rslt; |
1991 double val, rslt; |
1985 OBJ newFloat; |
1992 OBJ newFloat; |
2004 #endif |
2011 #endif |
2005 %}. |
2012 %}. |
2006 ^ super ldexp:exp |
2013 ^ super ldexp:exp |
2007 |
2014 |
2008 " |
2015 " |
|
2016 1.0 mantissa ldexp:1.0 exponent |
|
2017 -1.0 mantissa ldexp:-1.0 exponent |
|
2018 |
2009 1.0 ldexp:16 -> 65536.0 |
2019 1.0 ldexp:16 -> 65536.0 |
2010 1.0 ldexp:100 -> 1.26765060022823E+30 |
2020 1.0 ldexp:100 -> 1.26765060022823E+30 |
2011 1 * (2 raisedToInteger:100) -> 1267650600228229401496703205376 |
2021 1 * (2 raisedToInteger:100) -> 1267650600228229401496703205376 |
2012 1.0 ldexp:200 -> 1.60693804425899E+60 |
2022 1.0 ldexp:200 -> 1.60693804425899E+60 |
2013 " |
2023 " |