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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.linkpendium.com!news.linkpendium.com!news.snarked.org!border2.nntp.dca1.giganews.com!nntp.giganews.com!buffer2.nntp.dca1.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail NNTP-Posting-Date: Fri, 07 Oct 2016 17:15:33 -0500 From: Dennis Lee Bieber Newsgroups: comp.lang.ada Subject: Re: Ada.Numerics, Accuracy of trigonometric functions Date: Fri, 07 Oct 2016 18:15:39 -0400 Organization: IISS Elusive Unicorn Message-ID: References: <0cebbf23-598e-dd1e-b3f8-4f0fd7e3ab46@spam.spam> X-Newsreader: Forte Agent 6.00/32.1186 X-No-Archive: YES MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 108.73.117.77 X-Trace: sv3-OKgNpF5D6H9iFjuj0VrIh0WCY1tMaEvVcxSU3H13ZYF/PHUNb9P/a5koCzWB1D2GPzEZuc+qKmPoJrA!ItgVaEHJz8aRT/s1Sf8i6A3ZDfIEMKC8WEDdHWq6HpGwxUgyetu84ky0WpeDp0+H1nUkflvDnmPx!aT8Bq/0LOZMLupIGcrhvlyi1kEA= X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2381 Xref: news.eternal-september.org comp.lang.ada:32044 Date: 2016-10-07T18:15:39-04:00 List-Id: On Fri, 7 Oct 2016 17:19:09 +0200, Markus Schöpflin declaimed the following: >Am 07.10.2016 um 16:52 schrieb Dennis Lee Bieber: >> On Fri, 7 Oct 2016 12:13:48 +0200, Markus Schöpflin >> declaimed the following: >> >> >>> X = 4294967296.00000; COS(X) = 1.00000 <-- WHAT? >> >> That kind of surprises me... Not the cos() result, but the input X >> >> Short float should only have around 23-24 bits of significance in the >> mantissa -- enough for around 7 decimal digits. Yet you are seeing the full >> UNSIGNED 32-bit integer value with a stack of fractional zeros tacked on. >> >> I'm tempted to think the compiler, not the run-time, is computing the >> 2^32 as a universal (or whatever the preferred term is) constant using the >> smallest data type that holds the full value. >> > >2**32 has an exact representation as short float: 0x4f800000 (in binary this >is 0 10011111 00000000000000000000000; sign 0, exponent 159, mantissa 0). > >Markus Ah... One of those magic numbers then... -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/