@@ -15,10 +15,11 @@ */ #include "config.h" #include +#include #include #include #include #if defined(HAVE_STRTOF_L) || defined(HAVE_STRTOD_L) @@ -2517,10 +2518,22 @@ } - (float)floatValue { void *pool = objc_autoreleasePoolPush(); + +#if defined(OF_MORPHOS) && !defined(OF_IXEMUL) + OFString *stripped = [self stringByDeletingEnclosingWhitespaces]; + + 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; +#endif + #ifdef HAVE_STRTOF_L const char *UTF8String = [self UTF8String]; #else /* * If we have no strtof_l, we have no other choice but to replace "." @@ -2558,10 +2571,22 @@ } - (double)doubleValue { void *pool = objc_autoreleasePoolPush(); + +#if defined(OF_MORPHOS) && !defined(OF_IXEMUL) + OFString *stripped = [self stringByDeletingEnclosingWhitespaces]; + + 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; +#endif + #ifdef HAVE_STRTOD_L const char *UTF8String = [self UTF8String]; #else /* * If we have no strtod_l, we have no other choice but to replace "."