This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
POSIX math: if long double, long double the math consts
authorJarkko Hietaniemi <jhi@iki.fi>
Thu, 5 Feb 2015 13:08:51 +0000 (08:08 -0500)
committerJarkko Hietaniemi <jhi@iki.fi>
Thu, 5 Feb 2015 13:16:28 +0000 (08:16 -0500)
ext/POSIX/POSIX.xs

index 1f7fdd9..b1118bd 100644 (file)
 
 #else
 
+#  ifdef USE_LONG_DOUBLE
+#    undef M_E
+#    undef M_LOG2E
+#    undef M_LOG10E
+#    undef M_LN2
+#    undef M_LN10
+#    undef M_PI
+#    undef M_PI_2
+#    undef M_PI_4
+#    undef M_1_PI
+#    undef M_2_PI
+#    undef M_2_SQRTPI
+#    undef M_SQRT2
+#    undef M_SQRT1_2
+#    define FLOAT_C(c) CAT2(c,L)
+#  else
+#    define FLOAT_C(c) (c)
+#  endif
+
 #  ifndef M_E
-#    define M_E                2.71828182845904523536028747135266250
+#    define M_E                FLOAT_C(2.71828182845904523536028747135266250)
 #  endif
 #  ifndef M_LOG2E
-#    define M_LOG2E    1.44269504088896340735992468100189214
+#    define M_LOG2E    FLOAT_C(1.44269504088896340735992468100189214)
 #  endif
 #  ifndef M_LOG10E
-#    define M_LOG10E   0.434294481903251827651128918916605082
+#    define M_LOG10E   FLOAT_C(0.434294481903251827651128918916605082)
 #  endif
 #  ifndef M_LN2
-#    define M_LN2      0.693147180559945309417232121458176568
+#    define M_LN2      FLOAT_C(0.693147180559945309417232121458176568)
 #  endif
 #  ifndef M_LN10
-#    define M_LN10     2.30258509299404568401799145468436421
+#    define M_LN10     FLOAT_C(2.30258509299404568401799145468436421)
 #  endif
 #  ifndef M_PI
-#    define M_PI       3.14159265358979323846264338327950288
+#    define M_PI       FLOAT_C(3.14159265358979323846264338327950288)
 #  endif
 #  ifndef M_PI_2
-#    define M_PI_2     1.57079632679489661923132169163975144
+#    define M_PI_2     FLOAT_C(1.57079632679489661923132169163975144)
 #  endif
 #  ifndef M_PI_4
-#    define M_PI_4     0.785398163397448309615660845819875721
+#    define M_PI_4     FLOAT_C(0.785398163397448309615660845819875721)
 #  endif
 #  ifndef M_1_PI
-#    define M_1_PI     0.318309886183790671537767526745028724
+#    define M_1_PI     FLOAT_C(0.318309886183790671537767526745028724)
 #  endif
 #  ifndef M_2_PI
-#    define M_2_PI     0.636619772367581343075535053490057448
+#    define M_2_PI     FLOAT_C(0.636619772367581343075535053490057448)
 #  endif
 #  ifndef M_2_SQRTPI
-#    define M_2_SQRTPI 1.12837916709551257389615890312154517
+#    define M_2_SQRTPI FLOAT_C(1.12837916709551257389615890312154517)
 #  endif
 #  ifndef M_SQRT2
-#    define M_SQRT2    1.41421356237309504880168872420969808
+#    define M_SQRT2    FLOAT_C(1.41421356237309504880168872420969808)
 #  endif
 #  ifndef M_SQRT1_2
-#    define M_SQRT1_2  0.707106781186547524400844362104849039
+#    define M_SQRT1_2  FLOAT_C(0.707106781186547524400844362104849039)
 #  endif
 
 #endif