Summary: | /rangecheck in initgraphics with /Orientation != 0 | ||
---|---|---|---|
Product: | Ghostscript | Reporter: | Daniel Glöckner <daniel-gl> |
Component: | General | Assignee: | Jack Moffitt <jack> |
Status: | NOTIFIED FIXED | ||
Severity: | normal | ||
Priority: | P2 | ||
Version: | 8.14 | ||
Hardware: | PC | ||
OS: | Linux | ||
Customer: | Word Size: | --- | |
Attachments: | patch |
Description
Daniel Glöckner
2004-04-12 13:23:11 UTC
Please provide a complete example. I was unable to reproduce this problem by rinning "<</Orientation 1>> setpagedevice" before the file. gs -c "<</Orientation 1>> setpagedevice" is the full testcase. The reason for the error is GCC (tested 2.95.3 and 3.4) doing the quot = ang / 90 in gs_sincos_degrees as a multiplication with the reciprocal of 90 when compiling with -ffast-math. Unfortunately the reciprocal can only inaccurately be represented, so that in truth a division by 89.9999999999999965652475175.. is done. The following floor(quot) == quot fails although the difference is marginal. arad = ang * (M_PI / 180) is (with and without -ffast-math) compiles to a multiplication with a constant that must be inaccurate. Therefore sin and cos return numbers != 1.0 and 0.0. Here again a test for equality between floating point numbers is not doing what it was supposed to do. Created attachment 654 [details]
patch
Prevent GCC with -ffast-math from converting a/90. into a*(1/90.) .
I think this is the easiest solution. This code has been running fine
on a wide variety of compilers and systems for years. I don't see the
need to do radical changes now.
The fix with improved comments is committed to the HEAD branch. |