comp.lang.ada
 help / color / mirror / Atom feed
From: "Norman H. Cohen" <ncohen@watson.ibm.com>
Subject: Re: Red-faced professor gets bitten in search for portability
Date: Tue, 19 Nov 91 10:06:01 EST	[thread overview]
Message-ID: <9111191534.AA20295@ajpo.sei.cmu.edu> (raw)

In article <1991Nov15.185959.5002@milton.u.washington.edu>
mfeldman@milton.u.washington.edu (Michael Feldman) describes the
difficulty in implementing a portable Trunc function in Ada.  He shows
a solution involing integer division and writes that this solution

>                                                ... seems like a
>kludgy way to do a simple truncation. I think this is an example of
>an operation that's much more easily done as an intrinsic than as
>a programmer-defined function.
>
>Any thoughts in net-land?

This is one of the primitive functions that the Numerics Rapporteur
Group of ISO-IEC/JTC1/SC22/WG9 is now working on, with the goal of
establishing an ISO standard Generic Primitive Functions package.
(Do not confuse this with the Generic Elementary Functions package,
which has, if I recall correctly, already been submitted to SC22 as a
draft standard.  The primitive functions are operations like truncation,
determining the exponent of a floating-point number, determining the
mantissa of a floating-point number, and so forth.  They are most
straightforwardly implemented by dealing directly with the target
machine's floating-point representation, so compilers are likely to
treat these functions as intrinsics, replacing calls to them with
inline code.  The elementary functions are higher-level operations like
the trig functions, logarithms, and square root, which can be implemented
portably in terms of the elementary functions.)

 > By the way - I am all the more red-faced because I let the dangerous
 > Trunc monster loose into a textbook. 'Course, I haven't run into
 > another Ada text that even discusses the question...

Don't lose sleep over it! I presume (pray) that no safety-critical
application will incorporate an algorithm from any textbook without
further careful scrutiny.  Compared to the flub in Dr. Ruth's book
(incorrectly describing the time of the month at which a woman can
conceive as the time at which the risk of pregnancy is LOWEST), this is
no big deal.

Norman H. Cohen

             reply	other threads:[~1991-11-19 15:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1991-11-19 15:06 Norman H. Cohen [this message]
  -- strict thread matches above, loose matches on Subject: below --
1991-11-25  6:09 Red-faced professor gets bitten in search for portability csus.edu!wupost!spool.mu.edu!munnari.oz.au!metro!cluster!swift!sunaus!ass
1991-11-22 22:16 Dik T. Winter
1991-11-22 22:11 Dik T. Winter
1991-11-22 21:10 Jonathan Parker
1991-11-22 15:24 The Sunset Kid
1991-11-22 14:06 psinntp!vitro.com!v7.vitro.com!vaxs09
1991-11-22  2:29 micro-heart-of-gold.mit.edu!wupost!zaphod.mps.ohio-state.edu!uakari.prima
1991-11-20 23:59 micro-heart-of-gold.mit.edu!wupost!sdd.hp.com!uakari.primate.wisc.edu!use
1991-11-20  2:55 csus.edu!wupost!cs.utexas.edu!sun-barr!cronkite.Central.Sun.COM!newstop!s
1991-11-16  0:01 Michael Feldman
1991-11-15 20:58 Mike Murphy
1991-11-15 18:59 Michael Feldman
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox