/* // Output of this demonstates a serious bug in tcc version 0.9.27 (x86_64 Windows): // The bug does not seem to be related to the use float vs double type, but rather the // float literal's f-suffix. Note that 'test 5' seems to work, which may be due to // the '-' prefix in the float literal, but there is never bug when using double float // literals - i.e. no 'f' suffix. x: 2 y: 20 Parameters given: -1 1 -10 10 Test 1: FAILED!: -1 -10 -10 10 Test 2: FAILED!: 10 10 10 10 Test 3: FAILED!: 1 1 10 10 Test 4: FAILED!: -1 -10 -10 10 Test 5: PASSED!: -1 1 -10 10 Test 6: PASSED!: -1 1 -10 10 */ #include typedef float Real; typedef Real vec4[4]; void glm_frustum(Real left, Real right, Real bottom, Real top) { fprintf(stdout, "%g %g %g %g\n", left, right, bottom, top); } void test(void) { Real x = 2.0f, y = 20.0f; printf("x: %g y: %g\n", x, y); printf("Parameters given: %g %g %g %g\n\n", -x * 0.5f, x * 0.5f, -y * 0.5f, y * 0.5f); printf("Test 1: FAILED!: "); glm_frustum(-x * 0.5f, x * 0.5f, -y * 0.5f, y * 0.5f); printf("Test 2: FAILED!: "); glm_frustum(x * 0.5f, x * 0.5f, y * 0.5f, y * 0.5f); printf("Test 3: FAILED!: "); glm_frustum(0.5f * -x, 0.5f * x, 0.5f * -y, 0.5f * y); printf("Test 4: FAILED!: "); glm_frustum(-x * 0.5f, x * 0.5f, -y * 0.5f, y * 0.5f); printf("Test 5: PASSED!: "); // due to '-' prefix? glm_frustum(-0.5f * x, 0.5f * x, -0.5f * y, 0.5f * y); printf("Test 6: PASSED!: "); // due to no 'f' suffixes! glm_frustum(-x * 0.5, x * 0.5, -y * 0.5, y * 0.5); } int main() { test(); }