karansher / computer-graphics-ray-tracing

Computer Graphics Assignment about Ray Tracing
0 stars 0 forks source link

Problems comparing to infinity #9

Open MurraySmith27 opened 2 years ago

MurraySmith27 commented 2 years ago

I've defined my max_t for directional lights as infinity using the limits library and the technique described in the assignment description, but when I compare it to a double it's always returning true. I think gcc with the version of c++ I'm using has has trouble with this.

I've found a way that works which is to check if it's infinity by comparing it to DBL_MAX which is defined in float.h.

My question is, can we #include "float.h" in our code?

Glowies commented 2 years ago

Yes, you can use float.h