From: azimmer@rsa.hisd.harris.com (Alan D Zimmerman)
Subject: Re: Rational/Verdix Number Bug
Date: 2 Mar 1995 13:49:51 GMT
Date: 1995-03-02T13:49:51+00:00 [thread overview]
Message-ID: <3j4idv$14u@jabba.ess.harris.com> (raw)
In-Reply-To: Mats.Weber-2702951928090001@mlma11.matrix.ch
In article <Mats.Weber-2702951928090001@mlma11.matrix.ch>, Mats.Weber@matrix.ch (Mats Weber) writes:
> In article <3il66m$ps1@jabba.ess.harris.com>, azimmer@rsa.hisd.harris.com wrote:
>
> > Well, I am in a perplexing situation. I tried this when I first heard
> > about the problem and duplicated it with a program like the one attached.
> > I just tried it and I could not duplicate it. I am running SunAda 1.1(j)
> > on a SPARC LX. Below is the test program.
> >
> > with text_io;
> > procedure test_float is
> > test : float := 2147.486348;
> > package flt_io is new text_io.float_io(float);
> > begin
> > flt_io.put(test);
> > text_io.new_line;
> > flt_io.put(test * 2.0);
> > text_io.new_line;
> > flt_io.put(test / 2.0);
> > end test_float;
>
> Here, except in the implicit converion of the literal 2147.486348 from
> universal_real to float, you only use floating point arithmetic (the basic
> operations of the predefined type float), not the compiler's internal
> infinite precision arithmetic, which is where the bug is from my
> understanding of the problem.
No, actually the problem is that I reversed the 3 and the six. With the
following program, I get the proper (incorrect) results:
Program:
with text_io;
procedure test_float is
test : float := 2147.483648;
package flt_io is new text_io.float_io(float);
begin
flt_io.put(test);
text_io.new_line;
flt_io.put(test * 2.0);
text_io.new_line;
flt_io.put(test / 2.0);
end test_float;
Results:
-2.14748364800000E+03
-4.29496729600000E+03
-1.07374182400000E+03
For what it is worth, I have been told that rational knows about this
and that a patch is available. Thanks to Richard Hash of Team-Ada
who pointed out my problem.
Alan
--
| Alan D. Zimmerman | Eagle Scout |
| azimmer@rsa.hisd.harris.com | Scoutmaster T324 |
|-------------------------------------------------------------------|
| All opinions are solely my own and do not represent Loral |
| On My Honor I will do my best... |
prev parent reply other threads:[~1995-03-02 13:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <3i0nip$b55@rational.rational.com>
1995-02-24 17:49 ` Rational/Verdix Number Bug Alan D Zimmerman
1995-02-27 18:28 ` Mats Weber
1995-03-01 18:21 ` Kent Mitchell
1995-03-02 13:49 ` Alan D Zimmerman [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox