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

Senior Member


Joined: 07 Feb 2009
Posts: 1018
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: 8055
Location: East Dubuque, Illinois, USA

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
This topic is locked: you cannot edit posts or make replies. Need help on If condition continuatio... ashok_uddaraju CLIST & REXX 4 Fri May 19, 2017 8:55 am
No new posts SNMP trap from Mainframe bipinpeter Compuware & Other Tools 6 Wed Apr 26, 2017 3:05 pm
No new posts Running an REXX EXEC implicitly sho7hills CLIST & REXX 3 Thu Apr 20, 2017 8:14 am
No new posts Need help in REXX CALL program Raje1002 CLIST & REXX 5 Wed Apr 19, 2017 11:18 pm
This topic is locked: you cannot edit posts or make replies. Mainframe Opening in Allianz India- T... Rajesh Gopinathan Mainframe Jobs 0 Wed Apr 19, 2017 11:33 am


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