I just tried 0.23 from CPAN. Math::Int64 doesn't croak when called by Test::More after a test failed anymore. Compiled without errors. I used it in my module and write a small test suite that uses Math::Int64 without any problems. I did fail a test from Math::Int64 though.
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/MSC.t ................. 1/3
# Failed test 'uint64 to NV conversion 3'
# at t/MSC.t line 15.
# Looks like you failed 1 test of 3.
t/MSC.t ................. Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/3 subtests
t/pods.t ................ skipped: Only the author needs to check that
+ POD docs
are right
Test Summary Report
-------------------
t/MSC.t (Wstat: 256 Tests: 3 Failed: 1)
Failed test: 3
Non-zero exit status: 1
Files=8, Tests=256, 1 wallclock secs ( 0.24 usr + 0.02 sys = 0.25 C
+PU)
Result: FAIL
Failed 1/8 test programs. 1/256 subtests failed.
NMAKE : fatal error U1077: 'C:\perl512\bin\perl.exe' : return code '0x
+ff'
Stop.
C:\Documents and Settings\Owner\Desktop\cpan libs\Math-Int64-0.23>
C:\Documents and Settings\Owner\Desktop\cpan libs\Math-Int64-0.23>perl
+ ./t/MSC.t
1..3
ok 1 - uint64 to NV conversion
ok 2 - uint64 to NV conversion 2
not ok 3 - uint64 to NV conversion 3
# Failed test 'uint64 to NV conversion 3'
# at ./t/MSC.t line 15.
# Looks like you failed 1 test of 3.
C:\Documents and Settings\Owner\Desktop\cpan libs\Math-Int64-0.23>
I'll try to update this node soon on what I think about the failed test XS wise if your not faster than me in fixing it.
edit:
given this XS Func
void
TwoSVs( one, two )
SV * one
SV * two
PPCODE:
0;
called as
my $u = string_to_uint64('0xff00_0000_0000_0000');
Dump($u);
my $nv = uint64_to_number($u);
Dump($nv);
Local::XS::TwoSVs($u, $nv);
which showed
SV = IV(0xb04240) at 0xb04244
REFCNT = 1
FLAGS = (PADMY,ROK)
RV = 0x397e8c
SV = PVMG(0x8eaf6c) at 0x397e8c
REFCNT = 1
FLAGS = (OBJECT,NOK,OVERLOAD,pNOK)
IV = 0
NV = -5.48612406879369e+303
PV = 0
STASH = 0x8616cc "Math::UInt64"
SV = NV(0x86ab0c) at 0x82bd0c
REFCNT = 1
FLAGS = (PADMY,NOK,pNOK)
NV = 1.83746864796716e+019
$u's &($u->sv_u.svu_rv->sv_any->xnv_u) in raw memory is
0x008EAF6C 00 00 00 00 00 00 00 ff
$nv's &($nv->sv_any->xnv_u) in raw memory is
0x0086AB0C 00 00 00 00 00 e0 ef 43
ok lets try this
my $u = string_to_uint64('0xff00_0000_0000_0000');
my $nv = uint64_to_number($u);
print "nv $nv u $u \n\n";
result is
nv 1.83746864796716e+019 u 18374686479671623680
IDK how many floating point digits are supposed to be shown. VS debugger says the NV slot in the SVNV is "1.8374686479671624e+019".
(__int64 *)&(two->sv_any->xnv_u)
== 0x43efe00000000000
== 100001111101111111000000000000000000000000000000000000000000000
chop off sign bit
00001111101111111000000000000000000000000000000000000000000000
chop off exponent (11 bits)
111111000000000000000000000000000000000000000000000
== 0x7E00000000000
0x7E00000000000 2 216 615 441 596 416 unsigned __int64
IDK. I'm not a math person.
(two->sv_any->xnv_u.xnv_nv) > (2^53) true bool
my $u = string_to_uint64('0xff00_0000_0000_0000');
my $nv = uint64_to_number($u);
0xff00_0000_0000_0000 is more than 2^53, it can't be held in a NV cleanly.
0xff00000000000000 > (2^53) true bool
I don't have an infinite precision calc on hand, but 0xFF would be 64-8=56. Doubles store integers upto 2^53. There even is a Perl C const just for this, win32/config_H.vc#l4320 in perl.git.
|