diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2000-08-31 04:26:23 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2000-08-31 04:26:23 +0000 |
commit | ebd4816b80e45b053b1e4c5e7ff68fe4dcfcd7c8 (patch) | |
tree | 47ee05eab89c0f14582cc0220068a55586f1cba2 /perl.h | |
parent | 971f4bf107c4114680b92221b21d1da9ec393811 (diff) | |
download | perl-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.h | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -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 |