Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Cobol > Re: Decimal ver...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 53 Topic 4077 of 4167
Post > Topic >>

Re: Decimal versus binary arithmetic was Re: J4 - presentation/discussion on "Future of the COBOL Standard"

by Binyamin Dissen <postingid@[EMAIL PROTECTED] > Apr 2, 2008 at 10:18 AM

On Tue, 01 Apr 2008 19:29:05 -0300 Clark F Morris
<cfmpublic@[EMAIL PROTECTED]
>
wrote:

:>On Tue, 1 Apr 2008 13:14:46 -0600, "Frank Swarbrick"
:><Frank.Swarbrick@[EMAIL PROTECTED]
> wrote:

:>>>>> On 4/1/2008 at 12:43 PM, in message
:>><if05v3503beg04nonbeci3n8eqo2vill79@[EMAIL PROTECTED]
>, Clark F
:>>Morris<cfmpublic@[EMAIL PROTECTED]
> wrote:
:>>> On Mon, 31 Mar 2008 22:37:12 -0600, Robert <no@[EMAIL PROTECTED]
> wrote:
 
:>>>>On Mon, 31 Mar 2008 21:55:10 -0300, Clark F Morris 
:>>><cfmpublic@[EMAIL PROTECTED]
> wrote:

:>>>>>On Tue, 18 Mar 2008 19:34:51 -0600, Robert <no@[EMAIL PROTECTED]
> wrote:

:>>>>>>Lots of muddled thinking on numeric errors has been published. Some
talk
:>>> about 'binary
:>>>>>>arithmetic' without making a distinction between integer and
floating 
:>>> point. Here's an
:>>>>>>example:
:>>>>>Try doing a simple divide like calculate the value of 1 / 5 in
binary.

:>>>>OK. 

:>>>>01  numerator value 1 binary pic 9(9).
:>>>>01  denominator value 5 binary pic 9(9).
:>>>>01  quotient binary pic 9(9)v9(4).

:>>>>compute quotient = numerator / denominator
:>>>>display quotient

:>>>>0000000002000

:>>>>>You get a never ending fraction. 

:>>>>Looks pretty diadic to me.
:>>> You may have to do this in Assembler to get the results that I am
:>>> talking about.  Take a look at the generated instructions.  If I had
:>>> access to an IBM mainframe I would compile a small test program to
see
:>>> what the underlying code is.

:>>5820 9510               L    2,1296(0,9)             NUMERATOR         
    
:>>4E20 D1C4               CVD  2,452(0,13)             TS2=4             
    
:>>D203 D1C0 C02A          MVC  448(4,13),42(12)        TS2=0             
    
:>>          SYSLIT AT +42
:>>F060 D1C5 0004          SRP  453(7,13),4(0),0        TS2=5             
    
:>>5820 9518               L    2,1304(0,9)             DENOMINATOR       
    
:>>4E20 D1D0               CVD  2,464(0,13)             TS2=16            
    
:>>FDB4 D1C0 D1D3          DP   448(12,13),467(5,13)    TS2=0             
    
:>>          TS2=19       
:>>F896 D1E0 D1C0          ZAP  480(10,13),448(7,13)    TS2=32            
    
:>>          TS2=0        
:>>960F D1E9               OI   489(13),X'0F'           TS2=41            
    
:>>D202 D1D8 C02A          MVC  472(3,13),42(12)        TS2=24            
    
:>>          SYSLIT AT +42
:>>D204 D1DB D1E5          MVC  475(5,13),485(13)       TS2=27            
    
:>>          TS2=37       
:>>4F20 D1D8               CVB  2,472(0,13)             TS2=24            
    
:>>F144 D1DB D1E0          MVO  475(5,13),480(5,13)     TS2=27            
    
:>>          TS2=32       
:>>4F50 D1D8               CVB  5,472(0,13)             TS2=24            
    
:>>5C40 C004               M    4,4(0,12)               SYSLIT AT +4      
    
:>>1E52                    ALR  5,2                                       
    
:>>58B0 C034               L    11,52(0,12)             PBL=1             
    
:>>47C0 B698               BC   12,1688(0,11)           GN=16(000A70)     
    
:>>5A40 C000               A    4,0(0,12)               SYSLIT AT +0      
    
:>>               GN=16    EQU  *                                         
    
