Thread View: comp.sys.transputer
2 messages
2 total messages
Started by Zafar Ullah Choudhry
Thu, 25 Apr 1991 06:00
Improper results on T800
Author: Zafar Ullah Choudhry
Date: Thu, 25 Apr 1991 06:00
Date: Thu, 25 Apr 1991 06:00
57 lines
2517 bytes
2517 bytes
/* Hi Xputer Users! I have a small program which I am trying to run on
T800 processor. If this program is compiled for T400 processor, i.e.,
math functions are emulated, you get the proper results. However, if
you compile it for T800, the results become zero. In both the cases
the program is executed on T800. I have tried Logical C and 3L
compilers, both give the same results. The problem is actually with
improper rounding off. I know one way of fixing the problem but I want
to get the opinion from other users. Also, this problem shows up in the
form of inaccurate results in some other types of data. Please inform
me about your if you get a chance to try this tiny program on your
system.
THE PROGRAM PRINTS BOTH THE REQUIRED AND CALCULATED RESULTS.
Thanks.
Zafar Ullah Choudhry
Email: choudhry@bagend.eng.umd.edu
University of Maryland, College
Park, USA.
*/
/* ***** Header include files. ***** */
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
main ()
{
int nsite;
float we, weneg, freea[10], free_l[20], yin[12], xdin[10];
float xin[10], xdpn[10], freadp[10], clongp[10], ydin[10];
/* initialize the constants and variables */
we = 7.29211508E-5; /* Earth sidereal rotation rate. */
weneg = -7.29211508E-5; /* Negative rotation rate. */
nsite = 0;
freea[8] = 0.250648; yin[nsite] = -16018765.0000;
freea[7] = -0.968078; xdin[nsite]=1168.106812;
/* caculate the result */
free_l[1] = freea[8] * (we * yin[nsite] + xdin[nsite]);
free_l[2] = freea[7] * (we * yin[nsite] + xdin[nsite]);
printf ("The Expected Results:> free_l[1]=%f and free_l[2]=%f\n",
-0.000002, 0.000007);
printf ("The Calculated Values:> free_l[1]=%f and free_l[2]=%f\n",
free_l[1], free_l[2]);
printf ("Done...\n");
exit (0);
}
Re: Improper results on T800 using PASCAL-XSC with better arithmetic
Author: Reinhard Kirchner
Date: Mon, 29 Apr 1991 16:24
Date: Mon, 29 Apr 1991 16:24
135 lines
5615 bytes
5615 bytes
From article <1991Apr25.060030.27603@eng.umd.edu>, by choudhry@eng.umd.edu (Zafar Ullah Choudhry):
I tried to compile the given program with slightly modifications using the
new programming language PASCAL-XSC, available as ShareWare in the newsgroup
comp.binaries.ibm.pc.
The result is as I expected very interesting for all arithmetic testers.
Look at the following source-code for PASCAL-XSC and the results:
--------------------------------------------------------------------------
program txxx ( input,output ) ;
use i_ari ;
(* the datatype interval is predefined in the module i_ari together with *)
(* all used interval operations *)
var we, weneg : interval ;
var freea8,freea7, xdin : interval ;
var free_l1, free_l2 : interval ;
var yin : interval ;
var exact_reals : boolean ;
function point ( i : interval ) : boolean ;
(* this function decides, if an interval has equal boundaries and is *)
(* therefore a so called point interval *)
begin
point := inf(i) = sup(i) ;
end ;
begin
(* read in the values for we, weneg, freea8, freea7, yin and xdin *)
writeln ( 'please enter :' ) ;
write ( 'we :' ) ; read ( we ) ;
write ( 'weneg :' ) ; read ( weneg ) ;
write ( 'freea8 : ' ) ; read ( freea8 ) ;
write ( 'freea7 : ' ) ; read ( freea7 ) ;
write ( 'yin : ' ) ; read ( yin ) ;
write ( 'xdin : ' ) ; read ( xdin ) ;
exact_reals := point (we) and point (freea8) and point (freea7)
and point (yin) and point (xdin) ;
if not exact_reals then
begin
writeln ( 'Caution!!!!!!!!!' ) ;
writeln ( 'input data not exactly representable using decimal to ' ) ;
writeln ( 'IEEE binary double conversion' ) ;
writeln ( 'The values read in are in the following ranges :' ) ;
writeln ( 'we : ',we ) ;
writeln ( 'weneg : ',weneg ) ;
writeln ( 'freea8 : ',freea8 ) ;
writeln ( 'freea7 : ',freea7 ) ;
writeln ( 'yin : ',yin ) ;
writeln ( 'xdin : ',xdin ) ;
end ;
(* caculate the result using naive interval arithmetic*)
free_l1 := freea8 * (we * yin + xdin);
free_l2 := freea7 * (we * yin + xdin);
writeln('The Expected Results: ') ;
writeln('free_l[1]=',-0.000002,' and free_l[2]=',0.000007) ;
writeln('Note: These results are expected, but I don''t know why !!!' );
writeln(' These results are completely wrong!!!' ) ;
writeln ;
writeln('The exact and enclosed calculated results corresponding to the') ;
writeln('input data displayed above are :' ) ;
writeln('free_l[1]=',free_l1) ;
writeln('free_l[2]=',free_l2) ;
writeln ;
writeln('Note: The used data here are intervals, which do contain' ) ;
writeln(' the specified constants of the original program' ) ;
writeln(' Thus, the resulting intervals do contain the' ) ;
writeln(' exact result of the original input constants!' ) ;
writeln('Done...');
end.
---------------------------------------------------------------------
These are the input data:
3
7.29211508e-5
-7.29211508e-5
0.250648
-0.968078
-16018765.0
1168.106812
----------------------------------------------------------------------
This is the output of the program:
please enter :
we :weneg :freea8 : freea7 : yin : xdin : Caution!!!!!!!!!
input data not exactly representable using decimal to
IEEE binary double conversion
The values read in are in the following ranges :
we : [ 7.292115079999999E-005, 7.292115080000002E-005]
weneg : [ -7.292115080000002E-005, -7.292115079999999E-005]
freea8 : [ 2.506479999999999E-001, 2.506480000000001E-001]
freea7 : [ -9.680780000000002E-001, -9.680779999999999E-001]
yin : [ -1.601876500000000E+007, -1.601876500000000E+007]
xdin : [ 1.168106811999999E+003, 1.168106812000001E+003]
The Expected Results:
free_l[1]=-2.000000000000000E-006 and free_l[2]= 7.000000000000000E-006
Note: These results are expected, but I don't know why !!!
These results are completely wrong!!!
The exact and enclosed calculated results corresponding to the
input data displayed above are :
free_l[1]=[ 8.473215234786038E-006, 8.473215405758313E-006]
free_l[2]=[ -3.272610762334308E-005, -3.272610696299670E-005]
Note: The used data here are intervals, which do contain
the specified constants of the original program
Thus, the resulting intervals do contain the
exact result of the original input constants!
Done...
---------------------------------------------------------------------
The underlying PASCAL-XSC is available for the most of tested machines,
such as T800 machines, SUN workstations and IBM/PC's etc.
Please contact us :
Numerik Software GmbH
Dr. Michael Neaga
Rettigstr. 6
W-7570 Baden-Baden
e-mail: ae18@dkauni2.bitnet
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads