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,b61052ba3fdc8c26 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-11-05 20:28:42 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newshub.northeast.verio.net!verio!newsfeed.mathworks.com!wn3feed!worldnet.att.net!135.173.83.71!wnfilter1!worldnet-localpost!bgtnsc05-news.ops.worldnet.att.net.POSTED!not-for-mail Message-ID: <3BE766F6.3D014CD8@worldnet.att.net> From: James Rogers X-Mailer: Mozilla 4.76 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Integers and Mathematical Correctness References: <1f26o22.1xfvwvo111pfi4N%csampson@inetworld.net> <9rrsou$bl1$1@nh.pace.co.uk> <3BE4232D.6CC9ACA3@adaworks.com> <9s68pu$9j5$1@nh.pace.co.uk> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Tue, 06 Nov 2001 04:28:41 GMT NNTP-Posting-Host: 12.86.33.91 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc05-news.ops.worldnet.att.net 1005020921 12.86.33.91 (Tue, 06 Nov 2001 04:28:41 GMT) NNTP-Posting-Date: Tue, 06 Nov 2001 04:28:41 GMT Organization: AT&T Worldnet Xref: archiver1.google.com comp.lang.ada:15898 Date: 2001-11-06T04:28:41+00:00 List-Id: "Eric G. Miller" wrote: > > #include > #include > #include > > In C: sizeof float <= sizeof double <= sizeof long double > > It's all there. Granted, there are a few things where there's no analog > in C that you'd have to code/check yourself (limited ranges, fixed > precision). The include files listed above declare constants for various values, such as FLT_MAX. In one sense they are like 'First and 'Last in that they identify value boundaries. Unfortunately, these values in C are not as useful as their Ada counterparts. Take the following C snippet: float f = FLT_MAX; double d = 2; f *= d; What will the result of this be? There is no error issued either at compile or run time. The value output by printf using a gcc compiler is "1.#INF". Note that C does a number of implicit conversions for the above code. The integer 2 is implicitly converted to a double 2.0. The calculation "f *= d" implicitly converts f to a double on the right hand side, performs the calculation, then implicitly converts the result back to a double. Note that this error would have been caught by an Ada compiler. C never notices the problem at all. Jim Rogers Colorado Springs, Colorado USA