summaryrefslogtreecommitdiff
path: root/numeric.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2014-09-09 21:08:44 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2014-09-09 21:18:48 -0400
commit68611e6f323ebc92c5bbf5c3a541eb88cdd29520 (patch)
tree8980179462c688a9162e728d3f3b77c83c9413f1 /numeric.c
parent63113b9b575257da93eff0197eeb8fa62095a8f2 (diff)
downloadperl-68611e6f323ebc92c5bbf5c3a541eb88cdd29520.tar.gz
Comment tweaks.
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/numeric.c b/numeric.c
index 511aceb7ee..427900bb30 100644
--- a/numeric.c
+++ b/numeric.c
@@ -1108,9 +1108,11 @@ S_my_atof_infnan(const char* s, bool negative, const char* send, NV* value)
}
#endif
#ifdef Perl_strtod
- /* If still here, we didn't have either NV_INF or INV_NAN,
+ /* If still here, we didn't have either NV_INF or NV_NAN,
* and can try falling back to native strtod/strtold.
*
+ * (Though, are our NV_INF or NV_NAN ever not defined?)
+ *
* The native interface might not recognize all the possible
* inf/nan strings Perl recognizes. What we can try
* is to try faking the input. We will try inf/-inf/nan
@@ -1340,6 +1342,8 @@ Perl_isinfnan() is utility function that returns true if the NV
argument is either an infinity or a NaN, false otherwise. To test
in more detail, use Perl_isinf() and Perl_isnan().
+This is also the logical inverse of Perl_isfinite().
+
=cut
*/
bool
@@ -1357,29 +1361,32 @@ Perl_isinfnan(NV nv)
}
#ifndef HAS_MODFL
-/* C99 has truncl, pre-C99 Solaris had aintl */
+/* C99 has truncl, pre-C99 Solaris had aintl. We can use either with
+ * copysignl to emulate modfl, which is in some platforms missing or
+ * broken. */
# if defined(HAS_TRUNCL) && defined(HAS_COPYSIGNL)
long double
Perl_my_modfl(long double x, long double *ip)
{
- *ip = truncl(x);
- return (x == *ip ? copysignl(0.0L, x) : x - *ip);
+ *ip = truncl(x);
+ return (x == *ip ? copysignl(0.0L, x) : x - *ip);
}
# elif defined(HAS_AINTL) && defined(HAS_COPYSIGNL)
long double
Perl_my_modfl(long double x, long double *ip)
{
- *ip = aintl(x);
- return (x == *ip ? copysignl(0.0L, x) : x - *ip);
+ *ip = aintl(x);
+ return (x == *ip ? copysignl(0.0L, x) : x - *ip);
}
# endif
#endif
+/* Similarly, with ilobl and scalbnl we can emulate frexpl. */
#if ! defined(HAS_FREXPL) && defined(HAS_ILOGBL) && defined(HAS_SCALBNL)
long double
Perl_my_frexpl(long double x, int *e) {
- *e = x == 0.0L ? 0 : ilogbl(x) + 1;
- return (scalbnl(x, -*e));
+ *e = x == 0.0L ? 0 : ilogbl(x) + 1;
+ return (scalbnl(x, -*e));
}
#endif