Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^4: Windows / Linux puzzler

by ikegami (Patriarch)
on Mar 25, 2020 at 18:45 UTC ( [id://11114645]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Windows / Linux puzzler
in thread Windows / Linux puzzler

I think Veltro's point is likely irrelevant if both the Windows perl and Linux perl report the same value for $Config{nvsize}.

In at least some verisons of Perl, creating a float from a string is done by the underlying C library, and MS's library is known to not be as good as a gcc's.

Image showing the output varies by compiler

I didn't include nvsize in the screenshot, but both builds use IEEE double-precision floats.

Replies are listed 'Best First'.
Re^5: Windows / Linux puzzler
by syphilis (Archbishop) on Mar 26, 2020 at 02:25 UTC
    MS's library is known to not be as good as a gcc's


    All that the linked example demonstrates is that there's a discrepancy in the %.20g formatting - it says nothing about the ability to assign values correctly.
    If you compare the actual values by doing "%a" formatting on both the Linux and windows perls, you'll see that 0.1 is exactly the same double.
    Also, I believe the OP's activestate perl was built with (mingw port of) gcc. They stopped using Microsoft compilers a few years ago.

    ikegami's point is likely even more irrelevant than Veltro's.

    Cheers,
    Rob

      If you compare the actual values by doing "%a" formatting on both the Linux and windows perls, you'll see that 0.1 is exactly the same double.

      Your are correct. pack 'd' shows this more definitely.

      >perl -E"say sprintf '%vX', pack 'd>', $ARGV[0]" 0.1 3F.B9.99.99.99.99.99.9A
      $ perl -E'say sprintf "%vX", pack "d>", $ARGV[0]', 0.1 3F.B9.99.99.99.99.99.9A

      I believe the OP's activestate perl was built with (mingw port of) gcc

      It definitely allows mingw to be used to compile modules, but I don't know if that's what used to build Perl itself. (Update: perl -V hints that it uses mingw)

      I beleive Strawberry Perl uses mingw, and I used Strawberry Perl in the test in the earlier post. If so, there are pertinent differences in the libraries between mingw and gcc.

        there are pertinent differences in the libraries between mingw and gcc

        I think that with mingw, the MS runtime is still used by default for formatting of values.
        However, that is avoided (by building with -D__USE_MINGW_ANSI_STDIO) in recent versions of Strawberry Perl, beginning perl-5.26.0.
        (Look for "-D__USE_MINGW_ANSI_STDIO" in perl -V:ccflags)

        Of course, ActiveState don't build with -D__USE_MINGW_ANSI_STDIO.

        Cheers,
        Rob

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11114645]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2024-04-20 07:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found