Hi,
Here's the demo (Inline::C) script:
###
use warnings;
use Config;
use Math::MPFR qw(:mpfr);
use Inline C = Config =
CCFLAGS = -D__USE_MINGW_ANSI_STDIO=1 . $Config{ccflags},
BUILD_NOISY = 1;
use Inline C = 'EOC';
#include stdio.h
#include stdlib.h
#include math.h
void check(char * in, SV * digits) {
dXSARGS;
long double ld;
char *ptr, *buffer;;
ld = strtold(in, ptr);
buffer = malloc(32 * sizeof(char));
sprintf(buffer, %.*Le, SvUV(digits) - 1, ld);
ST(0) = sv_2mortal(newSVpv(buffer, 0));
free(buffer);
XSRETURN(1);
}
EOC
print check('1e-37', 18), \n;
###
For both the x86 and x64 builds of Strawberry Perl-5.16.0 that script
correctly outputs:
1.0e-037
But for the x86-64int build of Strawberry Perl-5.16.0 I'm getting:
-0.0e+000
Does anyone see a reason for this anomalous behaviour with the x86-64int
build ?
I get precisely the same output with an x86-64int perl-5.16.0 that I built
using mingw.org's gcc-4.5.2.
Here's the 'perl -V' of the problem Strawberry Perl:
Summary of my perl5 (revision 5 version 16 subversion 0) configuration:
Platform:
osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread-64int
uname='Win32 spp-spec-64int 5.16.0.1 #1 Tue May 22 21:03:41 2012 i386'
config_args='undef'
hint=recommended, useposix=true, d_sigaction=undef
useithreads=define, usemultiplicity=define
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=define, use64bitall=undef, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='gcc', ccflags
=' -s -O2 -DWIN32 -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT
_CONTEXT -DPERL_IMPLICIT_SYS -fno-strict-aliasing -mms-bitfields',
optimize='-s -O2',
cppflags='-DWIN32'
ccversion='', gccversion='4.6.3', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678
d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='long
long',
lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='g++.exe', ldflags
='-s -LC:\_32\strawberry516_64int\perl\lib\CORE -LC
:\_32\strawberry516_64int\c\lib'
libpth=C:\_32\strawberry516_64int\c\lib
C:\_32\strawberry516_64int\c\i686-w6
4-mingw32\lib
libs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32
-lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion
-lodbc32 -lodbccp32 -lcomctl32
perllibs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladva
pi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lver
sion -lodbc32 -lodbccp32 -lcomctl32
libc=, so=dll, useshrplib=true, libperl=libperl516.a
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
cccdlflags=' ',
lddlflags='-mdll -s -LC:\_32\strawberry516_64int\perl\lib\C
ORE -LC:\_32\strawberry516_64int\c\lib'
Characteristics of this binary (from libperl):
Compile-time options: HAS_TIMES HAVE_INTERP_INTERN MULTIPLICITY
PERLIO_LAYERS PERL_DONT_CREATE_GVSV
PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS
PERL_MALLOC_WRAP PERL_PRESERVE_IVUV PL_OP_SLAB_ALLOC
USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES
USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE
USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF
Built under MSWin32
Compiled at May 22 2012 21:11:55
%ENV:
PERL_JSON_BACKEND=JSON::XS
PERL_YAML_BACKEND=YAML
@INC:
C:/_32/strawberry516_64int/perl/site/lib
C:/_32/strawberry516_64int/perl/vendor/lib
C:/_32/strawberry516_64int/perl/lib
.
Cheers,
Rob