comp.lang.ada
 help / color / mirror / Atom feed
* TRUNCATE a FLOAT  [ 3,45 ]  ->  [ 3 ]
@ 2000-02-06  0:00 helder da silva
  2000-02-06  0:00 ` Jeff Carter
  2000-02-06  0:00 ` David C. Hoos, Sr.
  0 siblings, 2 replies; 4+ messages in thread
From: helder da silva @ 2000-02-06  0:00 UTC (permalink / raw)


Anyone remembers how to truncate the first part of a float number :

FROM ( float ) :  3,45

TO ( integer )  :  3

I've got a blank on this one !

Thanks.






^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: TRUNCATE a FLOAT  [ 3,45 ]  ->  [ 3 ]
  2000-02-06  0:00 TRUNCATE a FLOAT [ 3,45 ] -> [ 3 ] helder da silva
@ 2000-02-06  0:00 ` Jeff Carter
  2000-02-06  0:00   ` helder da silva
  2000-02-06  0:00 ` David C. Hoos, Sr.
  1 sibling, 1 reply; 4+ messages in thread
From: Jeff Carter @ 2000-02-06  0:00 UTC (permalink / raw)


helder da silva wrote:
> 
> Anyone remembers how to truncate the first part of a float number :
> 
> FROM ( float ) :  3,45
> 
> TO ( integer )  :  3
> 
> I've got a blank on this one !
> 
> Thanks.

This must be a FAQ; we just had a thread on floating-point attributes.

Check out your ARM Annex K for the attribute 'Truncation. While you're
there, look at 'Floor and 'Ceiling, too.

Integer (Float'Trucation (3.45) ) = 3
-- 
Jeff Carter
"Hello! Smelly English K...niggets."
Monty Python & the Holy Grail




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: TRUNCATE a FLOAT  [ 3,45 ]  ->  [ 3 ]
  2000-02-06  0:00 TRUNCATE a FLOAT [ 3,45 ] -> [ 3 ] helder da silva
  2000-02-06  0:00 ` Jeff Carter
@ 2000-02-06  0:00 ` David C. Hoos, Sr.
  1 sibling, 0 replies; 4+ messages in thread
From: David C. Hoos, Sr. @ 2000-02-06  0:00 UTC (permalink / raw)



helder da silva <pc-tech@bluewin.ch> wrote in message
news:87ich2$pmk$1@bw107zhb.bluewin.ch...
> Anyone remembers how to truncate the first part of a float number :
>
> FROM ( float ) :  3,45
>
> TO ( integer )  :  3
>
> I've got a blank on this one !
>
> Thanks.
>
given the declarations

X : Float;
Y : Integer;

you can write

Y := Integer (Float'Floor (X));






^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: TRUNCATE a FLOAT  [ 3,45 ]  ->  [ 3 ]
  2000-02-06  0:00 ` Jeff Carter
@ 2000-02-06  0:00   ` helder da silva
  0 siblings, 0 replies; 4+ messages in thread
From: helder da silva @ 2000-02-06  0:00 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 690 bytes --]

Thanks,
that was real quick responding.

Jeff Carter <jrcarter010@earthlink.net> a �crit dans le message :
389CAE9E.19D5066F@earthlink.net...
> helder da silva wrote:
> >
> > Anyone remembers how to truncate the first part of a float number :
> >
> > FROM ( float ) :  3,45
> >
> > TO ( integer )  :  3
> >
> > I've got a blank on this one !
> >
> > Thanks.
>
> This must be a FAQ; we just had a thread on floating-point attributes.
>
> Check out your ARM Annex K for the attribute 'Truncation. While you're
> there, look at 'Floor and 'Ceiling, too.
>
> Integer (Float'Trucation (3.45) ) = 3
> --
> Jeff Carter
> "Hello! Smelly English K...niggets."
> Monty Python & the Holy Grail






^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2000-02-06  0:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-02-06  0:00 TRUNCATE a FLOAT [ 3,45 ] -> [ 3 ] helder da silva
2000-02-06  0:00 ` Jeff Carter
2000-02-06  0:00   ` helder da silva
2000-02-06  0:00 ` David C. Hoos, Sr.

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