According to the specification of symmetricRemainder in si.spad
symmetricRemainder : (%, %) -> %
++ symmetricRemainder(a, b) (where \spad{b > 1}) yields r
++ where \spad{-b/2 <= r < b/2}.
the result of
%%% (1) -> symmetricRemainder(2,4)
(1) 2
is clearly wrong (should be -2 according to the above specification).
This patch corrects the specification.
Of course, it is controversial, whether
-b/2 <= r < b/2 or -b/2 < r <= b/2 is better.
However, having a specification that does not match the implementation
is not ideal.
Ralf
--
You received this message because you are subscribed to the Google Groups "FriCAS -
computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/fricas-devel/3eeee840-3d32-4d86-847e-69e227be99f2%40hemmecke.org.
From a37c9ef382b7349117396c8c6cbc4af8083c6e3c Mon Sep 17 00:00:00 2001
From: Ralf Hemmecke <[email protected]>
Date: Wed, 5 Jun 2024 10:23:57 +0200
Subject: docfix postcondition of symmetricPower
According to the specification of symmetricRemainder in si.spad
symmetricRemainder : (%, %) -> %
++ symmetricRemainder(a, b) (where \spad{b > 1}) yields r
++ where \spad{-b/2 <= r < b/2}.
the result of
```
%%% (1) -> symmetricRemainder(2,4)
(1) 2
```
is clearly wrong (should be -2 according to the above specification).
This patch corrects the specification.
---
src/algebra/si.spad | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/algebra/si.spad b/src/algebra/si.spad
index 149ff4cf..1c688933 100644
--- a/src/algebra/si.spad
+++ b/src/algebra/si.spad
@@ -31,7 +31,7 @@ IntegerNumberSystem() : Category ==
++ where \spad{0 <= r < b} and \spad{r = a rem b}.
symmetricRemainder : (%, %) -> %
++ symmetricRemainder(a, b) (where \spad{b > 1}) yields r
- ++ where \spad{-b/2 <= r < b/2}.
+ ++ where \spad{-b/2 < r <= b/2}.
rational? : % -> Boolean
++ rational?(n) tests if n is a rational number
++ (see \spadtype{Fraction Integer}).
--
2.34.1