From: "Vinzent Hoefler" <nntp-2010-09@t-domaingrabbing.de>
Subject: Re: Fixed point constants issue
Date: Wed, 15 Sep 2010 19:24:23 +0200
Date: 2010-09-15T19:24:23+02:00 [thread overview]
Message-ID: <op.vi23yxdkd20q5n@jellix.jlfencey.com> (raw)
In-Reply-To: 1nlhu18d10l2j$.1o2b3qlrc5rki$.dlg@40tude.net
On Wed, 15 Sep 2010 10:35:22 +0200, Dmitry A. Kazakov
<mailbox@dmitry-kazakov.de> wrote:
> On Tue, 14 Sep 2010 19:42:52 +0200, Vinzent Hoefler wrote:
>
>> -- 8< -- snip --
>> type BASE_TYPE is delta 1.0 / 64.0 range 0.0 .. 1.0;
>> for BASE_TYPE'Small use 1.0 / 128.0;
>
> But use suggests rather:
>
> type Base_Type is delta 0.01 digits 3 range 0.0..1.0;
>
> or
>
> type Base_Type is delta 0.01 digits 3 range -1.0..1.0;
No. These are bus-protocol types (read: hardware types) where MSB values,
bit sizes
and (valid) range are given, so we definitely want to make sure that the
compiler
uses the correct representation. Thus, a "simple" digits constraint is
ruled out
here.
Usually such a type definition looks similar to that:
type Foo is delta 1.638_400 / 2**13 range -0.819_200 .. 0.819_200;
for Foo'Small use 1.638_400 / 2**13;
for Foo'Size use 13;
For reading from the bus we use the (full-range) base type and checking
its range
before assigning it to the appropriate object of the constrained subtype.
Vinzent.
--
There is no signature.
next prev parent reply other threads:[~2010-09-15 17:24 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-13 17:27 Fixed point constants issue Vinzent Hoefler
2010-09-13 18:04 ` Dmitry A. Kazakov
2010-09-13 18:25 ` Vinzent Hoefler
2010-09-13 19:05 ` Niklas Holsti
2010-09-13 20:35 ` Vinzent Hoefler
2010-09-13 20:35 ` Jeffrey Carter
2010-09-13 21:06 ` Vinzent Hoefler
2010-09-14 5:39 ` Niklas Holsti
2010-09-24 14:43 ` Markus Schöpflin
2010-09-24 20:05 ` Vinzent Hoefler
2010-09-24 21:38 ` Jeffrey Carter
2010-09-24 22:42 ` Vinzent Hoefler
2010-09-25 0:16 ` Jeffrey Carter
2010-09-27 10:33 ` Markus Schöpflin
2010-09-27 18:57 ` Jeffrey Carter
2010-09-28 8:16 ` Markus Schöpflin
2010-09-28 17:28 ` Jeffrey Carter
2010-10-05 6:27 ` Randy Brukardt
2010-10-05 18:40 ` Jeffrey Carter
2010-09-27 17:58 ` Adam Beneschan
2010-09-13 20:32 ` Dmitry A. Kazakov
2010-09-13 21:08 ` Vinzent Hoefler
2010-09-14 6:54 ` J-P. Rosen
2010-09-14 18:28 ` Vinzent Hoefler
2010-09-14 7:47 ` Dmitry A. Kazakov
2010-09-14 17:42 ` Vinzent Hoefler
2010-09-15 8:35 ` Dmitry A. Kazakov
2010-09-15 17:24 ` Vinzent Hoefler [this message]
2010-09-15 20:11 ` Dmitry A. Kazakov
2010-09-14 19:44 ` Keith Thompson
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox