Skip Menu |

This queue is for tickets about the JavaScript CPAN distribution.

Report information
The Basics
Id: 56830
Status: new
Priority: 0/
Queue: JavaScript

Owner: Nobody in particular
Requestors: dmn [...]

Bug Information
Severity: Important
Broken in: 1.16
Fixed in: (no value)


Subject: [patch] tests about double precision numbers fail with Perl 5.12.0
Download (untitled) / with headers
text/plain 739b
Hi, When run under Perl 5.12.0 (built with -Duselongdoubles) on amd64 the following tests fail: # Failed test 'Negative doubles' # at t/01-types-from-js.t line 24. # got: '-1.10000000000000009' # expected: '-1.1' # Failed test 'Positive doubles' # at t/01-types-from-js.t line 26. # got: '1.10000000000000009' # expected: '1.1' # Looks like you failed 2 tests of 20. t/01-types-from-js.t .............. This was reported as Debian bug The attached patch addresses this by replacing the equality tests with tests if the difference between the expected and the real result is very small. It would be nice if the patch is included in a future release. Thanks.
Subject: fix-longdouble-comparison.patch
Description: Replace equality test between doubles with "<epsilon" test Thing is, doubles are not exact and errors are possible in the least significant digit. This patch replaces the equality tests with a test if the difference is smaller than a very small number Bug-Debian: 578548 Forwarded: no Author: Damyan Ivanov <> Last-Update: 2010-04-22 --- a/t/01-types-from-js.t +++ b/t/01-types-from-js.t @@ -21,9 +21,9 @@ is($cx1->eval("1;"), 1, "Positive intege is($cx1->eval("5000000000;"), 5_000_000_000, "Really big integers"); # Doubles -is($cx1->eval("-1.1;"), -1.1, "Negative doubles"); +ok(abs($cx1->eval("-1.1;") - -1.1) < 1e-14, "Negative doubles"); is($cx1->eval("0.0;"), 0.0, "Zero doubles"); -is($cx1->eval("1.1;"), 1.1, "Positive doubles"); +ok(abs($cx1->eval("1.1;")- 1.1) < 1e-14, "Positive doubles"); is($cx1->eval("5000000000.5;"), 5000000000.5, "Really big doubles"); # Strings

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to