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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ac48cedaf5c5cba3 X-Google-Attributes: gid103376,public From: eachus@roadkill.mitre.org (Robert I. Eachus) Subject: Re: Integer truncation and other recipes Date: 1996/06/05 Message-ID: #1/1 X-Deja-AN: 158678954 distribution: world references: <4nv3tmINNql5@oasys.dt.navy.mil> organization: The Mitre Corp., Bedford, MA. newsgroups: comp.lang.ada Date: 1996-06-05T00:00:00+00:00 List-Id: In article <4p4atg$tc5@watnews1.watson.ibm.com> ncohen@watson.ibm.com (Norman H. Cohen) writes: > Not a very satisfying answer. Suppose you want to delay until the next > time the minute hand sweeps past the 12. It would be nice to be able to > write... > Duration(Float'Floor(Float(Now)/60.0)) is a poor substitute for > Duration'Floor(Now/60.0). > I think the failure to generalize certain of the floating-point > attributes to fixed-point types was an unfortunate oversight. Agreed. In fact on some implementations: 60.0 * Duration(Integer(Now/Duration'SMALL)/ (60*Integer(1.0/Duration'SMALL))) Is the only reasonable way to do this due to accuracy issues. However, that approach depends on (in Ada 83) the UI which says that 1.0 is a model number of Duration. If fact I have had to replace the divisions by Duration'SMALL by Unchecked_Conversion with some compilers that simply do not recognize this idiom. (The problem is not that they do a divide, it's that they do a divide which overflows...) -- Robert I. Eachus with Standard_Disclaimer; use Standard_Disclaimer; function Message (Text: in Clever_Ideas) return Better_Ideas is...