I think its strange that the spec requires ambiguous results of atan2 for
zero-valued arguments:
The expression math:atan2(+0.0e0, -0.0e0) returns 0.0e0.
The expression math:atan2(+0.0e0, -0.0e0) returns math:pi().
The expression math:atan2(-0.0e0, -0.0e0) returns -0.0e0.
The expression math:atan2(-0.0e0, -0.0e0) returns -math:pi().
This is a bug in the spec, see
http://www.w3.org/Bugs/Public/show_bug.cgi?id=11549
Stefan
Am 20.06.2011 um 00:17 schrieb Imsieke, Gerrit, le-tex:
On 2011-06-19 23:08, Stefan Krause wrote:
[…] Out of interest,
why do you need to distinguish them?
Because atan2(y,x) treats them different, see [1]. I try to implement this
behavior in XSLT 2.0.
I think its strange that the spec requires ambiguous results of atan2 for
zero-valued arguments:
The expression math:atan2(+0.0e0, -0.0e0) returns 0.0e0.
The expression math:atan2(+0.0e0, -0.0e0) returns math:pi().
The expression math:atan2(-0.0e0, -0.0e0) returns -0.0e0.
The expression math:atan2(-0.0e0, -0.0e0) returns -math:pi().
Then atan2 is no longer a function, mathematically.
If, in an attempt to disambiguate the function, the ±π results were not
required, you could simply return
-x*y for x=±0, y=±0.
If the spec is flawed and should actually read:
The expression math:atan2(+0.0e0, +0.0e0) returns 0.0e0.
The expression math:atan2(+0.0e0, -0.0e0) returns -0.0e0.
The expression math:atan2(-0.0e0, +0.0e0) returns math:pi().
The expression math:atan2(-0.0e0, -0.0e0) returns -math:pi().
then I don’t see another way than reverting to some tricks such as cast each
argument to xs:string and look up the corresponding result.
Gerrit
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--