comp.lang.ada
 help / color / mirror / Atom feed
From: stt@houdini.camb.inmet.com (Tucker Taft)
Subject: Re: Fixed point multiplication ambiguity
Date: 1999/01/29
Date: 1999-01-29T00:00:00+00:00	[thread overview]
Message-ID: <F6AwFx.76y.0.-s@inmet.camb.inmet.com> (raw)
In-Reply-To: 78r4qh$fcu$1@plug.news.pipex.net

Nick Roberts (Nick.Roberts@dial.pipex.com) wrote:

: |... [ Integer(D*10.0 + 0.5) ] is effectively equivalent to:
: |   Integer(Duration(D*10.0)+Duration(0.5))


: I am not arguing with this, but which rule (or rules) in the RM specify the
: above interpretation, please? I've searched and searched (even the AI95s)!
: (Then again, I reckon my brain must be coming up for it's 20,000 mile
: service anyway ;-)

  RM95 3.4.1(6-7) introduces the universal numeric types.

  RM95 4.2(8) says that a real literal is of type universal-real.

  RM95 4.5.5(18) defines the multiplication operator:

    univ-fixed * univ-fixed => univ-fixed 

  RM95 8.6(21) indicates that any fixed-point type is acceptable
  when the expected type is universal-fixed, as is any universal
  type that "covers" universal-fixed (e.g. universal-real)
  (i.e., any fixed-point type is implicitly convertible to
  universal-fixed, as is universal-real).

  RM95 8.6(24) indicates that universal fixed is acceptable
  when the expected type is any specific fixed-point type 
  (i.e., universal fixed is implicitly convertible to any
  fixed-point type).

  RM95 8.6(28) indicates that if there is exactly one acceptable
  interpretation for a complete context, then that one is chosen.

There is only one directly visible "*" operator which can "accept"
one operand of type Duration (D), and one univeral-real operand (10.0):
univ-fixed * univ-fixed => univ-fixed.

There is also only one directly visible "+" operator which can "accept"
one universal-fixed operand (D*10.0) and one universal-real operand
(the literal 0.5): Duration + Duration => Duration.

Hence, the only acceptable interpretation is the one which
is effectively equivalent to: 

    Integer(Duration(D*10.0) + Duration(0.5))

Q.E.D. (I hope ;-).

: -------------------------------------------
: Nick Roberts
: -------------------------------------------

--
-Tucker Taft   stt@averstar.com   http://www.averstar.com/~stt/
Technical Director, Distributed IT Solutions  (www.averstar.com/tools)
AverStar (formerly Intermetrics, Inc.)   Burlington, MA  USA




  reply	other threads:[~1999-01-29  0:00 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-01-14  0:00 Fixed point multiplication ambiguity Marc A. Criley
1999-01-14  0:00 ` Tom Moran
1999-01-14  0:00 ` Tucker Taft
1999-01-15  0:00   ` robert_dewar
1999-01-28  0:00   ` Nick Roberts
1999-01-28  0:00     ` Tucker Taft
1999-01-28  0:00       ` robert_dewar
1999-01-29  0:00       ` Nick Roberts
1999-01-29  0:00         ` Tucker Taft [this message]
1999-01-29  0:00           ` Nick Roberts
1999-01-29  0:00             ` Tucker Taft
1999-02-01  0:00               ` Robert I. Eachus
1999-02-02  0:00               ` Building a compiler (was: Fixed point multiplication ambiguity) Nick Roberts
1999-02-03  0:00                 ` Chris Morgan
1999-02-04  0:00                   ` robert_dewar
1999-02-04  0:00                     ` Garbage collection - was " news.oxy.com
1999-02-04  0:00                       ` robert_dewar
1999-02-05  0:00                         ` David Botton
1999-02-05  0:00                         ` Tom Moran
1999-02-18  0:00                         ` news.oxy.com
1999-02-18  0:00                           ` AdaHag
1999-02-18  0:00                           ` David Botton
1999-02-18  0:00                           ` dewar
1999-02-18  0:00                           ` Garbage collection - was Re: Building a compiler Samuel Mize
1999-02-19  0:00                             ` Samuel Mize
1999-02-19  0:00                           ` Garbage collection - was Re: Building a compiler (was: Fixed point multiplication ambiguity) Steven Hovater
1999-02-20  0:00                           ` A Modest Defense of ACT (though they are big boys and can take care of themselves) Steve Quinlan
1999-02-21  0:00                             ` dewar
1999-02-22  0:00                               ` Matthew Heaney
1999-02-21  0:00                                 ` bill
1999-02-22  0:00                                   ` Larry Kilgallen
1999-02-22  0:00                                 ` dennison
1999-02-22  0:00                             ` dennison
1999-02-24  0:00                               ` Steve Quinlan
1999-02-25  0:00                                 ` dennison
1999-02-26  0:00                                   ` Steve Quinlan
1999-02-26  0:00                                     ` dennison
1999-02-27  0:00                                       ` Simon Wright
1999-02-27  0:00                                         ` Dave Taylor
1999-02-28  0:00                                       ` dewar
1999-02-25  0:00                                 ` dewar
1999-02-25  0:00                                   ` Steve Quinlan
1999-02-25  0:00                                     ` robert_dewar
1999-02-05  0:00                     ` GC+HC for GNAT/GCC (was: Building a compiler) Nick Roberts
     [not found]                       ` <m33e4jvs1n.fsf@muc.de>
1999-02-06  0:00                         ` GC+FSD for GNAT/GCC Nick Roberts
1999-02-07  0:00                           ` robert_dewar
1999-02-05  0:00                   ` Building a compiler Nick Roberts
1999-02-05  0:00                     ` Tucker Taft
1999-02-06  0:00                       ` Nick Roberts
1999-02-03  0:00                 ` Building a compiler (was: Fixed point multiplication ambiguity) dennison
1999-01-30  0:00             ` Fixed point multiplication ambiguity robert_dewar
1999-02-02  0:00               ` Building a compiler (was: Fixed point multiplication ambiguity) Nick Roberts
1999-02-03  0:00                 ` Tucker Taft
1999-02-03  0:00                 ` robert_dewar
1999-01-28  0:00     ` Fixed point multiplication ambiguity robert_dewar
1999-01-14  0:00 ` Matthew Heaney
1999-01-14  0:00 ` bob
1999-01-14  0:00 ` David C. Hoos, Sr.
1999-01-14  0:00 ` Robert I. Eachus
replies disabled

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