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 12:09:48 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!headwall.stanford.edu!feeder.via.net!newshub2.rdc1.sfba.home.com!news.home.com!news1.rdc1.sfba.home.com.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: Generics??? References: X-Newsreader: Tom's custom newsreader Message-ID: Date: Tue, 03 Jul 2001 19:09:45 GMT NNTP-Posting-Host: 24.7.82.199 X-Complaints-To: abuse@home.net X-Trace: news1.rdc1.sfba.home.com 994187385 24.7.82.199 (Tue, 03 Jul 2001 12:09:45 PDT) NNTP-Posting-Date: Tue, 03 Jul 2001 12:09:45 PDT Organization: Excite@Home - The Leader in Broadband http://home.com/faster Xref: archiver1.google.com comp.lang.ada:9393 Date: 2001-07-03T19:09:45+00:00 List-Id: >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?