[svn:parrot] r39565 - trunk/src/string
bacek at svn.parrot.org
bacek at svn.parrot.org
Sun Jun 14 23:16:07 UTC 2009
Author: bacek
Date: Sun Jun 14 23:16:06 2009
New Revision: 39565
URL: https://trac.parrot.org/parrot/changeset/39565
Log:
[core] Applying patch from TT#758 to improve Parrot_str_to_num.
Modified:
trunk/src/string/api.c
Modified: trunk/src/string/api.c
==============================================================================
--- trunk/src/string/api.c Sun Jun 14 21:46:29 2009 (r39564)
+++ trunk/src/string/api.c Sun Jun 14 23:16:06 2009 (r39565)
@@ -2315,20 +2315,29 @@
return 0.0;
}
- if (d && d_is_safe) {
- f = mantissa + (1.0 * d / powl(10, d_length));
- }
+/* local macro to call proper pow version depending on FLOATVAL */
+#if NUMVAL_SIZE == DOUBLE_SIZE
+# define POW pow
+#else
+# define POW powl
+#endif
+
+ if (d && d_is_safe) {
+ f = mantissa + (1.0 * d / POW(10.0, d_length));
+ }
if (sign < 0)
f = -f;
if (e) {
if (e_sign == 1)
- f *= powl(10, e);
+ f *= POW(10.0, e);
else
- f /= powl(10, e);
+ f /= POW(10.0, e);
}
+#undef POW
+
return f;
}
More information about the parrot-commits
mailing list