From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,64012d256cd76a8d X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-04-09 23:23:29 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn13feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!rwcrnsc51.ops.asp.att.net.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: Gnat/Windows float point Q References: X-Newsreader: Tom's custom newsreader Message-ID: NNTP-Posting-Host: 12.234.13.56 X-Complaints-To: abuse@attbi.com X-Trace: rwcrnsc51.ops.asp.att.net 1049955809 12.234.13.56 (Thu, 10 Apr 2003 06:23:29 GMT) NNTP-Posting-Date: Thu, 10 Apr 2003 06:23:29 GMT Organization: AT&T Broadband Date: Thu, 10 Apr 2003 06:23:29 GMT Xref: archiver1.google.com comp.lang.ada:36040 Date: 2003-04-10T06:23:29+00:00 List-Id: > I'd expect the result of such an operation to be either +infinity > or -infinity. Those compare as you expect, and probably raise > Constraint_Error when stored (if they didn't do that, the compiler would > be violating the rule about math always returning the correct result or > raising an exception). Is this a legitimate output, in terms of exceptions (none), comparisons (the last three are False in both directions) and float'image (missing leading blanks and worse), from this program? with ada.numerics.complex_types, ada.text_io; procedure oflow is use ada.numerics.complex_types; x : complex := (4.7E+17, -1.6E+17); y : float; begin for i in 1 .. 5 loop y := abs(x); ada.text_io.put_line("abs(x) = y =" & float'image(y) & " y < 0.0 " & boolean'image(y < 0.0) & " y >= 0.0 " & boolean'image(y >= 0.0)); ada.text_io.put_line(float'image(re(x)) & float'image(im(x))); ada.text_io.put_line(float'image(re(x)) & ":" & float'image(im(x))); ada.text_io.new_line; x := x**2; end loop; end oflow; abs(x) = y = 4.96488E+17 y < 0.0 FALSE y >= 0.0 TRUE 4.70000E+17-1.60000E+17 4.70000E+17:-1.60000E+17 abs(x) = y = 2.46500E+35 y < 0.0 FALSE y >= 0.0 TRUE 1.95300E+35-1.50400E+35 1.95300E+35:-1.50400E+35 abs(x) = y =1.95300E+05 y < 0.0 FALSE y >= 0.0 FALSE +Inf*******1.50400E+05 +Inf*******:1.50401E+05 abs(x) = y =+Inf******* y < 0.0 FALSE y >= 0.0 FALSE 3.36210E-49321.50401E+05 9.52681E+139:1.50402E+05 abs(x) = y =9.52681E+05 y < 0.0 FALSE y >= 0.0 FALSE 0.E+051.50402E+05 3.64520E-4951:1.50403E+05