POV-Ray : Newsgroups : povray.advanced-users : select, pow(0,0) : Re: select, pow(0,0) Server Time
20 Apr 2024 03:50:05 EDT (-0400)
  Re: select, pow(0,0)  
From: clipka
Date: 25 Aug 2018 18:51:23
Message: <5b81dd6b$1@news.povray.org>
Am 25.08.2018 um 23:23 schrieb Bald Eagle:

> Right now, I'm making them more svelt.  More chain-link, less barbed-wire.

I had to look that up.

> Something.  I just think that 25-year-old legendary software ought to be mature
> enough to not require the user to code their way out of something that should
> only require a switch or the trivial documented use of an alternate function -

Name any respectable programming language that provides workarounds for
the pow(0,0) problem out of the box.

> like with atan() and atan2().

That's a whole different game. Technically, `atan2()` is an answer to a
very different question than `atan()`.

`atan(x)` gives the answer to the quite academic question, "what is the
arcus tangens of x, as per the mathematical definition?"

`atan2(y,x)` gives the answer to the far more practical question, "what
is the angle between the X axis and a ray from (0;0) to (x;y) in
cartesian space, as per geometric properties?". Its name derives from
the fact that the answer /happens/ to coincide with `atan(y/x)` for
positive x (and that the function takes 2 arguments), but it really is a
fundamentally different question.

While this latter question could be rephrased in terms of the former one
plus some extra steps, it occurs so frequently that having a dedicated
stock function for it is perfectly warranted.

The `pow()` case is totally different: There is no corresponding
practical question that would require graceful handling of the special
case equivalent to `pow(0,0)` while also being asked frequently enough
to warrant a dedicated stock function.

And thus, to the best of my knowledge there is no program language of
any renown that has such a function. Whether you use POV-Ray's SDL,
C/C++, Fortran, Java, C#, Python, Ruby, Go, Lolcode, or what-have-you,
you will always have to do special handling if your algorithm involves
computing `pow(a,b)` with a and b potentially being both zero.

In contrast, `atan2` has been around at least since the 1970s, and has
spread from Fortran 77 to pretty much any language of renown that is
frequently used for mathematically-oriented applications (including
POV-Ray's SDL, C/C++, Java, C#, Python, Ruby and Go, and probably also
what-have-you).


Fun fact: Although `atan2` (aka `arctan2`) originally started out as a
shortcut software function, nowadays it appears to be considered a
full-fledged mathematical function in its own right.


Post a reply to this message

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