diff options
author | Allen Smith <allens@cpan.org> | 2002-09-08 21:48:08 -0400 |
---|---|---|
committer | hv <hv@crypt.org> | 2002-09-09 09:54:55 +0000 |
commit | 1d7c5e43eb84121be0983b7ab161672e01f72ea1 (patch) | |
tree | 65401b88e9ea1b19115443d4e08fc8c7df4f4b66 /perl.h | |
parent | 03e83384851ba8ca0217c96515c04d23d50f5b96 (diff) | |
download | perl-1d7c5e43eb84121be0983b7ab161672e01f72ea1.tar.gz |
Re: [PATCH: perl #17849] (corrected) Long double bugs - sprintf.t _and_ num.t
From: "Allen Smith" <easmith@beatrice.rutgers.edu>
Message-Id: <10209090148.ZM1555835@puck2.rutgers.edu>
p4raw-id: //depot/perl@17881
Diffstat (limited to 'perl.h')
-rw-r--r-- | perl.h | 50 |
1 files changed, 30 insertions, 20 deletions
@@ -1130,8 +1130,10 @@ typedef UVTYPE UV; # define DBL_DIG OVR_DBL_DIG #else /* The following is all to get DBL_DIG, in order to pick a nice - default value for printing floating point numbers in Gconvert. - (see config.h) + default value for printing floating point numbers in Gconvert + (see config.h). (It also has other uses, such as figuring out if + a given precision of printing can be done with a double instead of + a long double - Allen). */ #ifdef I_LIMITS #include <limits.h> @@ -1193,20 +1195,22 @@ typedef UVTYPE UV; * necessary to do so. - Allen <allens@cpan.org> */ -#if defined(I_VALUES) -# if !defined(USE_LONG_DOUBLE) || defined(HAS_LDBL_SPRINTF_BUG) -# if (!defined(DBL_MIN) || !defined(DBL_MAX)) -# include <values.h> -# if defined(MAXDOUBLE) && !defined(DBL_MAX) -# define DBL_MAX MAXDOUBLE -# endif -# if defined(MINDOUBLE) && !defined(DBL_MIN) -# define DBL_MIN MINDOUBLE -# endif -# endif -# endif +#ifdef I_LIMITS +# include <limits.h> #endif +#ifdef I_VALUES +# if !(defined(DBL_MIN) && defined(DBL_MAX) && defined(I_LIMITS)) +# include <values.h> +# if defined(MAXDOUBLE) && !defined(DBL_MAX) +# define DBL_MAX MAXDOUBLE +# endif +# if defined(MINDOUBLE) && !defined(DBL_MIN) +# define DBL_MIN MINDOUBLE +# endif +# endif +#endif /* defined(I_VALUES) */ + typedef NVTYPE NV; #ifdef I_IEEEFP @@ -1305,7 +1309,7 @@ long double modfl(long double, long double *); # ifdef DBL_EPSILON # define NV_EPSILON DBL_EPSILON # endif -# ifdef DBL_MAX +# ifdef DBL_MAX /* XXX Does DBL_MAX imply having DBL_MIN? */ # define NV_MAX DBL_MAX # define NV_MIN DBL_MIN # else @@ -1328,6 +1332,13 @@ long double modfl(long double, long double *); /* rumor has it that Win32 has _fpclass() */ +/* SGI has fpclassl... but not with the same result values, + * and it's via a typedef (not via #define), so will need to redo Configure + * to use. Not worth the trouble, IMO, at least until the below is used + * more places. Also has fp_class_l, BTW, via fp_class.h. Feel free to check + * with me for the SGI manpages, SGI testing, etcetera, if you want to + * try getting this to work with IRIX. - Allen <allens@cpan.org> */ + #if !defined(Perl_fp_class) && (defined(HAS_FPCLASS)||defined(HAS_FPCLASSL)) # ifdef I_IEEFP # include <ieeefp.h> @@ -1469,7 +1480,8 @@ int isnan(double d); * it is however best to use the native implementation of atof. * You can experiment with using your native one by -DUSE_PERL_ATOF=0. * Some good tests to try out with either setting are t/base/num.t, - * t/op/numconvert.t, and t/op/pack.t. */ + * t/op/numconvert.t, and t/op/pack.t. Note that if using long doubles + * you may need to be using a different function than atof! */ #ifndef USE_PERL_ATOF # ifndef _UNICOS @@ -1502,11 +1514,9 @@ int isnan(double d); #ifdef I_LIMITS /* Needed for cast_xxx() functions below. */ # include <limits.h> -#else -#ifdef I_VALUES -# include <values.h> -#endif #endif +/* Included values.h above if necessary; still including limits.h down here, + * despite doing above, because math.h might have overriden... XXX - Allen */ /* * Try to figure out max and min values for the integral types. THE CORRECT |