Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 1049
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: 8154
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
No new posts Difference in SORT & ICETOOL Mohan Kothakota DFSORT/ICETOOL 5 Fri Sep 22, 2017 4:56 pm
No new posts ejck thru rexx to multiple jobs insid... Susanta All Other Mainframe Topics 5 Tue Sep 19, 2017 1:39 pm
This topic is locked: you cannot edit posts or make replies. Extract all "IF" Statements... Adarsh Damodaran CLIST & REXX 1 Wed Sep 06, 2017 9:28 am
No new posts Creating ISPF Screens with Scrname vi... Albireo20 TSO/ISPF 9 Tue Sep 05, 2017 4:24 pm
No new posts How to Run Rexx Macro? Kalaivignesh CLIST & REXX 5 Fri Sep 01, 2017 9:08 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us