ShortFloat.st
changeset 24975 fdf3a5b2f6b6
parent 24964 0236232a98e1
child 24976 0b3c34125507
equal deleted inserted replaced
24974:58dffe3baf29 24975:fdf3a5b2f6b6
   269 
   269 
   270 %{   /* NOCONTEXT */
   270 %{   /* NOCONTEXT */
   271      if (__isStringLike(aString) && __isSmallInteger(startIndex)) {
   271      if (__isStringLike(aString) && __isSmallInteger(startIndex)) {
   272         char *cp = (char *)(__stringVal(aString));
   272         char *cp = (char *)(__stringVal(aString));
   273         int idx = __intVal(startIndex) - 1;
   273         int idx = __intVal(startIndex) - 1;
   274         double atof(const char *);
       
   275 
   274 
   276         if ((unsigned)idx < __stringSize(aString)) {
   275         if ((unsigned)idx < __stringSize(aString)) {
       
   276 #ifndef NO_STRTOF
       
   277             float strtof(const char *, char**);
       
   278             float val = strtof(cp+idx, NULL);
       
   279 #else
       
   280             double atof(const char *);
   277             double val = atof(cp + idx);
   281             double val = atof(cp + idx);
       
   282 #endif
   278             RETURN (__MKSFLOAT(val));
   283             RETURN (__MKSFLOAT(val));
   279         }
   284         }
   280      }
   285      }
   281 %}.
   286 %}.
   282      self primitiveFailed.
   287      self primitiveFailed.