From: "Markus Schöpflin" <no.spam@spam.spam>
Subject: Re: Ada.Numerics, Accuracy of trigonometric functions
Date: Fri, 7 Oct 2016 17:19:09 +0200
Date: 2016-10-07T17:19:09+02:00 [thread overview]
Message-ID: <0cebbf23-598e-dd1e-b3f8-4f0fd7e3ab46@spam.spam> (raw)
In-Reply-To: g8dfvb5eln7isqv9k9ihjp0ts5b28o1vhn@4ax.com
Am 07.10.2016 um 16:52 schrieb Dennis Lee Bieber:
> On Fri, 7 Oct 2016 12:13:48 +0200, Markus Schöpflin <no.spam@spam.spam>
> 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
next prev parent reply other threads:[~2016-10-07 15:19 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-07 10:13 Ada.Numerics, Accuracy of trigonometric functions Markus Schöpflin
2016-10-07 10:23 ` Markus Schöpflin
2016-10-07 10:23 ` Brian Drummond
2016-10-07 10:40 ` Markus Schöpflin
2016-10-07 14:52 ` Dennis Lee Bieber
2016-10-07 15:19 ` Markus Schöpflin [this message]
2016-10-07 22:15 ` Dennis Lee Bieber
2016-10-07 16:38 ` Jeffrey R. Carter
2016-10-10 7:44 ` Markus Schöpflin
2016-10-22 22:38 ` Robert Eachus
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox