--- povray-3.7.0.10/source/backend/configbackend.h.orig 2021-07-08 04:56:01.000000000 -0500 +++ povray-3.7.0.10/source/backend/configbackend.h 2024-05-14 12:44:19.363434910 -0500 @@ -140,10 +140,14 @@ #define EPSILON 1.0e-10 #endif -#ifndef HUGE_VAL // A very large value, can be considered infinity - #define HUGE_VAL 1.0e+17 -#endif - +/* + * A very large but finite value, can be considered infinity. + * This used to be HUGE_VAL which many POSIX systems define as infinity, + * causing comparisons with it to fail when compiling with -ffast-math + * or -ffinite-math-only, observed in Fedora 38 through 40 using gcc. + */ +#define HUGE_FINITE_VAL 1.0e+17 + /* * If the width of a bounding box in one dimension is greater than * the critical length, the bounding box should be set to infinite. --- povray-3.7.0.10/source/backend/frame.h.orig 2021-07-08 04:56:01.000000000 -0500 +++ povray-3.7.0.10/source/backend/frame.h 2024-05-14 11:54:42.276650276 -0500 @@ -1404,7 +1404,7 @@ virtual void Invert() = 0; virtual void Compute_BBox() = 0; virtual void Determine_Textures(Intersection *, bool, WeightedTextureVector&, TraceThreadData *Thread); // could be "(const Intersection*...) const" if it wasn't for blob specials - virtual bool Intersect_BBox(BBoxDirection, const BBOX_VECT&, const BBOX_VECT&, BBOX_VAL = HUGE_VAL) const; + virtual bool Intersect_BBox(BBoxDirection, const BBOX_VECT&, const BBOX_VECT&, BBOX_VAL = HUGE_FINITE_VAL) const; // optional post-render message dispatcher; will be called upon completion // of rendering a view. this is the appropriate place to send messages that --- povray-3.7.0.10/source/backend/interior/media.cpp.orig 2021-07-08 04:56:01.000000000 -0500 +++ povray-3.7.0.10/source/backend/interior/media.cpp 2024-05-14 11:54:42.292649899 -0500 @@ -289,7 +289,7 @@ bool use_extinction = false; bool use_scattering = false; int minSamples; - DBL aa_threshold = HUGE_VAL; + DBL aa_threshold = HUGE_FINITE_VAL; // Find media with the largest number of intervals. IMedia = medias.front(); --- povray-3.7.0.10/source/backend/lighting/photons.cpp.orig 2021-07-08 04:56:01.000000000 -0500 +++ povray-3.7.0.10/source/backend/lighting/photons.cpp 2024-05-14 11:54:42.309649498 -0500 @@ -222,7 +222,7 @@ ticket.traceLevel--; if(found == false) - return HUGE_VAL; + return HUGE_FINITE_VAL; else return bestisect.Depth; } @@ -1058,7 +1058,7 @@ bool use_extinction = false; bool use_scattering = false; int minSamples; - DBL aa_threshold = HUGE_VAL; + DBL aa_threshold = HUGE_FINITE_VAL; // Find media with the largest number of intervals. IMedia = medias.front(); --- povray-3.7.0.10/source/backend/lighting/radiosity.cpp.orig 2021-07-08 04:56:01.000000000 -0500 +++ povray-3.7.0.10/source/backend/lighting/radiosity.cpp 2024-05-14 11:54:42.331648979 -0500 @@ -502,8 +502,8 @@ DBL to_eye = Vector3d(this->cameraPosition - ipoint).length(); DBL reuse_dist_min = to_eye * recSettings.minReuseFactor; DBL maximum_distance = to_eye * recSettings.maxReuseFactor; - if (recSettings.maxReuseFactor >= HUGE_VAL) - maximum_distance = HUGE_VAL; + if (recSettings.maxReuseFactor >= HUGE_FINITE_VAL) + maximum_distance = HUGE_FINITE_VAL; cur_sample_count = recSettings.raysPerSample; @@ -607,8 +607,8 @@ } // we always get the distance, so we'll use it - if(depth > HUGE_VAL) - depth = HUGE_VAL; + if(depth > HUGE_FINITE_VAL) + depth = HUGE_FINITE_VAL; else { #ifdef RADSTATS --- povray-3.7.0.10/source/backend/parser/express.cpp.orig 2021-07-08 04:56:01.000000000 -0500 +++ povray-3.7.0.10/source/backend/parser/express.cpp 2024-05-14 11:54:42.348648578 -0500 @@ -1609,7 +1609,7 @@ { if (Local_Express[i]==0.0) /* must be 0.0, not EPSILON */ { - Express[i]=HUGE_VAL; + Express[i]=HUGE_FINITE_VAL; Warning(0,"Divide by zero."); } else --- povray-3.7.0.10/source/backend/parser/parse.cpp.orig 2021-07-08 04:56:01.000000000 -0500 +++ povray-3.7.0.10/source/backend/parser/parse.cpp 2024-05-14 11:54:42.370648059 -0500 @@ -1382,15 +1382,15 @@ DBL old_angle; Assign_Vector(old_look_at, New.Look_At); - Make_Vector(New.Look_At, HUGE_VAL, HUGE_VAL, HUGE_VAL); + Make_Vector(New.Look_At, HUGE_FINITE_VAL, HUGE_FINITE_VAL, HUGE_FINITE_VAL); Assign_Vector(old_up, New.Up); - Make_Vector(New.Up, HUGE_VAL, HUGE_VAL, HUGE_VAL); + Make_Vector(New.Up, HUGE_FINITE_VAL, HUGE_FINITE_VAL, HUGE_FINITE_VAL); Assign_Vector(old_right, New.Right); - Make_Vector(New.Right, HUGE_VAL, HUGE_VAL, HUGE_VAL); + Make_Vector(New.Right, HUGE_FINITE_VAL, HUGE_FINITE_VAL, HUGE_FINITE_VAL); Assign_Vector(old_focal_point, New.Focal_Point); - Make_Vector(New.Focal_Point, HUGE_VAL, HUGE_VAL, HUGE_VAL); + Make_Vector(New.Focal_Point, HUGE_FINITE_VAL, HUGE_FINITE_VAL, HUGE_FINITE_VAL); old_angle = New.Angle; - New.Angle = HUGE_VAL; + New.Angle = HUGE_FINITE_VAL; EXPECT CASE (PERSPECTIVE_TOKEN) @@ -1630,7 +1630,7 @@ } // handle "up" - if (New.Up[X] == HUGE_VAL) + if (New.Up[X] == HUGE_FINITE_VAL) { Assign_Vector(New.Up, old_up); // restore default up } @@ -1638,7 +1638,7 @@ had_up = true; // handle "right" - if (New.Right[X] == HUGE_VAL) + if (New.Right[X] == HUGE_FINITE_VAL) { Assign_Vector(New.Right, old_right); // restore default right } @@ -1646,7 +1646,7 @@ had_right = true; // apply "angle" - if (New.Angle != HUGE_VAL) + if (New.Angle != HUGE_FINITE_VAL) { if ((New.Type == PERSPECTIVE_CAMERA) || (New.Type == ORTHOGRAPHIC_CAMERA)) { @@ -1668,7 +1668,7 @@ New.Angle = old_angle; // restore default angle // apply "look_at" - if (New.Look_At[X] != HUGE_VAL) + if (New.Look_At[X] != HUGE_FINITE_VAL) { VLength (Direction_Length, New.Direction); VLength (Up_Length, New.Up); @@ -1742,7 +1742,7 @@ } // apply "focal_point" - if (New.Focal_Point[X] != HUGE_VAL) + if (New.Focal_Point[X] != HUGE_FINITE_VAL) { Assign_Vector(tempv, New.Focal_Point); VSubEq(tempv, New.Location); --- povray-3.7.0.10/source/backend/render/trace.cpp.orig 2021-07-08 04:56:01.000000000 -0500 +++ povray-3.7.0.10/source/backend/render/trace.cpp 2024-05-14 11:54:42.394647494 -0500 @@ -123,7 +123,7 @@ threadData->Stats()[ADC_Saves]++; colour.clear(); - return HUGE_VAL; + return HUGE_FINITE_VAL; } if (maxDepth >= EPSILON) @@ -144,7 +144,7 @@ if (ticket.radiosityImportanceFound < ticket.radiosityImportanceQueried) { if(found == false) - return HUGE_VAL; + return HUGE_FINITE_VAL; else return bestisect.Depth; } @@ -196,7 +196,7 @@ ticket.radiosityImportanceQueried = oldRadiosityImportanceQueried; if(found == false) - return HUGE_VAL; + return HUGE_FINITE_VAL; else return bestisect.Depth; } @@ -3788,7 +3788,7 @@ if (found) dist = (Vector3d(out.IPoint) - Vector3d(unscatteredIn.IPoint)).length() * sceneData->mmPerUnit; else - dist = HUGE_VAL; + dist = HUGE_FINITE_VAL; double cos_out = dot(vOut, Vector3d(out.INormal)); --- povray-3.7.0.10/source/backend/render/trace.h.orig 2021-07-08 04:56:01.000000000 -0500 +++ povray-3.7.0.10/source/backend/render/trace.h 2024-05-14 11:54:42.428646692 -0500 @@ -220,8 +220,8 @@ bool FindIntersection(Intersection& isect, const Ray& ray); bool FindIntersection(Intersection& isect, const Ray& ray, const RayObjectCondition& precondition, const RayObjectCondition& postcondition); - bool FindIntersection(ObjectPtr object, Intersection& isect, const Ray& ray, double closest = HUGE_VAL); - bool FindIntersection(ObjectPtr object, Intersection& isect, const Ray& ray, const RayObjectCondition& postcondition, double closest = HUGE_VAL); + bool FindIntersection(ObjectPtr object, Intersection& isect, const Ray& ray, double closest = HUGE_FINITE_VAL); + bool FindIntersection(ObjectPtr object, Intersection& isect, const Ray& ray, const RayObjectCondition& postcondition, double closest = HUGE_FINITE_VAL); unsigned int GetHighestTraceLevel(); --- povray-3.7.0.10/source/backend/scene/objects.cpp.orig 2021-07-08 04:56:01.000000000 -0500 +++ povray-3.7.0.10/source/backend/scene/objects.cpp 2024-05-14 11:54:42.442646362 -0500 @@ -103,7 +103,7 @@ { if(object != NULL) { - DBL closest = HUGE_VAL; + DBL closest = HUGE_FINITE_VAL; BBOX_VECT origin; BBOX_VECT invdir; ObjectBase::BBoxDirection variant; @@ -157,7 +157,7 @@ { if(object != NULL) { - DBL closest = HUGE_VAL; + DBL closest = HUGE_FINITE_VAL; BBOX_VECT origin; BBOX_VECT invdir; ObjectBase::BBoxDirection variant; @@ -211,7 +211,7 @@ { if(object != NULL) { - DBL closest = HUGE_VAL; + DBL closest = HUGE_FINITE_VAL; if(object->Intersect_BBox(variant, origin, invdir, closest) == false) return false; @@ -257,7 +257,7 @@ { if(object != NULL) { - DBL closest = HUGE_VAL; + DBL closest = HUGE_FINITE_VAL; if(object->Intersect_BBox(variant, origin, invdir, closest) == false) return false; --- povray-3.7.0.10/source/backend/scene/scene.cpp.orig 2021-07-08 04:56:01.000000000 -0500 +++ povray-3.7.0.10/source/backend/scene/scene.cpp 2024-05-14 11:54:42.455646056 -0500 @@ -471,9 +471,9 @@ // NB a value of '0' for any of the BSP parameters tells the BSP code to use its internal default sceneData->bspMaxDepth = parseOptions.TryGetInt(kPOVAttrib_BSP_MaxDepth, 0); - sceneData->bspObjectIsectCost = clip(parseOptions.TryGetFloat(kPOVAttrib_BSP_ISectCost, 0.0f), 0.0f, HUGE_VAL); - sceneData->bspBaseAccessCost = clip(parseOptions.TryGetFloat(kPOVAttrib_BSP_BaseAccessCost, 0.0f), 0.0f, HUGE_VAL); - sceneData->bspChildAccessCost = clip(parseOptions.TryGetFloat(kPOVAttrib_BSP_ChildAccessCost, 0.0f), 0.0f, HUGE_VAL); + sceneData->bspObjectIsectCost = clip(parseOptions.TryGetFloat(kPOVAttrib_BSP_ISectCost, 0.0f), 0.0f, HUGE_FINITE_VAL); + sceneData->bspBaseAccessCost = clip(parseOptions.TryGetFloat(kPOVAttrib_BSP_BaseAccessCost, 0.0f), 0.0f, HUGE_FINITE_VAL); + sceneData->bspChildAccessCost = clip(parseOptions.TryGetFloat(kPOVAttrib_BSP_ChildAccessCost, 0.0f), 0.0f, HUGE_FINITE_VAL); sceneData->bspMissChance = clip(parseOptions.TryGetFloat(kPOVAttrib_BSP_MissChance, 0.0f), 0.0f, 1.0f - EPSILON); sceneData->realTimeRaytracing = parseOptions.TryGetBool(kPOVAttrib_RealTimeRaytracing, false); --- povray-3.7.0.10/source/backend/shape/fpmetric.cpp.orig 2021-07-08 04:56:01.000000000 -0500 +++ povray-3.7.0.10/source/backend/shape/fpmetric.cpp 2024-05-14 11:54:42.471645679 -0500 @@ -110,7 +110,7 @@ UV_VECT low_vect, hi_vect, uv; Ray New_Ray; DBL XRayMin, XRayMax, YRayMin, YRayMax, ZRayMin, ZRayMax, TPotRes, TLen; - DBL Depth1, Depth2, temp, Len, TResult = HUGE_VAL; + DBL Depth1, Depth2, temp, Len, TResult = HUGE_FINITE_VAL; DBL low, hi, len; int MaxPrecompX, MaxPrecompY, MaxPrecompZ; int split, i = 0, Side1, Side2; --- povray-3.7.0.10/source/backend/shape/prism.cpp.orig 2021-07-08 04:56:01.000000000 -0500 +++ povray-3.7.0.10/source/backend/shape/prism.cpp 2024-05-14 11:54:42.488645278 -0500 @@ -637,7 +637,7 @@ } else { - P[X] = P[Z] = HUGE_VAL; + P[X] = P[Z] = HUGE_FINITE_VAL; } } --- povray-3.7.0.10/vfe/win/syspovconfig.h.orig 2021-07-08 04:56:01.000000000 -0500 +++ povray-3.7.0.10/vfe/win/syspovconfig.h 2024-05-14 12:42:28.232058202 -0500 @@ -303,7 +303,8 @@ #endif // end of not _CONSOLE // see RLP comment in 3.6 windows config.h -#undef HUGE_VAL +// #undef HUGE_VAL +// Now renamed HUGE_FINITE_VAL in source/backend/configbackend.h. // use a larger buffer for more efficient parsing #define DEFAULT_ITEXTSTREAM_BUFFER_SIZE 65536