From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.acm.org>
Subject: Re: Truncating a fixed-point value
Date: Fri, 09 Jul 2010 14:20:01 -0700
Date: 2010-07-09T14:20:01-07:00 [thread overview]
Message-ID: <i1843k$aql$1@tornado.tornevall.net> (raw)
In-Reply-To: <f7b0cc71-bf8c-48bb-b651-b32b30ae3d4a@y11g2000yqm.googlegroups.com>
On 07/09/2010 01:39 PM, Gene wrote:
>
> An ugly approach is to convert to e.g. a long float, take the floor,
> and convert back. No doubt others will have something more elegant.
That's the approach I use, though, in the interest of portability, I declare my
own floating-point type for the purpose:
function Floor (Value : in Fixed) return Integer is
type Big is digits System.Max_Digits;
begin -- Floor
return Integer (Big'Floor (Big (Value) ) );
end Floor;
--
Jeff Carter
"It's symbolic of his struggle against reality."
Monty Python's Life of Brian
78
next prev parent reply other threads:[~2010-07-09 21:20 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-09 19:06 Truncating a fixed-point value Adam Beneschan
2010-07-09 20:34 ` Simon Wright
2010-07-09 23:21 ` Adam Beneschan
2010-07-10 3:13 ` Gene
2010-07-11 19:43 ` Gene
2010-07-10 8:12 ` Simon Wright
2010-07-09 20:39 ` Gene
2010-07-09 21:20 ` Jeffrey R. Carter [this message]
2010-07-09 21:52 ` Adam Beneschan
2010-07-13 11:26 ` Jacob Sparre Andersen
2010-07-09 22:58 ` Shark8
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox