summaryrefslogtreecommitdiff
blob: 3da2e8558dacc19131034f580c55c347e030f60e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
commit ff707a3f2ba2d5c555434ba50547453833a7570f
Author: Karim Belabas <Karim.Belabas@math.u-bordeaux1.fr>
Date:   Sun Mar 18 23:54:02 2012 +0100

    71- issquarefree(0) => error [#1304]

diff --git a/src/basemath/ifactor1.c b/src/basemath/ifactor1.c
index 046491f..8f9fbaa 100644
--- a/src/basemath/ifactor1.c
+++ b/src/basemath/ifactor1.c
@@ -3493,7 +3493,11 @@ moebius(GEN n)
 GEN
 gissquarefree(GEN x) { return map_proto_lG(issquarefree,x); }
 long
-Z_issquarefree(GEN n) { return moebius(n)? 1: 0; }
+Z_issquarefree(GEN n)
+{
+  if (!signe(n)) return 0;
+  return moebius(n)? 1: 0;
+}
 long
 issquarefree(GEN x)
 {
diff --git a/src/test/32/arith b/src/test/32/arith
new file mode 100644
index 0000000..3c5981a
--- /dev/null
+++ b/src/test/32/arith
@@ -0,0 +1,2 @@
+0
+Total time spent: 8
diff --git a/src/test/in/arith b/src/test/in/arith
new file mode 100644
index 0000000..fb92bed
--- /dev/null
+++ b/src/test/in/arith
@@ -0,0 +1,2 @@
+\\#1304
+issquarefree(0)