POV-Ray : Newsgroups : povray.advanced-users : Does wrapping atan2(0,0) avoid the domain error? : Does wrapping atan2(0,0) avoid the domain error? Server Time
19 Apr 2024 00:07:19 EDT (-0400)
  Does wrapping atan2(0,0) avoid the domain error?  
From: Cousin Ricky
Date: 5 Dec 2022 14:49:00
Message: <638e4b2c$1@news.povray.org>
I have a situation where it is possible to pass zero as both arguments
to atan2(), which is the one case where the function fails.  But while
attempting to find a workaround for this situation, I discovered that
simply calling atan2(0,0) from within a user-defined function avoids the
domain error!

I don't know whether this is intended POV-Ray behavior or just a fluke
of my computer OS.

Can you all try the following scene file with -F and report what the
message window says, along with your operating system and POV version?
My system writes 0.000000 for the first line, and fails on the second.
I'd like to know if this is consistent behavior across all operating
systems.  Or perhaps Chris or Thorsten can tell us if this is intended
behavior?

----------[BEGIN CODE]----------
#version max (3.5, min (3.8, version));
global_settings { assumed_gamma 1 }
#declare fn_Atan2 = function (y, x) { atan2 (y, x) }
#debug concat ("atan2 (0,0) with wrapper = ", str (fn_Atan2 (0,0), 0,
6), "\n")
#debug concat ("bare atan2 (0,0) = ", str (atan2 (0,0), 0, 6), "\n")
-----------[END CODE]-----------


Post a reply to this message

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