by erik » Fri Mar 02, 2018 8:41 am
Clamping does not guarantee against NaN ever happening, although it minimizes the chances.
Take for example the following scenario:
value1 -= clamp (-10.0, 0.0, 1.0) // results in value being 0
value2 = clamp(1.0/value1, 0.0, 1.0)
Value2 will still be a NaN because of a devide by zero and the clamping will not protect against it since it is not-a-number so the computing unit has no clue whether it should clamp to zero or to one.
Erik
Current: Parachutist, Paraglider, Pterosaur, Pilatus PC-9M and variants, ERCO Ercoupe, Fokker Dr.1, Fokker 50, Fokker 100
Less active: Cessna T-37, T-38, Santa Claus. Previous: General Dynamics F-16. Worked on: Wright Flyer