summaryrefslogtreecommitdiff
path: root/perl.h
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2000-08-31 04:26:23 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2000-08-31 04:26:23 +0000
commitebd4816b80e45b053b1e4c5e7ff68fe4dcfcd7c8 (patch)
tree47ee05eab89c0f14582cc0220068a55586f1cba2 /perl.h
parent971f4bf107c4114680b92221b21d1da9ec393811 (diff)
downloadperl-ebd4816b80e45b053b1e4c5e7ff68fe4dcfcd7c8.tar.gz
sscanf() may be the only way to read long doubles from strings.
p4raw-id: //depot/perl@6937
Diffstat (limited to 'perl.h')
-rw-r--r--perl.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/perl.h b/perl.h
index 115e878216..6840650ffd 100644
--- a/perl.h
+++ b/perl.h
@@ -1220,15 +1220,22 @@ typedef NVTYPE NV;
#if !defined(Perl_atof) && defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
# if !defined(Perl_atof) && defined(HAS_STRTOLD)
-# define Perl_atof(s) strtold(s, (char**)NULL)
+# define Perl_atof(s) (NV)strtold(s, (char**)NULL)
# endif
# if !defined(Perl_atof) && defined(HAS_ATOLF)
-# define Perl_atof atolf
+# define Perl_atof (NV)atolf
+# endif
+# if !defined(Perl_atof) && defined(PERL_SCNfldbl)
+# define Perl_atof PERL_SCNfldbl
+# define Perl_atof2(s,f) sscanf((s), "%"PERL_SCNfldbl, &(f))
# endif
#endif
#if !defined(Perl_atof)
# define Perl_atof atof /* we assume atof being available anywhere */
#endif
+#if !defined(Perl_atof2)
+# define Perl_atof2(s,f) ((f) = (NV)Perl_atof(s))
+#endif
/* Previously these definitions used hardcoded figures.
* It is hoped these formula are more portable, although