:>>1222                    LTR  2,2                                  
:>>47B0 B6A2               BC   11,1698(0,11)           GN=17(000A7A)
:>>5B40 C000               S    4,0(0,12)               SYSLIT AT +0 
:>>               GN=17    EQU  *                                    
:>>9045 9520               STM  4,5,1312(9)             QUOTIENT     

:>Wow, they are actually doing this in decimal.  I wonder what the code
:>would be like using binary instructions.  I see they are handling the
:>remainder separately.

I would guess the conversions are being done to properly handle the
different
scaling factors, where decimal arithmetic can handle larger precisions
(fullword is limited to 10 digits while packed can hold 15 digits - and
with Z
hardware, the numbers double).

Try them all with the same picture, 9(4)V4(9), which will fit in a word.

--
Binyamin Dissen <bdissen@[EMAIL PROTECTED]
>
http://www.dissensoftware.com

Director, Dissen Software, Bar & Grill - Israel


Should you use the mailblocks package and expect a response from me,
you should preauthorize the dissensoftware.com domain.

I very rarely bother responding to challenge/response systems,
especially those from irresponsible companies.




 53 Posts in Topic:
Re: Decimal versus binary arithmetic was Re: J4 -
"Frank Swarbrick&quo  2008-04-01 13:14:46 
Re: Decimal versus binary arithmetic was Re: J4 - presentation/d
Clark F Morris <cfmpub  2008-04-01 19:29:05 
Re: Decimal versus binary arithmetic was Re: J4 - presentation/d
Binyamin Dissen <posti  2008-04-02 10:18:01 
Re: Decimal versus binary arithmetic was Re: J4 -
Alistair <alistair@[EM  2008-04-05 14:39:44 
Re: Decimal versus binary arithmetic was Re: J4 - presentation/
Robert <no@[EMAIL PROT  2008-04-05 18:46:10 
Re: Decimal versus binary arithmetic was Re: J4 -
Richard <riplin@[EMAIL  2008-04-07 21:53:28 
Re: Decimal versus binary arithmetic was Re: J4 -
Richard <riplin@[EMAIL  2008-04-07 22:09:08 
Re: Decimal versus binary arithmetic was Re: J4 - presentation/
Robert <no@[EMAIL PROT  2008-04-08 22:05:16 
Re: Decimal versus binary arithmetic was Re: J4 - presentation/
"Rick Smith" &l  2008-04-09 10:16:29 
Re: Decimal versus binary arithmetic was Re: J4 -
Richard <riplin@[EMAIL  2008-04-07 22:16:47 
Re: Decimal versus binary arithmetic was Re: J4 - presentation/
Michael Wojcik <mwojci  2008-04-08 16:57:05 
Re: Decimal versus binary arithmetic was Re: J4 -
Richard <riplin@[EMAIL  2008-04-07 22:29:07 
Re: Decimal versus binary arithmetic was Re: J4 - presentation/
Robert <no@[EMAIL PROT  2008-04-08 21:59:07 
Re: Decimal versus binary arithmetic was Re: J4 -
Richard <riplin@[EMAIL  2008-04-07 22:41:07 
Re: Decimal versus binary arithmetic was Re: J4 -
Richard <riplin@[EMAIL  2008-04-07 22:54:32 
Sampling accuracy and everyone being wrong was Re: Decimal vers
Clark F Morris <cfmpub  2008-04-08 10:31:39 
Re: Sampling accuracy and everyone being wrong was Re: Decimal
docdwarf@[EMAIL PROTECTED  2008-04-08 14:48:38 
Re: Decimal versus binary arithmetic was Re: J4 -
Richard <riplin@[EMAIL  2008-04-08 21:41:10 
Re: Decimal versus binary arithmetic was Re: J4 - presentation/
Robert <no@[EMAIL PROT  2008-04-09 19:19:26 
Re: Decimal versus binary arithmetic was Re: J4 -
Richard <riplin@[EMAIL  2008-04-09 18:45:59 
Re: Decimal versus binary arithmetic was Re: J4 -
"Frank Swarbrick&quo  2008-04-03 18:42:16 
Re: Decimal versus binary arithmetic was Re: J4 - presentation/d
Robert <no@[EMAIL PROT  2008-04-04 00:13:23 
Re: Decimal versus binary arithmetic was Re: J4 - presentation/d
"William M. Klein&qu  2008-04-04 05:52:42 
Re: Decimal versus binary arithmetic was Re: J4 - presentation/d
Robert <no@[EMAIL PROT  2008-04-07 22:41:47 
Re: Decimal versus binary arithmetic was Re: J4 - presentation/d
Howard Brazee <howard@  2008-04-04 07:50:39 
Re: Decimal versus binary arithmetic was Re: J4 - presentation/d
Robert <no@[EMAIL PROT  2008-04-04 19:51:24 
Re: Decimal versus binary arithmetic was Re: J4 - presentation/d
docdwarf@[EMAIL PROTECTED  2008-04-05 01:39:33 
Re: Decimal versus binary arithmetic was Re: J4 - presentation/d
Robert <no@[EMAIL PROT  2008-04-04 21:54:44 
Re: Decimal versus binary arithmetic was Re: J4 - presentation/d
docdwarf@[EMAIL PROTECTED  2008-04-06 02:23:46 
Re: Decimal versus binary arithmetic was Re: J4 - presentation/d
Robert <no@[EMAIL PROT  2008-04-07 22:39:38 
Re: Decimal versus binary arithmetic was Re: J4 - presentation/d
Howard Brazee <howard@  2008-04-08 08:47:27 
Re: Decimal versus binary arithmetic was Re: J4 - presentation/d
Robert <no@[EMAIL PROT  2008-04-08 20:39:22 
Re: Decimal versus binary arithmetic was Re: J4 - presentation/d
Howard Brazee <howard@  2008-04-09 07:51:19 
Re: Decimal versus binary arithmetic was Re: J4 - presentation/d
Robert <no@[EMAIL PROT  2008-04-09 20:00:40 
Re: Decimal versus binary arithmetic was Re: J4 - presentation/d
Howard Brazee <howard@  2008-04-10 07:36:17 
Re: Decimal versus binary arithmetic was Re: J4 - presentation/d
Howard Brazee <howard@  2008-04-10 08:53:22 
Re: Decimal versus binary arithmetic was Re: J4 - presentation/d
Howard Brazee <howard@  2008-04-09 07:53:32 
Re: Decimal versus binary arithmetic was Re: J4 - presentation/d
Robert <no@[EMAIL PROT  2008-04-09 19:54:10 
Re: Decimal versus binary arithmetic was Re: J4 - presentation/d
Howard Brazee <howard@  2008-04-07 08:07:32 
Re: Decimal versus binary arithmetic was Re: J4 - presentation/d
"tlmfru" <la  2008-04-05 10:54:00 
Re: Decimal versus binary arithmetic was Re: J4 - presentation/d
Robert <no@[EMAIL PROT  2008-04-05 18:18:13 
Re: Decimal versus binary arithmetic was Re: J4 - presentation/d
"tlmfru" <la  2008-04-07 11:08:23 
Re: Decimal versus binary arithmetic was Re: J4 - presentation/d
Robert <no@[EMAIL PROT  2008-04-07 21:11:04 
Re: Decimal versus binary arithmetic was Re: J4 - presentation/d
"tlmfru" <la  2008-04-08 11:00:52 
Re: Decimal versus binary arithmetic was Re: J4 - presentation/d
Howard Brazee <howard@  2008-04-07 08:09:26 
Re: Decimal versus binary arithmetic was Re: J4 - presentation/d
"tlmfru" <la  2008-04-07 10:49:27 
Re: Decimal versus binary arithmetic was Re: J4 - presentation/d
Howard Brazee <howard@  2008-04-07 08:04:00 
Re: Decimal versus binary arithmetic was Re: J4 - presentation/d
"HeyBub" <he  2008-04-04 08:53:49 
Re: Decimal versus binary arithmetic was Re: J4 - presentation/d
Robert <no@[EMAIL PROT  2008-04-04 21:19:36 
Re: Decimal versus binary arithmetic was Re: J4 - presentation/d
"Pete Dashwood"  2008-04-05 17:34:51 
Re: Decimal versus binary arithmetic was Re: J4 - presentation/d
docdwarf@[EMAIL PROTECTED  2008-04-05 14:03:36 
Re: Decimal versus binary arithmetic was Re: J4 - presentation/d
Howard Brazee <howard@  2008-04-07 08:12:37 
Re: Decimal versus binary arithmetic was Re: J4 - presentation/d
Robert <no@[EMAIL PROT  2008-04-07 20:24:59 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 4 21:59:50 CDT 2008.