Skip to content

Use the right type of infinity so we don't get a compiler warning.#22

Closed
ThiagoIze wants to merge 1 commit intoNVIDIA:mainfrom
ThiagoIze:infinity-warning
Closed

Use the right type of infinity so we don't get a compiler warning.#22
ThiagoIze wants to merge 1 commit intoNVIDIA:mainfrom
ThiagoIze:infinity-warning

Conversation

@ThiagoIze
Copy link
Contributor

Depending on the windows toolkit being used on Windows (and maybe whatever #defines are set?) we can get compiler warnings like:

cuBQL/queries/pointData/findClosest.h(161): error #221-D: floating-point value does not fit in required floating-point type
                      float squareOfMaxQueryDistance=((float)(1e+300)));
                                                      ^

This happens because INFINITY can be defined by Windows toolkit to be 1e300:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\ucrt\corecrt_math.h

#ifndef _HUGE_ENUF
    #define _HUGE_ENUF  1e+300  // _HUGE_ENUF*_HUGE_ENUF must overflow
#endif
#ifndef _UCRT_LEGACY_INFINITY
#define INFINITY   ((float)(_HUGE_ENUF))

cubql already has functions to do this properly, so I went ahead and used that.

@ingowald ingowald mentioned this pull request Feb 22, 2026
@iwald-nvidia
Copy link
Collaborator

CI broke on some (tiny) missing typecast. Already fixed but haven't figure out to modify the existing PR, so going to fix this through a new PR #24 (which is a pull of your diffs plus that typecast)
Just waiting for CI to run through before I can merge

@iwald-nvidia
Copy link
Collaborator

BTW the entire PosInfTy() etc isn't actually used all that much in cuBQL - it's pretty much a leftover from embree.... but now that you point that it's there I agree it's probably the right way of doing these constants in other places too.
And that 1e300 warning was been driving me crazy for a while now (also in other projects), so if that fixes it then that's worth doing - thx for pointing my nose that way.

@iwald-nvidia
Copy link
Collaborator

handling this through PR #24, closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants