From: Pascal Obry <pascal@obry.net>
Subject: Re: how to safely convert from 32 to 16 bits?
Date: 04 Jun 2005 19:53:09 +0200
Date: 2005-06-04T19:53:13+02:00 [thread overview]
Message-ID: <uk6la101m.fsf@obry.net> (raw)
In-Reply-To: 6acda821.0506040923.1790561c@posting.google.com
di98mase@hotmail.com (Sebastian) writes:
> I have a variable of Integer_32 size, I also know that the value is
> always between -180 and 180. I would like to assign that value to a 16
> bits Real type.
>
> How can that be done without loosing any data?
I don't see the problem.
A : Integer_32;
B : Integer_16:
B := Integer_16 (A);
Since A is always between -180 and 180 there will be no exception raised.
Pascal.
--
--|------------------------------------------------------
--| Pascal Obry Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--| http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595
next prev parent reply other threads:[~2005-06-04 17:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-04 17:23 how to safely convert from 32 to 16 bits? Sebastian
2005-06-04 17:53 ` Pascal Obry [this message]
2005-06-04 18:45 ` Robert Klungle
2005-06-05 8:13 ` Pascal Obry
2005-06-05 1:24 ` David C. Hoos, Sr.
2005-06-05 5:03 ` 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