in reply to Re^8: supporting quads on 32 bit Perl
in thread supporting quads on 32 bit Perl

I haven't seen that constant either. Google finds me a message for gcc which seems to claim that it's a C99 thing for declaring floating point constants in hexadecimal. I found some discussion by example, which suggests to me that 0x1p63 could be 1E63.

I'm not sure why things get different between 32bit mode and 64bit mode here, but maybe your code never compiled under VC64bit either.

Replies are listed 'Best First'.
Re^10: supporting quads on 32 bit Perl
by salva (Canon) on Jun 02, 2012 at 19:22 UTC
    0x1p63 == 0x1 * 2**63

    I am not sure that this constant can be expressed in a portable way in base 10 as the atof function used internally by the compiler may return a lesser value due to internal rounding errors.

    There are other ways to generate this numbers precisely. For instance, 0x1p64 can be generated as 0x1p32 * 0x1p32 (any atof can parse 0x1p32 expressed in decimal precisely).

    Anyway, I have just added some conditional code for MS compilers that uses a different approach for limit checking not involving those constants. The new code is available from the GitHub repository.

    I have not tested the code myself as I don't have any system with that compiler, so will apreciate testing reports.

      Things are better, your github int64.xs compiled and nmake test passed.
      C:\Documents and Settings\Owner\Desktop\cpan libs\Math-Int64-0.19>nmak +e test Microsoft (R) Program Maintenance Utility Version 7.10.3077 Copyright (C) Microsoft Corporation. All rights reserved. C:\perl512\bin\perl.exe "-MExtUtils::Command::MM" "-e" "test_h +arness(0, 'blib\lib', 'blib\arch')" t/*.t t/as_int64.t ............ ok t/die_on_overflow.t ..... ok t/Math-Int64-Native.t ... ok t/Math-Int64.t .......... ok t/Math-UInt64-Native.t .. ok t/Math-UInt64.t ......... ok t/pods.t ................ skipped: Only the author needs to check that + POD docs are right All tests successful. Files=7, Tests=241, 1 wallclock secs ( 0.12 usr + 0.05 sys = 0.17 C +PU) Result: PASS C:\Documents and Settings\Owner\Desktop\cpan libs\Math-Int64-0.19>
      But the build was very noisy.
      cp lib/Math/Int64.pm blib\lib\Math\Int64.pm cp lib/Math/Int64/die_on_overflow.pm blib\lib\Math\Int64\die_on_overfl +ow.pm cp lib/Math/Int64/native_if_available.pm blib\lib\Math\Int64\native_if +_available.pm C:\perl512\bin\perl.exe C:\perl512\lib\ExtUtils\xsubpp -typemap C +:\perl512\lib\ExtUtils\typemap Int64.xs > Int64.xsc && C:\perl512\bi +n\perl.exe -MExtUtils::Command -e "mv" -- Int64.xsc Int64.c cl -c -I. -nologo -GF -W3 -Od -MD -Zi -DDEBUGGING -DWIN32 -D_CON +SOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DPERL_IMPLICIT_CONTEXT -DPERL_IMP +LICIT_SYS -DUSE_PERLIO -Od -MD -Zi -DDEBUGGING -DVERSION=\"0.19\" + -DXS_VERSION=\"0.19\" "-IC:\perl512\lib\CORE" -DINT64_BACKEND_NV I +nt64.c Int64.c Int64.xs(253) : warning C4244: 'initializing' : conversion from 'NV' t +o 'int64_t', possible loss of data Int64.xs(259) : warning C4244: 'return' : conversion from 'NV' to 'int +64_t', possible loss of data Int64.xs(339) : warning C4244: 'initializing' : conversion from 'NV' t +o 'uint64_t', possible loss of data Int64.xs(345) : warning C4244: 'return' : conversion from 'NV' to 'uin +t64_t', possible loss of data Int64.xs(355) : warning C4244: 'initializing' : conversion from 'int64 +_t' to 'IV', possible loss of data Int64.xs(360) : warning C4244: 'initializing' : conversion from 'int64 +_t' to 'UV', possible loss of data Int64.xs(364) : warning C4244: 'function' : conversion from 'int64_t' +to 'const NV', possible loss of data Int64.xs(370) : warning C4244: 'initializing' : conversion from 'uint6 +4_t' to 'UV', possible loss of data Int64.xs(373) : warning C4244: 'function' : conversion from 'uint64_t' + to 'const NV', possible loss of data Int64.xs(385) : warning C4244: 'initializing' : conversion from 'uint6 +4_t' to 'char', possible loss of data Int64.xs(502) : warning C4244: 'function' : conversion from 'int64_t' +to 'const IV', possible loss of data Int64.xs(526) : warning C4244: 'function' : conversion from 'uint64_t' + to 'const UV', possible loss of data Int64.xs(545) : warning C4244: '=' : conversion from 'int64_t' to 'cha +r', possible loss of data Int64.xs(563) : warning C4244: '=' : conversion from 'uint64_t' to 'ch +ar', possible loss of data Int64.xs(679) : warning C4244: 'function' : conversion from 'uint64_t' + to 'const IV', possible loss of data Int64.xs(690) : warning C4244: 'function' : conversion from 'uint64_t' + to 'const UV', possible loss of data Int64.xs(700) : warning C4244: 'function' : conversion from 'uint64_t' + to 'const IV', possible loss of data Int64.xs(710) : warning C4244: 'function' : conversion from 'uint64_t' + to 'const UV', possible loss of data Int64.xs(722) : warning C4244: 'function' : conversion from 'int64_t' +to 'const IV', possible loss of data Int64.xs(733) : warning C4244: 'function' : conversion from 'uint64_t' + to 'const IV', possible loss of data Int64.xs(756) : warning C4554: '<<' : check operator precedence for po +ssible error; use parentheses to clarify precedence Int64.c(1262) : warning C4101: 'rev' : unreferenced local variable Int64.c(1261) : warning C4101: 'other' : unreferenced local variable Int64.c(1290) : warning C4101: 'rev' : unreferenced local variable Int64.c(1289) : warning C4101: 'other' : unreferenced local variable Int64.c(1679) : warning C4101: 'rev' : unreferenced local variable Int64.c(1706) : warning C4101: 'rev' : unreferenced local variable Int64.c(1938) : warning C4101: 'rev' : unreferenced local variable Int64.c(1937) : warning C4101: 'other' : unreferenced local variable Int64.c(1963) : warning C4101: 'rev' : unreferenced local variable Int64.c(1962) : warning C4101: 'other' : unreferenced local variable Int64.c(1988) : warning C4101: 'rev' : unreferenced local variable Int64.c(1987) : warning C4101: 'other' : unreferenced local variable Int64.c(2013) : warning C4101: 'rev' : unreferenced local variable Int64.c(2012) : warning C4101: 'other' : unreferenced local variable Int64.c(2038) : warning C4101: 'rev' : unreferenced local variable Int64.c(2037) : warning C4101: 'other' : unreferenced local variable Int64.c(2063) : warning C4101: 'rev' : unreferenced local variable Int64.c(2062) : warning C4101: 'other' : unreferenced local variable Int64.c(2088) : warning C4101: 'rev' : unreferenced local variable Int64.c(2087) : warning C4101: 'other' : unreferenced local variable Int64.c(2113) : warning C4101: 'rev' : unreferenced local variable Int64.c(2112) : warning C4101: 'other' : unreferenced local variable Int64.c(2140) : warning C4101: 'rev' : unreferenced local variable Int64.c(2139) : warning C4101: 'other' : unreferenced local variable Int64.c(2505) : warning C4101: 'rev' : unreferenced local variable Int64.c(2532) : warning C4101: 'rev' : unreferenced local variable Int64.c(2764) : warning C4101: 'rev' : unreferenced local variable Int64.c(2763) : warning C4101: 'other' : unreferenced local variable Int64.c(2789) : warning C4101: 'rev' : unreferenced local variable Int64.c(2788) : warning C4101: 'other' : unreferenced local variable Int64.xs(1607) : warning C4146: unary minus operator applied to unsign +ed type, result still unsigned Int64.c(2814) : warning C4101: 'rev' : unreferenced local variable Int64.c(2813) : warning C4101: 'other' : unreferenced local variable Int64.c(2839) : warning C4101: 'rev' : unreferenced local variable Int64.c(2838) : warning C4101: 'other' : unreferenced local variable Int64.c(2864) : warning C4101: 'rev' : unreferenced local variable Int64.c(2863) : warning C4101: 'other' : unreferenced local variable Int64.c(2889) : warning C4101: 'rev' : unreferenced local variable Int64.c(2888) : warning C4101: 'other' : unreferenced local variable Int64.c(2914) : warning C4101: 'rev' : unreferenced local variable Int64.c(2913) : warning C4101: 'other' : unreferenced local variable c:\documents and settings\owner\desktop\cpan libs\math-int64-0.19\int6 +4.xs(602) : warning C4700: local variable 'RETVAL' used without havin +g been initialized c:\documents and settings\owner\desktop\cpan libs\math-int64-0.19\int6 +4.xs(167) : warning C4715: 'SvSI64' : not all control paths return a +value c:\documents and settings\owner\desktop\cpan libs\math-int64-0.19\int6 +4.xs(177) : warning C4715: 'SvSU64' : not all control paths return a +value Running Mkbootstrap for Math::Int64 () C:\perl512\bin\perl.exe -MExtUtils::Command -e "chmod" -- 644 Int6 +4.bs C:\perl512\bin\perl.exe -MExtUtils::Mksymlists -e "Mksymlists('NA +ME'=>\"Math::Int64\", 'DLBASE' => 'Int64', 'DL_FUNCS' => { }, 'FUNCL +IST' => [], 'IMPORTS' => { }, 'DL_VARS' => []);" link -out:blib\arch\auto\Math\Int64\Int64.dll -dll -nologo -nodefa +ultlib -debug -libpath:"c:\perl512\lib\CORE" -machine:x86 Int64.obj + C:\perl512\lib\CORE\perl512.lib oldnames.lib kernel32.lib user32.l +ib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole3 +2.lib oleaut32.lib netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.li +b version.lib odbc32.lib odbccp32.lib comctl32.lib msvcrt.lib -def:I +nt64.def Creating library blib\arch\auto\Math\Int64\Int64.lib and object bli +b\arch\auto\Math\Int64\Int64.exp if exist blib\arch\auto\Math\Int64\Int64.dll.manifest mt -nologo - +manifest blib\arch\auto\Math\Int64\Int64.dll.manifest -outputresource +:blib\arch\auto\Math\Int64\Int64.dll;2 if exist blib\arch\auto\Math\Int64\Int64.dll.manifest del blib\arc +h\auto\Math\Int64\Int64.dll.manifest C:\perl512\bin\perl.exe -MExtUtils::Command -e "chmod" -- 755 blib +\arch\auto\Math\Int64\Int64.dll C:\perl512\bin\perl.exe -MExtUtils::Command -e "cp" -- Int64.bs bl +ib\arch\auto\Math\Int64\Int64.bs C:\perl512\bin\perl.exe -MExtUtils::Command -e "chmod" -- 644 blib +\arch\auto\Math\Int64\Int64.bs Files found in blib\arch: installing files in blib\lib into architectu +re dependent library tree Installing C:\perl512\site\lib\auto\Math\Int64\Int64.dll Installing C:\perl512\site\lib\auto\Math\Int64\Int64.exp Installing C:\perl512\site\lib\auto\Math\Int64\Int64.ilk Installing C:\perl512\site\lib\auto\Math\Int64\Int64.lib Installing C:\perl512\site\lib\auto\Math\Int64\Int64.pdb Appending installation info to c:\perl512\lib/perllocal.pod
      I don't know if any of these warnings are errors or just forgotten casts yet.

      edit: made a summary of the code thats causing all the warnings, 1 or 2 of them look like real bugs, my comments if any are all caps, >>>>>>> means the line the warning above is pointing to
        The warning Int64.xs(756) : warning C4554: '<<' : check operator precedence for possible error; use parentheses to clarify precedence, indicated a bug on the srand function (already solved on the git version).

        The others warnings are harmless.