Project

Profile

Help

bin:unpack-integer() and bin:unpack-unsigned-integer()

Added by T Hata about 7 years ago

Code:




	

	
		
		

		
			
				
					
						
					
				
			

			
				
					
						
					
				
			
		
	

Output:


Saxon-EE 9.8.0.6J from Saxonica
Java version 1.8.0_151
...


   
      0
      -128
      -32768
      -8388608
      -1
      -256
      -65536
      -16777216
      -1
   
   
      0
      128
      32768
      8388608
      2147483648
      549755813888
      140737488355328
      36028797018963968
      -9223372036854775808
   

I'm puzzled by the values of @//signed/int[@size >= 4]@ and @//unsigned/int[@size = 8]@. Are they working as intended?


Replies (1)

RE: bin:unpack-integer() and bin:unpack-unsigned-integer() - Added by John Lumley about 7 years ago

Thank you for letting us know - this bug has been there since the original code was developed in 2013. See https://saxonica.plan.io/issues/3521 for other information. The results of your code will produce:


   
      0
      -128
      -32768
      -8388608
      -2147483648
      -549755813888
      -140737488355328
      -36028797018963968
      -9223372036854775808
      -2361183241434822606848
      -604462909807314587353088
    
   
      0
      128
      32768
      8388608
      2147483648
      549755813888
      140737488355328
      36028797018963968
      9223372036854775808
      2361183241434822606848
      604462909807314587353088
   

which now runs smoothly through the 32 and 64 bit boundaries....

The patches should appear in the next maintenance releases of 9.7 and 9.8

    (1-1/1)

    Please register to reply