comp.lang.ada
 help / color / mirror / Atom feed
From: ica2ph@alpha1.csv.ica.uni-stuttgart.de (Peter Hermann)
Subject: Re: Help: Truncating Decimal Types
Date: 1998/01/02
Date: 1998-01-02T00:00:00+00:00	[thread overview]
Message-ID: <68iaav$rbi@info4.rus.uni-stuttgart.de> (raw)
In-Reply-To: dewar.883516681@merv


Robert Dewar (dewar@merv.cs.nyu.edu) wrote:
> John asks

> <<Does anyone have an easy way to extract the integer portion of a decimal
> number - short of writing a function? Seems Ada should allow this (and
> other attributes) for fixed and decimal types, but it doesn't without
> first converting the value to decimal.
> >>

> 	
> This is trivial, just convert it to a decimal type whose delta is 1.0.
> The default for such conversions is truncation. 

This is indeed new to me. It seems I have to change my mind.
I always thought that the Ada rule is most easily rememberable
in that 
   -- conversions will round,
   -- integer divisions will truncate.

puzzled

--
Peter Hermann  Tel:+49-711-685-3611 Fax:3758 ph@csv.ica.uni-stuttgart.de
Pfaffenwaldring 27, 70569 Stuttgart Uni Computeranwendungen
Team Ada: "C'mon people let the world begin" (Paul McCartney)




  reply	other threads:[~1998-01-02  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-12-30  0:00 Help: Truncating Decimal Types John J. Cupak Jr.
1997-12-30  0:00 ` Robert Dewar
1998-01-02  0:00   ` Peter Hermann [this message]
1998-01-02  0:00     ` Robert Dewar
replies disabled

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