<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<br>
<blockquote type="cite"
cite="mid:8eb10250-69ab-4417-8c31-0a5de319d6ce@spatialys.com">
<p>If we wanted to be fully precised, for values close to 1, we
could actually evaluate sqrt(delta * (2 - delta)) with delta = 1
- something<br>
</p>
<p>then</p>
<p>>>> '%.17g' % math.sqrt(1e-7 * (2 - 1e-7))<br>
'0.00044721358431961788'<br>
</p>
<p>which matches quite perfectly the full precision result.</p>
</blockquote>
<p>Well, revisiting that, the above would be correct if "delta = 1 -
something" would be evaluated with full precision... But in
reality, it doesn't, so:</p>
<p>if something = 1 - 1e-7,</p>
<p>delta = 1 - something = 9.9999999947364415e-08</p>
<p>and</p>
<p>'%.17g' % math.sqrt(9.9999999947364415e-08 * (2 -
9.9999999947364415e-08))</p>
<p>= 0.00044721358420192118</p>
<p>which is not better than using the naive sqrt(1 - x * x)</p>
<p>So my pj_cos_of_asin(x) could simplify be simplified as sqrt(1 -
x * x), possibly with being tolerant for input values in [1, 1 +
EPSILON_FOR_SLIGHTLY_OUT_OF_DOMAIN] or [-1 -
EPSILON_FOR_SLIGHTLY_OUT_OF_DOMAIN, -1] as we do in aasin() (in
src/aasincos.cpp), although I don't know if the use cases where
authalic lat --> geographic lat is involved we can get those
slightly out of range values, due to rounding errors in previous
computations.<br>
</p>
<span style="white-space: pre-wrap">
</span>
<pre class="moz-signature" cols="72">--
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
</body>
</html>