comp.lang.ada
 help / color / mirror / Atom feed
From: stefan-lucks@see-the.signature
Subject: Re: Question on types conversions - operations
Date: Mon, 15 Jun 2009 11:51:24 +0200
Date: 2009-06-15T11:51:24+02:00	[thread overview]
Message-ID: <Pine.LNX.4.64.0906151145430.24989@medsec1.medien.uni-weimar.de> (raw)
In-Reply-To: <4a3614a9$0$2855$ba620e4c@news.skynet.be>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 978 bytes --]


> Jean-Pierre Rosen wrote:
> > sjw a �crit :
> > > > With S := Speed(Float(L) / Float(T)) ? Mmmm ... not nice.

> > Why not nice? 
[...]

> I thought it was not nice, because if I change the three types
>  Length, Time and Speed from Float to My_Float, then I have to modify:
> S := Speed(My_Float(L) / My_Float(T))

Indeed! Better, you start with My_Float at the beginning

    type My_Float is new Float; -- change this, if you need
    type Length is new My_Float;
    type Time   is new My_Float;
    type Speed  is new My_Float;

and later write 

    S := Speed(My_Float(L) / My_Float(T));

This is logically the same as before, but you can change the definition of 
My_Float to whatever kind of floating-point operation you like ... 

So long

Stefan







-- 
------ Stefan Lucks   --  Bauhaus-University Weimar  --   Germany  ------
               Stefan dot Lucks at uni minus weimar dot de
------  I  love  the  taste  of  Cryptanalysis  in  the  morning!  ------

  reply	other threads:[~2009-06-15  9:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-13 15:51 Question on types conversions - operations Olivier Scalbert
2009-06-13 16:13 ` Robert Matthews
2009-06-13 16:55 ` anon
2009-06-13 16:58 ` Dmitry A. Kazakov
2009-06-13 16:59 ` sjw
2009-06-13 17:24   ` Martin
2009-06-13 19:35     ` sjw
2009-06-14  8:22     ` sjw
2009-06-15  8:40   ` Jean-Pierre Rosen
2009-06-15  9:30     ` Olivier Scalbert
2009-06-15  9:51       ` stefan-lucks [this message]
2009-06-15 10:33     ` AdaMagica
2009-06-15 19:37     ` sjw
2009-06-13 19:56 ` Jeffrey R. Carter
2009-06-14 15:55   ` Robert A Duff
2009-06-15  8:52 ` AdaMagica
replies disabled

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