From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,96daa6f775bc14b9 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-07-03 22:30:29 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!195.54.122.107!newsfeed1.bredband.com!bredband!newsfeed1.telenordia.se!algonet!newsfeed1.funet.fi!newsfeeds.funet.fi!nntp.inet.fi!central.inet.fi!inet.fi!read2.inet.fi.POSTED!not-for-mail From: "Anders Wirzenius" Newsgroups: comp.lang.ada References: Subject: Re: Generics??? X-Newsreader: Microsoft Outlook Express 4.72.3110.5 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Message-ID: Date: Wed, 04 Jul 2001 05:30:29 GMT NNTP-Posting-Host: 194.251.142.2 X-Trace: read2.inet.fi 994224629 194.251.142.2 (Wed, 04 Jul 2001 08:30:29 EET DST) NNTP-Posting-Date: Wed, 04 Jul 2001 08:30:29 EET DST Organization: Sonera corp Internet services Xref: archiver1.google.com comp.lang.ada:9411 Date: 2001-07-04T05:30:29+00:00 List-Id: 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