comp.lang.ada
 help / color / mirror / Atom feed
From: "Anders Wirzenius" <anders.wirzenius@pp.qnet.fi>
Subject: Re: Generics???
Date: Wed, 04 Jul 2001 05:30:29 GMT
Date: 2001-07-04T05:30:29+00:00	[thread overview]
Message-ID: <VRx07.7$Xt3.678@read2.inet.fi> (raw)
In-Reply-To: ZLo07.148917$%i7.100501697@news1.rdc1.sfba.home.com


tmoran@acm.org wrote in message ...
>>Suppose I use the example provided by Frank Beard and want to round up the
>>result when the type is an integer.
>>How do I test which type the parameter (in the example: Item) is?
>>Something like the pseudocode:
>>
>>   function Divide (the_Left  : Item;
>>                    the_Right : Item) return Item is
>  If you are passing in the operations as generic parameters, you will
>have passed in a "/", either an integer one that does rounding, or a
>floating point one that doesn't.  If you want a special "rounded_divide"
>operation, you'll pass one in and the floating point one will not
>actually do any rounding.
>  If someone calls your package asking for integer arithmetic, doesn't
>that indicate they don't care too much about accuracy in things like
>a divide, anyway?

Maybe they don't care. My question was about the testing and the example was
just an (academic) example.
Thanks anyway.

Anders





  reply	other threads:[~2001-07-04  5:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-02 18:42 Generics??? Beard, Frank
2001-07-03 10:32 ` Generics??? Anders Wirzenius
2001-07-03 17:31   ` Generics??? Stephen Leake
2001-07-03 19:09   ` Generics??? tmoran
2001-07-04  5:30     ` Anders Wirzenius [this message]
  -- strict thread matches above, loose matches on Subject: below --
2001-07-02 22:33 Generics??? Michael Andersson
2001-07-02 17:48 ` Generics??? James Rogers
2001-07-02 18:54   ` Generics??? Ehud Lamm
1992-09-14 15:00 Generics? cis.ohio-state.edu!zaphod.mps.ohio-state.edu!darwin.sura.net!jvnc.net!net
1992-09-09  5:26 Generics? Andrew Dunstan
1992-09-09  1:34 Generics?  Rob Allen
replies disabled

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