Skip to content

Commit

Permalink
Fix longdouble test fail
Browse files Browse the repository at this point in the history
Fixes #4, thanks @andk for the report.
  • Loading branch information
zmughal committed Dec 26, 2022
1 parent d2afa4c commit 09407e4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
- Bump minimum Perl to v5.14.0.
- require PDL >= 2.058
- fix longdouble test fail (#4) - thanks @andk for the report

2022-02-13 0.04
- update examples
Expand Down
9 changes: 6 additions & 3 deletions t/10_physical_piddles.t
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,11 @@ threads->create(sub {

# Have this thread touch one of the values, and have it double-check
# that the value is correctly set
$workspace($tid) .= sqrt($tid + 1) + sqrt(5);
my $to_test = pdl($workspace->type, sqrt($tid + 1) + sqrt(5));
my $tid_plus_1 = double($tid + 1);
my $five = double(5);
$workspace($tid) .= pdl($workspace->type, $tid_plus_1->sqrt + $five->sqrt);
my $to_test = zeros($workspace->type, 1);
$to_test(0) .= pdl($workspace->type, $tid_plus_1->sqrt + $five->sqrt);
$success_hash{$type_letter}
= ($workspace->at($tid,0) == $to_test->at(0));
}
Expand Down Expand Up @@ -110,7 +113,7 @@ for my $type_letter (keys %workspaces) {
my $expected = zeroes($type, $N_threads, 2);
# Perform the arithmetic using double precision (on the right side of
# this asignment) before down-casting to the workspace's type
$expected .= (zeroes($N_threads, 2)->xvals + 1)->sqrt + sqrt(5);
$expected .= (zeroes($N_threads, 2)->xvals + 1)->sqrt + pdl(5)->sqrt;
# Perform an exact comparison. The operations may have high bit coverage,
# but they should also be free from bit noise, I hope.
ok(all($workspace == $expected), "Sharing $type piddles works")
Expand Down

0 comments on commit 09407e4

Please sign in to comment.