Richard in Reading on Wed, 24 Apr 2013 01:31:40 +0200

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Surprising behaviour of sqrt() on squares of integers

This is just a toy example but there are other real situation where it's annoying that PARI doesn't recognize when you want to take a square root of the square of an integer and return an integer.

Is there some justification for this or is it worth me reporting it as a bug. 

 ? Mod(5,sqrt(9))
  ***   at top-level: Mod(5,sqrt(denominat
  ***                 ^--------------------
  *** Mod: forbidden division t_INT % t_REAL.
  ***   Break loop: type 'break' to go back to GP

? sqrt(2^256)
%17 = 3.4028236692093846346337460743176821146 E38
? 2^128
%18 = 340282366920938463463374607431768211456

The above should return the same value in my opinion.

Richard Heylen