comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Problems converting Float to Integer efficiently
Date: Fri, 17 Oct 2003 15:57:32 -0500
Date: 2003-10-17T15:57:32-05:00	[thread overview]
Message-ID: <vp0lpchagm7ue2@corp.supernews.com> (raw)
In-Reply-To: Ku4hb.8589$RU4.82535@newsfep4-glfd.server.ntli.net

"Dr. Adrian Wrigley" <amtw@linuxchip.demon.co.uk.uk.uk> wrote in message
news:Ku4hb.8589$RU4.82535@newsfep4-glfd.server.ntli.net...
> It's a bit disappointing that the compiler does not produce code like this
for
> some "obvious" source code.  I dislike Ada's default of rounding to
nearest, and
> it seems that a series of Float=>Integer attributes might help the
compiler.

Not really, and they would be messy to define. When we discussed this in the
ARG, we concluded that compilers ought to recognize the pattern
Integer(Float'Truncation(Foo)), etc. if that will generate better code (it
usually will). In particular, the code needed to round the float as part of
the conversion to Integer should be omitted (it is already an integer
value). That actually will be in the AARM as a note to implementors (see
AI-267).

So, if you are not getting good code from this, you should complain to your
implementor. This is not a language issue, just a quality of implementation
one.

                 Randy.








  parent reply	other threads:[~2003-10-17 20:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-09  0:06 Problems converting Float to Integer efficiently Dr. Adrian Wrigley
2003-10-09  1:08 ` Jeffrey Carter
2003-10-09  2:36 ` Jeff C,
2003-10-09  3:21   ` Dr. Adrian Wrigley
2003-10-09  3:36     ` Jeff C,
2003-10-17 20:57     ` Randy Brukardt [this message]
2003-10-09 22:36   ` Dr. Adrian Wrigley
2003-10-10  2:05     ` Jeff C,
2003-10-10 17:15     ` Robert I. Eachus
2003-10-11  1:47     ` Waldek Hebisch
2003-10-09  7:10 ` Robert I. 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