On 24.10.2015 17:14, discuss-request@lists.openscad.org wrote:
The proper response for a division by zero should be not-a-number
(NaN), since that division may result in any number. Consider
sin(0)/0=0, which is a valid expression since the limit for
xapproaching zero exists. atan(2/0) should result in undefined, and
atan(90) should result in inf, since the respective Taylor series
does not converge and no value can be computed.
You're confusing multiple different function classes. The value X/0 is
an indeterminate form if X is equal to 0. If X oscillates at the limit
between a positive and negative number, then the value is also
indeterminate. In all other cases (and especially where X is constant)
the value will diverge to positive infinity for positive X, and
negative infinity for negative X.
The following forms are typically considered indeterminate at the
limit, where one part of the value diverges in an opposing direction
from the other part:
0/0, ∞/∞, 0 × ∞, ∞ − ∞, 0^0, 1^∞ and ∞^0
The value of these forms cannot be determined without an understanding
of the equation that led to these values at the limit. Something that
doesn't have one of these forms is much less likely to be indeterminate.
More information here on Wikipedia:
https://en.wikipedia.org/wiki/Indeterminate_form
However, the atan(2/0) statement is interesting:
atan(2/0) should result in undefined
This is not undefined in the usual interpretation of the function,
and should be 90°. It just happens that most functions for atan don't
allow for infinite arguments.
To be pedantic, the atan function is strictly indeterminate for all
values because a single argument can correspond to two angles 180°
opposed from each other (as well as cycles of 360°). For example, you
could argue that atan(2/0) takes both -90° and 90° as a result. Such a
function would not be particularly useful, so the output domain of the
function is usually set to return results within a particular range,
e.g. [0°,180°), with the remainder of the calculations left as an
exercise for the reader.
Many programming languages (including OpenSCAD) provide a work around
for the issue of infinite values as atan arguments, as well as the 180°
indeterminism, by using the atan2(y,x) function.
https://en.wikipedia.org/wiki/Atan2