[Bug 1231263] slic3r-1.1.7-4.fc23 FTBFS with perl-5.22: 'W direction' t/angles.t test fails
bugzilla at redhat.com
bugzilla at redhat.com
Fri Jun 12 20:30:12 UTC 2015
https://bugzilla.redhat.com/show_bug.cgi?id=1231263
Miro Hrončok <mhroncok at redhat.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
--- Comment #2 from Miro Hrončok <mhroncok at redhat.com> ---
The code that gets executed here is (simplified):
C++:
#define PI 3.141592653589793238
...
double atan2 = atan2(0-0,0-10);
// note: atan2 is mathematically speaking an actual pi now
return (atan2 == PI) ? 0
: (atan2 < 0) ? (atan2 + PI)
: atan2;
The routine returns 0 on x86_64 because the (atan2 == PI) condition passes.
On i686 it returns something else (3.14159265358979 ?) as the condition somehow
doesn't pass.
But when I take the failing test:
is line_direction([ [10, 0], [0, 0] ]), (0), 'W direction';
and change it to:
is line_direction([ [10, 0], [0, 0] ]), (PI), 'W direction';
the test passes on i686, so the routine returned PI, which should not be
possible.
It seems that the comparison (atan2 == PI) was false in C++, but true in Perl.
This sample program however:
#include <iostream>
#include <iomanip>
#include <math.h>
#define PI 3.141592653589793238
int main(int argc, char **argv)
{
double pi = atan2(0, -10);
std::cout << std::setprecision(35) << pi;
if (pi == PI) std::cout << " == ";
else std::cout << " != ";
std::cout << PI << std::endl;
return 0;
}
Produces:
3.1415926535897931159979634685441852 ==
3.1415926535897931159979634685441852
in rawhide i686 mock. My head hurts :(
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the perl-devel
mailing list