syphilis has asked for the wisdom of the Perl Monks concerning the following question:
The desired output (which I see on Linux and mingw-built windows perls) is:use strict; use Config; use Devel::Peek; die "This configuration of perl not relevant to the issue" unless $Config{nvsize} == $Config{ivsize}; use Inline C => Config => PRE_HEAD => "#ifndef __USE_MINGW_ANSI_STDIO\n#define __USE_MINGW_ANS +I_STDIO 1\n#endif\n", ; use Inline C => <<'EOC'; void foo(SV * in) { printf("%.20" NVgf, SvNV(in)); printf("\n"); } EOC # Create an NV whose value is # 18446744073709549568 my $nv = ((1 << 53) - 1) / 2 * 4096; # Dump $nv; # Shows that it's an NV. foo($nv); foo(18446744073709549568);
My only perl built using a Microsoft compiler (5.16.0 using cl 14.00.40310.41) doesn't play ball, and outputs:18446744073709549568 18446744073709549568
How do I get the output I want with this cl-built perl ?18446744073709550000 18446744073709550000
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: [XS] C printf() and Microsoft compilers.
by jcb (Parson) on Dec 19, 2019 at 00:34 UTC | |
|
Re: [XS] C printf() and Microsoft compilers.
by NERDVANA (Priest) on Dec 20, 2019 at 06:01 UTC | |
by syphilis (Archbishop) on Dec 20, 2019 at 12:29 UTC | |
by NERDVANA (Priest) on Jan 08, 2020 at 15:00 UTC |