From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 102b75,45b50f14dadfce5b X-Google-Attributes: gid102b75,public X-Google-Thread: 110292,45b50f14dadfce5b X-Google-Attributes: gid110292,public X-Google-Thread: 1164f8,45b50f14dadfce5b X-Google-Attributes: gid1164f8,public From: pmontgom@cwi.nl (Peter L. Montgomery) Subject: Re: Final kick at the "Merced Guessing Game" Date: 1997/10/18 Message-ID: #1/1 X-Deja-AN: 281403802 Sender: news@cwi.nl (The Daily Dross) References: Organization: CWI, Amsterdam Newsgroups: comp.sys.intel,comp.arch,comp.sys.dec In article Craig Burley writes: >I don't see any rebuttal there. Care to explain what *low-level* >constructs C is offering that Fortran doesn't offer, aside from >pointers? Nobody has been mentioning unsigned arithmetic. In many implementations of Fortran (and C), signed and unsigned additions and subtractions behave identically, but C _guarantees_ what the result will be if it overflows, which Fortran does not. C has conditional compilation, which Fortran does not. Fortran leads C in its large intrinsic function library. C9X will finally let one write a MAX function which evaluates its arguments once only and use the INLINE keyword to get good code, but the user will need to call different functions depending upon the argument types (cf. labs/abs/fabs in C vs. ABS in Fortran). Neither language has constructs for the following operations (although some implementations make them available): . Trailing zero count of nonzero binary number (equal to highest power of 2 dividing the number) . Truncated base-2 logarithm of nonnegative integer, with LOG2(0) = -1. [Or return the number of bits required to hold the value, which is one more than its logarithm.] . Population count of nonnegative integer. . Upper half of (signed or unsigned) integer product. . Greatest common divisor (GCD) of two integers. . Floating point operations with explicit rounding, such as ROUND_DOWN(a - ROUND_ZERO(b*c)) to round the product b*c towards zero and round the difference a - b*c towards -infinity. All of these, except the GCD, have simple translations on the latest DEC Alpha. They have mathematical definitions which do not refer to the target architecture, except that we need the number of bits per datum to define the upper half of an integer product. The optimal translations vary widely with the target architecture, and the first three constructs have been discussed many times in this newsgroup, yet the language designers decline to standardize the constructs. -- Peter L. Montgomery pmontgom@cwi.nl San Rafael, California A mathematician whose age has doubled since he last drove an automobile.