From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.acm.org>
Subject: Re: Type casting
Date: Mon, 26 Oct 2009 13:02:40 -0700
Date: 2009-10-26T13:02:40-07:00 [thread overview]
Message-ID: <hc4v92$e36$1@news.tornevall.net> (raw)
In-Reply-To: <1256585214.3272.12.camel@HERMES>
Bruno wrote:
>
> I really do not know how to interpret the operation (E / 2) because
> although the operation is composed of two numbers such as "Positive"
> outcome can be of type "Float" and, of course, the "Integer" (attribute)
> returns an integer but the closest to real number and what
> need my program is that it returns the integer part regardless
> the decimal part.
E is Positive, a subtype of Integer, so the expression "E / 2" is an Integer
expression, and converting it to Integer has no effect. "/" for Integer
truncates towards zero, which seems to be what you want.
The 'Truncation attribute function for floating-point types provides the integer
part.
--
Jeff Carter
"We call your door-opening request a silly thing."
Monty Python & the Holy Grail
17
next prev parent reply other threads:[~2009-10-26 20:02 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-07 12:40 Ada.Directories.Base_Name and dot files
2009-10-07 14:46 ` Yannick Duchêne Hibou57
2009-10-07 17:06 `
2009-10-07 14:52 ` Adam Beneschan
2009-10-07 17:06 `
2009-10-07 15:10 ` Adam Beneschan
2009-10-07 15:37 ` Yannick Duchêne Hibou57
2009-10-11 2:39 ` Randy Brukardt
2009-10-07 20:11 `
2009-10-08 9:39 ` Stephen Leake
2009-10-08 9:58 `
2009-10-26 19:26 ` Type casting Bruno
2009-10-26 20:02 ` Jeffrey R. Carter [this message]
2009-10-26 20:09 ` Adam Beneschan
2009-10-26 19:27 ` Conversions Bruno
2009-10-26 20:09 ` Conversions Jeffrey R. Carter
2009-10-26 20:19 ` Conversions Adam Beneschan
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox