<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hello,<br class=""><br class="">I am fooling around IEEE 754 (don't ask why) and I started asking questions to various CL impleentations about the usual corner cases. Take for example the function ACOS.<br class=""><br class=""><font face="Courier New" class=""><span style="font-style: normal;" class="">prompt> (acos 42.0)<br class="">#C(0.0 4.430675)</span></font><br class=""><br class="">Seems legit, according to CLHS. Now, suppose you do (e.g. in CCL)<br class=""><br class=""><font face="Courier New" class=""><span style="font-style: normal;" class="">CCL prompt> (acos 1D++0) ; 1D++0 is positive infinity<br class="">Error: FLOATING-POINT-INVALID-OPERATION detected<br class="">performing * on (0.0D0 1D++0)<br class="">While executing: CCL::%DOUBLE-FLOAT*-2!, in process Listener(4).<br class="">Type cmd-. to abort, cmd-\ for a list of available restarts.<br class="">Type :? for other options.<br class="">1 ><br class=""><br class="">SBCL prompt> (acos 1D++0) ; No, you can't write that in SBCL, but ber with me.<br class="">arithmetic error FLOATING-POINT-INEXACT signalled<br class=""> [Condition of type FLOATING-POINT-INEXACT]<br class=""><br class="">Restarts:<br class=""> 0: [RETRY] Retry SLIME REPL evaluation request.<br class=""> 1: [*ABORT] Return to SLIME's top level.<br class=""> 2: [REMOVE-FD-HANDLER] Remove #<SB-IMPL::HANDLER INPUT on descriptor 8: #<CLOSURE (LABELS SWANK/SBCL::RUN :IN SWANK/BACKEND:ADD-FD-HANDLER) {12974D1D}>><br class=""> 3: [ABORT] Exit debugger, returning to top level.<br class=""><br class=""><br class="">LW prompt> (acos 1D++0)<br class="">#C(6.283185307179586D0 1D+-0 #| 1D+-0 is double-float not-a-number |#)</span></font><br class=""><br class=""><br class="">ACOS (and friends) also take complex numbers.<br class=""><br class=""><font face="Courier New" class=""><span style="font-style: normal;" class="">CL-USER 19 > (acos #C( 42 42))<br class="">#C(0.785469 -4.7773905)<br class=""></span></font><br class=""><br class="">Things get even more interesting when you pass to ACOS (and friends) a complex number with an infinity RE or IM part.<br class=""><br class=""><br class=""><font face="Courier New" class=""><span style="font-style: normal;" class="">LW prompt> (acos (complex 42 1D++0))<br class="">#C(1D+-0 #| 1D+-0 is double-float not-a-number |# -1D++0 #| -1D++0 is double-float minus-infinity |#)<br class=""><br class="">CCL prompt> (acos (complex 1.0 1D++0))<br class="">#C(1.5707963267948966D0 -1D++0)</span></font><br class=""><br class=""><font face="Courier New" class=""><span style="font-style: normal;" class="">SCBL prompt> (acos (complex 1.0 1D++0))<br class="">arithmetic error FLOATING-POINT-INEXACT signalled<br class=""> [Condition of type FLOATING-POINT-INEXACT]<br class=""><br class="">Restarts:<br class=""> 0: [RETRY] Retry SLIME REPL evaluation request.<br class=""> 1: [*ABORT] Return to SLIME's top level.<br class=""> 2: [REMOVE-FD-HANDLER] Remove #<SB-IMPL::HANDLER INPUT on descriptor 8: #<CLOSURE (LABELS SWANK/SBCL::RUN :IN SWANK/BACKEND:ADD-FD-HANDLER) {12974D1D}>><br class=""> 3: [ABORT] Exit debugger, returning to top level.<br class=""></span></font><br class=""><br class=""><br class=""><br class="">Now, now, now. We do not like this state of affairs, do we?<br class=""><br class="">So, the question is: what should ACOS (and friends) do in these cases?<div class=""><br class=""></div><div class="">What about the LIA ISO/IEC 10967 standards?</div><div class=""><br class=""></div><div class="">All the best</div><div class=""><br class=""></div><div class="">Marco</div><div class=""><br class=""><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""><div class="">--<br class="">Marco Antoniotti, Associate Professor<span class="Apple-tab-span" style="white-space:pre"> </span>tel.<span class="Apple-tab-span" style="white-space:pre"> </span>+39 - 02 64 48 79 01<br class="">DISCo, Università Milano Bicocca U14 2043<span class="Apple-tab-span" style="white-space:pre"> </span><a href="http://bimib.disco.unimib.it" class="">http://bimib.disco.unimib.it</a><br class="">Viale Sarca 336<br class="">I-20126 Milan (MI) ITALY<br class=""><br class="">Please check: http://cdac2019.lakecomoschool.org<br class="">Please check: http://troncopackage.org<br class="">Please check: https://www.frontiersin.org/research-topics/7394/network-bioscience<br class=""><br class="">Please note that I am not checking my Spam-box anymore.<br class="">Please do not forward this email without asking me first (cum grano salis).<br class=""><br class=""><br class=""><br class=""><br class=""></div><br class=""></div></div></body></html>