My Ghostscript build has a problem rendering files with /Orientation != 0, because make_adjustment_matrix uses gs_matrix_rotate which generates a matrix containing two very very small numbers (2.65358e-17) != 0.0 . This causes gs_setdotorientation to fail because both is_xxyy and is_xyyx are false. It is generally a bad idea to test floating point numbers for equality. Example: <</Orientation 1>> setpagedevice
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.