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,9c86eb13dd395066 X-Google-Attributes: gid103376,public From: dewar@merv.cs.nyu.edu (Robert Dewar) Subject: Re: CRC in Ada? Date: 1997/03/08 Message-ID: #1/1 X-Deja-AN: 223977391 References: <1997Mar2.220652@nova.wright.edu> <1997Mar5.131846.1@eisner> <5fmo1k$adm@mulga.cs.mu.OZ.AU> <1997Mar6.114441.1@eisner> <1997Mar7.090814.1@eisner> <33206340.2616@bix.com> <1997Mar7.202252.1@eisner> Organization: New York University Newsgroups: comp.lang.ada Date: 1997-03-08T00:00:00+00:00 List-Id: Larry says <> The comparison between C and Ada here is apples-oranges. Text_IO.Get has far more elaborate semantics than getchar, so you cannot compare the two. This is a common effect (see another example below). If you want the simple minded semantics of getchar, then this is trivially programmed in Ada (the GNAT package GNAT.IO is a much closer approximation to the C level semantics). Another interesting case of this is a timing comparison that Bob Klungle sent me comparing the use of the official log and the log in the "secret" package Aux. The log in Aux is a direct call to C, the log in Ada has rather different semantics, as you can see from its coding: function Log (X : Float_Type'Base) return Float_Type'Base is begin if X < 0.0 then raise Argument_Error; elsif X = 0.0 then raise Constraint_Error; elsif X = 1.0 then return 0.0; end if; return Float_Type'Base (Aux.Log (Double (X))); end Log; Those extra tests, required by Ada semantics, end up making the use of the Ada log function very much slower (almost a factor of two in Bob's tests) which is a bit worrisome -- safety and accuracy are not free :-)