comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@acm.org
Subject: Re: Decimal number of interger?
Date: Wed, 24 Oct 2001 19:54:18 GMT
Date: 2001-10-24T19:54:18+00:00	[thread overview]
Message-ID: <K%EB7.65302$gT6.33413933@news1.rdc1.sfba.home.com> (raw)
In-Reply-To: 3BD70DE5.C2D2B6FD@ida.his.se

>How do I determine weather the result from a function has a decimal part
>or not?
  x : float := function_value(y);
begin
  if float(integer(x)) = x then -- decimal part of x is zero

>I want to use the log function to se weather the width of the terrain is
>(2^x)+1. In order to do this I want to use the following:
>log2(width-1) = "float without decimal part"
  test : interfaces.unsigned_32 := interfaces.unsigned_32(width-1);
begin
  if (test and (test-1)) = 0 then -- test (ie, width-1) is a power of 2.



  reply	other threads:[~2001-10-24 19:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-24 17:46 Decimal number of interger? a98mican
2001-10-24 19:54 ` tmoran [this message]
2001-10-24 23:35   ` Jeffrey Carter
2001-10-25  1:38 ` DuckE
2001-10-29 15:36 ` Tucker Taft
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox