Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^7: supporting quads on 32 bit Perl

by salva (Monsignor)
on Jun 01, 2012 at 14:44 UTC ( #973788=note: print w/ replies, xml ) Need Help??


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

I have just uploaded version 0.19, let's see how it goes at the ActiveState build servers.


Comment on Re^7: supporting quads on 32 bit Perl
Re^8: supporting quads on 32 bit Perl
by bulk88 (Priest) on Jun 01, 2012 at 17:17 UTC
    Ill be watching. Thanks for trying to get it work on ActiveState's packager.
Re^8: supporting quads on 32 bit Perl
by bulk88 (Priest) on Jun 02, 2012 at 15:55 UTC
    0.19 failed on Activestates build system http://ppm4.activestate.com/MSWin32-x86/5.12/1200/S/SA/SALVA/Math-Int64-0.19.d/log-20120601T213822.txt. INT64_MAX is only in a Platform SDK header called intsafe.h. That was introduced somewhere between Studio 2005 and Studio 2008. My Studio 2003 doesn't have it, ActiveState doesn't have it.I added
    static char *right_b_error = "right-shift right operand is out +of bounds"; static char *right_error = "right shift overflows"; #ifndef INT64_MAX #define INT64_MAX _I64_MAX #endif #ifndef INT64_MIN #define INT64_MIN _I64_MIN #endif #ifndef UINT64_MAX #define UINT64_MAX _UI64_MAX #endif #ifndef UINT32_MAX #define UINT32_MAX _UI32_MAX #endif #include "strtoint64.h" #include "isaac64.h"
    and that fixed the limit constants problem. There are still more problems. After fixing the limit constants problem I got this
    Int64.c Int64.xs(254) : error C2059: syntax error : 'bad suffix on number' Int64.xs(254) : error C2146: syntax error : missing ')' before identif +ier 'p63' Int64.xs(254) : error C2144: syntax error : '<Unknown>' should be prec +eded by '< Unknown>' Int64.xs(254) : error C2144: syntax error : '<Unknown>' should be prec +eded by '< Unknown>' Int64.xs(254) : error C2143: syntax error : missing ')' before 'identi +fier' Int64.xs(254) : error C2059: syntax error : 'bad suffix on number' Int64.xs(255) : warning C4244: 'return' : conversion from 'NV' to 'int +64_t', pos sible loss of data Int64.xs(334) : error C2059: syntax error : 'bad suffix on number' Int64.xs(334) : error C2146: syntax error : missing ')' before identif +ier 'p64' Int64.xs(334) : error C2144: syntax error : '<Unknown>' should be prec +eded by '< Unknown>' Int64.xs(334) : error C2144: syntax error : '<Unknown>' should be prec +eded by '< Unknown>' Int64.xs(334) : error C2143: syntax error : missing ')' before 'identi +fier'
    VC is complaining about these strange constants.
    if (may_die_on_overflow && ((nv >= 0x1p63) || (nv < -0x1p63))) overflow(aTHX_ out +_of_bounds_error_s); return nv;
    This isn't C89. http://msdn.microsoft.com/en-us/library/w9bk1wcy%28v=vs.80%29.aspx http://msdn.microsoft.com/en-us/library/2k2xf226%28v=vs.80%29. So this will never compile on Visual C unless its fixed. I don't know how to fix that myself. So what is 0x1p63 as a normal C literal?

      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.

        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.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (11)
As of 2014-10-01 17:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What is your favourite meta-syntactic variable name?














    Results (30 votes), past polls