Previous: baselib math semantics integer, Up: baselib math semantics [Index]
In general, the transcendental functions \log, \sin^{-1} (arcsine), \cos^{-1} (arccosine), and \tan^{-1} are multiply defined. The value of \log z is defined to be the one whose imaginary part lies in the range from -\pi (inclusive if -0.0 is distinguished, exclusive otherwise) to \pi (inclusive). \log 0 is undefined.
The value of \log z for non–real z is defined in terms of log on real numbers as:
\log z = \log |z| + (\angle z) i
where \angle z is the angle of z = a * e^{(i * b)} specified as:
\angle z = b + 2 \pi n
with -\pi <= \angle z <= \pi and \angle z = b + 2 \pi n for some integer n.
With the one–argument version of \log defined this way, the values of the two–argument–version of \log z, \sin^{-1} z, \cos^{-1} z, \tan^{-1} z, and the two–argument version of \tan^{-1} are according to the following formulae:
\log_b z = (\log z)/(\log b) \sin^(-1) z = -i \log (i z + \sqrt(1 - z^2)) \cos^(-1) z = \pi/2 - sin^(-1) z \tan^(-1) z = (\log (1 + i z) - \log (1 - i z)) / (2 i) \tan^(-1) (x, y) = \angle(x + yi)
The range of \tan^{-1} (x, y) is as in the following table; the asterisk (‘*’) indicates that the entry applies to implementations that distinguish minus zero.
y condition | x condition | range of result r | |
---|---|---|---|
y = 0.0 | x > 0.0 | 0.0 | |
* | y = +0.0 | x > 0.0 | +0.0 |
* | y = -0.0 | x > 0.0 | -0.0 |
y > 0.0 | x > 0.0 | 0.0 < r < \pi/2 | |
y > 0.0 | x = 0.0 | \pi/2 | |
y > 0.0 | x < 0.0 | \pi/2 < r < \pi | |
y = 0.0 | x < 0 | \pi | |
* | y = +0.0 | x < 0.0 | \pi |
* | y = -0.0 | x < 0.0 | -\pi |
y < 0.0 | x < 0.0 | -\pi< r < -\pi/2 | |
y < 0.0 | x = 0.0 | -\pi/2 | |
y < 0.0 | x > 0.0 | -\pi/2 < r < 0.0 | |
y = 0.0 | x = 0.0 | undefined | |
* | y = +0.0 | x = +0.0 | +0.0 |
* | y = -0.0 | x = +0.0 | -0.0 |
* | y = +0.0 | x = -0.0 | \pi |
* | y = -0.0 | x = -0.0 | -\pi |
* | y = +0.0 | x = 0 | \pi/2 |
* | y = -0.0 | x = 0 | -\pi/2 |
Previous: baselib math semantics integer, Up: baselib math semantics [Index]