Perform calculation with great number



High Level Assembler(HLASM) for MVS & VM & VSE

Re: Perform calculation with great number

Postby steve-myers » Wed May 04, 2011 12:11 am

You are treating the value from IGGCSI00 as a signed value. It is not signed. After your shift you have a 64-bit signed value in register 6 and 7, so the result of your division is signed, and wrong. This will work.
         SR    6,6
         L     7,=X'D1394000'
         D     6,=A(12*5096)
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: Perform calculation with great number

Postby steve-myers » Wed May 04, 2011 9:41 am

I do not think your proposal to use Divide Logical would do you much good.

You might achieve some success by replacing the SRDA in your code with SRDL This would make your code the rough equivalent of my code in my last post.
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: Perform calculation with great number

Postby sensuixel » Mon May 09, 2011 1:16 pm

You're right, the DIVIDE LOGICAL didn't got me out of trouble, but the SRDL made if work.

Here's the code i used
         SR       R6,R6           
         L        R6,=X'D1394000'
         SRDL     R6,32           
         D        R6,=A(12*4096) 
         LTR      R6,R6           
         BZ       *+L'*+4         
         A        R7,=F'1'       


I get X'000116F7' which is correct

Thank you really much for the SRDL tips and also for test of remainder, i find it very elegant
sensuixel
 
Posts: 58
Joined: Mon Feb 21, 2011 8:55 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Perform calculation with great number

Postby steve-myers » Mon May 09, 2011 8:20 pm

sensuixel wrote:...Thank you really much for the SRDL tips and also for test of remainder, i find it very elegant
Thar's true, but do you really understand that the value you got from IGGCSI00 is a negative number in System/360 2's complement arithmetic? That's what got you in trouble in the first place, and I have to admit I missed it at first, until other people pointed it out to us.
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Previous

Return to Assembler

 


  • Related topics
    Replies
    Views
    Last post