This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #120543] work around a C++ library bug in VC 2003
authorTony Cook <tony@develop-help.com>
Mon, 18 Nov 2013 22:50:25 +0000 (09:50 +1100)
committerTony Cook <tony@develop-help.com>
Mon, 18 Nov 2013 22:50:25 +0000 (09:50 +1100)
VC 2003 makes overloaded versions of ldexp() available when including
<math.h> which should only be visible when including <cmath>.

The cast ensures the ldexp(double, int) signature is used.

util.c

diff --git a/util.c b/util.c
index c68bb90..68893c4 100644 (file)
--- a/util.c
+++ b/util.c
@@ -6252,7 +6252,7 @@ Perl_drand48_r(perl_drand48_t *random_state)
     *random_state = (*random_state * DRAND48_MULT + DRAND48_ADD)
         & DRAND48_MASK;
 
-    return ldexp(*random_state, -48);
+    return ldexp((double)*random_state, -48);
 #else
     {
     U32 accu;