Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Difference in Reginald and Mainframe results for REXX script

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
ashutosh.pr

New User


Joined: 13 Apr 2007
Posts: 36
Location: Pune

PostPosted: Fri Sep 18, 2009 12:28 pm    Post subject: Difference in Reginald and Mainframe results for REXX script
Reply with quote

Hi,
I just encountered this while starting to learn REXX.

I run the same script on the mainframes after putting it in a PDS member and separately in a notepad using Regina interpreter.

The script is:
/* REXX */
A = '125' ; B = '125' ;
NUMERIC FORM SCIENTIFIC
prod = A ** B;
SAY prod;


I get the following results:

Mainframes:
1.29942622E+262

Regina:
1.29942623E+262

Anyone aware of this issue and the probable reason for this?

Thanks,
Ashutosh
Back to top
View user's profile Send private message

mtaylor

Active User


Joined: 20 Feb 2009
Posts: 108
Location: Kansas City

PostPosted: Fri Sep 18, 2009 5:41 pm    Post subject:
Reply with quote

Clearly you're assuming floating point arithmetic is standard across machines and it isn't. So, the same operation does not give the same answer on two different machines and you have no right to expect it to. Adoption of floating point standards has been a contentious issue over the years. Nowadays, IEEE 754 is becoming the defacto 'standard' and it's welcome.
Back to top
View user's profile Send private message
prino

Active Member


Joined: 07 Feb 2009
Posts: 989
Location: Oostende, Belgium

PostPosted: Fri Sep 18, 2009 6:01 pm    Post subject:
Reply with quote

Mainframe is right, Regina is very wrong.

Code:
Expression: 125**125                                               
Result    : 1.299426220705612402316300572585238295973692851047E+262
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7931
Location: Bellevue, IA

PostPosted: Fri Sep 18, 2009 7:32 pm    Post subject:
Reply with quote

Have you ever studied precision and accuracy of numerical computations in any course? If so, you should not be surprised by these results.

A simple test is to set up a COMP-2 field in a COBOL program, set it to 1 and multiply it by each integer from 2 to 30. Repeat the test starting at 30 and going down to 1. You will find the displayed results are not the same even though mathematically the exact same computations are being done.

Mathematics implies, at times, infinite number of digits for numbers. Computers do not handle infinite numbers of digits, so the results returned by a given set of mathematical operations (1) may be affected by the order in which computations are done, and (2) may or may not resemble the mathematical result. This applies even more when dealing with different platforms or even different compilers / interpreters on a single platform.
Back to top
View user's profile Send private message
ashutosh.pr

New User


Joined: 13 Apr 2007
Posts: 36
Location: Pune

PostPosted: Sat Sep 19, 2009 8:00 am    Post subject:
Reply with quote

Thank you all!
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Produce Mainframe Dash Board Reports ... sdcarlson53 All Other Mainframe Topics 2 Thu Jan 05, 2017 11:01 pm
No new posts Difference between TWALENG and TWASIZE Arunkumar Chandrasekaran CICS 3 Tue Jan 03, 2017 12:57 pm
This topic is locked: you cannot edit posts or make replies. Calling REXX code from ISPF panel sanchita dey TSO/ISPF 4 Mon Jan 02, 2017 5:13 pm
No new posts Vision results (also known as DYL-280) CaptBill CA Products 1 Tue Dec 20, 2016 3:35 am
No new posts REXX DB2: Dynamic allocation of DB2.D... BHAS CLIST & REXX 3 Mon Dec 19, 2016 8:26 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us