POV-Ray : Newsgroups : povray.advanced-users : Testing for NaNs : Re: Testing for NaNs Server Time
28 Jul 2024 14:18:31 EDT (-0400)
  Re: Testing for NaNs  
From: Warp
Date: 10 Jan 2005 05:40:24
Message: <41e25b98@news.povray.org>
David Wallace <dar### [at] earthlinknet> wrote:
> So, what is the fastest and easiest way to detect NaN floats and vectors?

  There isn't.

  What happens eg. with a division by 0 is completely system-dependant,
and even whether you get a 'NaN' value or something else is
system-dependant. (In fact, the 'NaN' value itself is system-dependant
because not all architectures implement the IEEE floating point numbers.)
  There's no portable way of testing "is this value a NaN?".

  The only way you can prevent it from happening is to test the
operands of the division prior to performing the division.

-- 
plane{-x+y,-1pigment{bozo color_map{[0rgb x][1rgb x+y]}turbulence 1}}
sphere{0,2pigment{rgbt 1}interior{media{emission 1density{spherical
density_map{[0rgb 0][.5rgb<1,.5>][1rgb 1]}turbulence.9}}}scale
<1,1,3>hollow}text{ttf"timrom""Warp".1,0translate<-1,-.1,2>}//  - Warp -


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.