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
|
- To: pari-users@pari.math.u-bordeaux1.fr
- Subject: Surprising behaviour of sqrt() on squares of integers
- From: Richard in Reading <richard_in_reading@yahoo.co.uk>
- Date: Wed, 24 Apr 2013 00:31:27 +0100 (BST)
- Delivery-date: Wed, 24 Apr 2013 01:31:40 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s1024; t=1366759887; bh=mgNsOC2YHfLY8pMBTj23bAS5eE6Yp4V3u/bCBg01cn0=; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:Message-ID:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=dbEWMCvWjIqJY+GyHMwNr7+ZvYJJ6O7udnP+9oXJzNPi1Z2i0Hw1Q+k3+J1yk1Z/SAcGZV8taeLhih149zXtlpQCGBtOu1v6tt9p9nHm0+tc0/G+V4opIfUWK4Eh1+0TCRwLIKFi8ldDwbjrTgFd4W2i2ASdM9HMjnNEji2q6Sc=
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.uk; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:Message-ID:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=x6E+cnj+QNyrv5rqmBWU6DQcQGQK4LPWcM7RGs/se1cPovD9Az+G2K9flyV5VH1oSjZ5ZQXangejhdAiQre0HkdpzkCi9BawXCg7UkcmmGlmru9901AqttVaJm1T+cg6QojLKbHRWnfzbQY+P5Vz9yJB69tGeWP2S/Twkk7n4kI=;
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