3 views

Skip to first unread message

Jun 5, 2024, 5:03:25 AMJun 5

to fricas-devel

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

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

Jun 5, 2024, 6:43:59 AMJun 5

to fricas...@googlegroups.com

On Wed, Jun 05, 2024 at 11:03:21AM +0200, Ralf Hemmecke wrote:

> 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.

OK, thanks.
> 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 fricas-devel...@googlegroups.com.

> 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 <ra...@hemmecke.org>

> 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.

> ---
> 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}.
> ++ symmetricRemainder(a, b) (where \spad{b > 1}) yields r

> + ++ 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

>

--

Waldek Hebisch

Reply all

Reply to author

Forward

0 new messages

Search

Clear search

Close search

Google apps

Main menu