55 lines
1.7 KiB
Diff
55 lines
1.7 KiB
Diff
See: https://pari.math.u-bordeaux.fr/cgi-bin/bugreport.cgi?bug=2419
|
|
--
|
|
|
|
commit 9c4bcd3f497f30f757c8eecadc9b45b33754a540
|
|
Author: Karim Belabas <Karim.Belabas@math.u-bordeaux.fr>
|
|
Date: Tue Oct 4 10:30:43 2022 +0200
|
|
|
|
6- conversion to float of t_QUAD with t_FRAC components [#2419]
|
|
|
|
diff --git a/src/basemath/gen2.c b/src/basemath/gen2.c
|
|
index 3ef74a7023..d810270b99 100644
|
|
--- a/src/basemath/gen2.c
|
|
+++ b/src/basemath/gen2.c
|
|
@@ -2429,8 +2429,8 @@ quadtofp(GEN x, long prec)
|
|
else
|
|
{ /* if (b) x ~ (u + z) / 2 and quadnorm(x) ~ (u^2 - z^2) / 4
|
|
* else x ~ u + z and quadnorm(x) ~ u^2 - z^2 */
|
|
- long s = signe(u);
|
|
- if (s == -signe(v)) /* conjugate expression avoids cancellation */
|
|
+ long s = gsigne(u);
|
|
+ if (s == -gsigne(v)) /* conjugate expression avoids cancellation */
|
|
{
|
|
z = gdiv(quadnorm(x), gsub(u, z));
|
|
if (b) shiftr_inplace(z, 1);
|
|
diff --git a/src/test/32/quad b/src/test/32/quad
|
|
index 2b43d87a4a..1f1042d143 100644
|
|
--- a/src/test/32/quad
|
|
+++ b/src/test/32/quad
|
|
@@ -43,6 +43,7 @@ w
|
|
-4294967297
|
|
4294967297
|
|
-4294967297
|
|
+2.2847006554165615148712535010323047844
|
|
*** at top-level: floor(w8)
|
|
*** ^---------
|
|
*** floor: incorrect type in gfloor (t_QUAD).
|
|
@@ -55,4 +56,4 @@ w
|
|
*** at top-level: floor(Mod(0,3)*quadgen(5))
|
|
*** ^--------------------------
|
|
*** floor: incorrect type in gfloor (t_QUAD).
|
|
-Total time spent: 2
|
|
+Total time spent: 1
|
|
diff --git a/src/test/in/quad b/src/test/in/quad
|
|
index c8cd5a586f..82cd5e992d 100644
|
|
--- a/src/test/in/quad
|
|
+++ b/src/test/in/quad
|
|
@@ -47,6 +47,7 @@ ceil(2*w)
|
|
ceil(-2*w)
|
|
round(2*w)
|
|
round(-2*w)
|
|
+quadgen(5) + 2/3 + 0.\\ #2419
|
|
|
|
\\ Errors keep at end of file
|
|
floor(w8)
|