Skip to content

Commit

Permalink
test pdl-ising of large negative IV that broke on 32 bit - #469
Browse files Browse the repository at this point in the history
  • Loading branch information
mohawk2 committed Apr 4, 2024
1 parent 377d2a7 commit f4bd36c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Basic/Core/pdlperl.h.PL
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ static inline int _pdl_whichdatatype_int(IV iv) {
/* Check minimum, at least double, datatype required to represent number */
static inline int _pdl_whichdatatype_double(NV nv) {
PDL_TESTTYPE(PDL_D,PDL_Double, nv)
PDL_TESTTYPE(PDL_D,PDL_LDouble, nv)
PDL_TESTTYPE(PDL_LD,PDL_LDouble, nv)
#undef PDL_TESTTYPE
return PDL_D; /* handles NaN */
}
Expand Down
1 change: 1 addition & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
- Slatec ezfft* routines take IFAC to avoid treating part of float array as integer (#468)
- add has_badvalue method for whether ndarray has per-pdl badvalue (#469)
- fix Slatec breaking PDL::Stats (https://github.com/PDLPorters/PDL-Stats/issues/31) - thanks @sebastic for report
- fix long-standing mistyping of large negative IVs on 32-bit (#469) - thanks @sebastic for report

2.086 2024-03-31
- fix 64-bit problem in Minuit revealed by LTO (#468) - thanks @eli-schwartz for report
Expand Down
8 changes: 8 additions & 0 deletions t/core.t
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,14 @@ my $pdl = pdl $array;
is_deeply( unpdl($pdl), $array, "back convert 3d");
SKIP: {
skip("your perl hasn't 64bit int support", 6) if $Config{ivsize} < 8;
{
my $neg = -684394069604;
my $straight_pdl = pdl($neg);
my $multed = pdl(1) * $neg;
ok $straight_pdl == $multed, 'upgrade of large negative SV to ndarray'
or diag "straight=$straight_pdl mult=$multed\n",
"straight:", $straight_pdl->info, " mult:", $multed->info;
}
my $input = [
-9223372036854775808, #min int64
-9000000000000000001,
Expand Down

0 comments on commit f4bd36c

Please sign in to comment.