comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <jrcarter@acm.org>
Subject: Re: Static vs dynamic evaluation anomaly?
Date: Tue, 06 Feb 2007 19:17:01 GMT
Date: 2007-02-06T19:17:01+00:00	[thread overview]
Message-ID: <Mu4yh.335454$FQ1.307816@attbi_s71> (raw)
In-Reply-To: <12shen4qjhv41a7@corp.supernews.com>

Matt Jaffe wrote:
>   A student of mine stumbled over a problem that I can reproduce but 
> can't explain.  It manifests itself in the two different values computed 
> by two almost identical expressions when an integer variable is replaced 
> by an integer literal of the same value.  Here's a sample output:
> 
>     The test pattern, X, is a modulo 2**6 integer = 31 or 2#11111#
> 
>     When J=0, X*2**J = 31 or 2#11111#        but X*2**0 = 31 or 2#11111#
>     When J=1, X*2**J = 62 or 2#111110#       but X*2**1 = 62 or 2#111110#
>     When J=2, X*2**J =124 or 2#1111100#      but X*2**2 = 60 or 2#111100#
>     When J=3, X*2**J =248 or 2#11111000#     but X*2**3 = 56 or 2#111000#
>     When J=4, X*2**J =240 or 2#11110000#     but X*2**4 = 48 or 2#110000#
>     When J=5, X*2**J =224 or 2#11100000#     but X*2**5 = 32 or 2#100000#
> 
> Here are the relevant declarations:
> 
>   type Six_Bits is mod 2**6;
>    package Six_Bit_IO is new Ada.Text_IO.Modular_IO(Six_Bits); use 
> Six_Bit_IO;
>    X : Six_Bits := 31;

I would need to see more to comment, but I suggest you eliminate all use 
clauses and see if that makes a difference.

-- 
Jeff Carter
"Pray that there's intelligent life somewhere up in
space, 'cause there's bugger all down here on earth."
Monty Python's Meaning of Life
61



       reply	other threads:[~2007-02-06 19:17 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <12shen4qjhv41a7@corp.supernews.com>
2007-02-06 19:17 ` Jeffrey R. Carter [this message]
2007-02-06 20:01 ` Static vs dynamic evaluation anomaly? Adam Beneschan
2007-02-06 20:15   ` Ludovic Brenta
2007-02-06 23:38     ` Matt.Jaffe
     [not found]     ` <12sipb529oilnab@corp.supernews.com>
2007-02-07 10:05       ` Ludovic Brenta
2007-02-07 21:54       ` Simon Wright
2007-02-09 12:39         ` GNAT's version Peter Hermann
2007-02-07  3:32   ` Static vs dynamic evaluation anomaly? Steve
2007-02-07 10:00     ` Ludovic Brenta
2007-02-07 10:21       ` Georg Bauhaus
2007-02-07 16:44         ` Adam Beneschan
2007-02-07 18:27           ` Jeffrey R. Carter
2007-02-07 18:55             ` Adam Beneschan
2007-02-07 21:52               ` Simon Wright
2007-02-08  0:48               ` Jeffrey R. Carter
2007-02-08  1:26                 ` Adam Beneschan
2007-02-08 18:44                   ` Jeffrey R. Carter
2007-02-09  7:57                     ` Stefan Lucks
2007-02-09 18:50                       ` Jeffrey R. Carter
2007-02-09 21:12                         ` Stefan Lucks
2007-02-10  5:22                           ` Jeffrey R. Carter
2007-02-10 12:29                             ` Ludovic Brenta
2007-02-08  6:57             ` Matt Jaffe
2007-02-08  9:01               ` Ludovic Brenta
2007-02-08 10:32                 ` Georg Bauhaus
2007-02-08 11:13                 ` Jean-Pierre Rosen
2007-02-08 13:02                   ` Ludovic Brenta
2007-02-07 21:46         ` Matt.Jaffe
2007-02-07  6:24   ` AW: " Grein, Christoph (Fa. ESG)
2007-02-07  6:59     ` Stefan Lucks
replies disabled

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