Opened 13 years ago

Closed 13 years ago

#198 closed bug (wontfix)

negative denominator is not handled properly

Reported by: gorzel Owned by: somebody
Priority: major Milestone: 3-1-1
Component: dontKnow Version: 3-1-0
Keywords: Cc:

Description

There is a BUG in the Parser: Numbers (fracions) with negative denominator are interpreted as division in Z, i.e. / is inter- preted as div.

> ring r=0,x,dp;
> 8/3;    // OK
8/3
> -8/3;   // OK
-8/3
> 8/-3;   // BUG
-2
> -8/-3;  // BUG
2

The same occurs with real

> ring rr=real,x,dp;
> 8/3;
2.667e+00
> -8/3;
-2.667e+00
> 8/-3;
-2
> -8/-3;
2
> 8/-3.0;
-2.667e+00
> number(8)/-3;
-2.667e+00

and in prime characterstic:

> ring r7=7,x,dp;
> 5/3;
-3
> 5/-3;   // Wrong it is treated as 5/ -3
-1
> number(5)/-3;
3

Change History (1)

comment:1 Changed 13 years ago by hannes

Resolution: wontfix
Status: newclosed
There are two cases:
- a numerical constant containing /: for example 8/3: it is of type number
- a division between 2 objects: / depends on the type of the objects,
  for example 8/-3 (division of 2 integers)
The difference between the cases: within a numerical constant only digits
and / are allowed: 8/3 is a constant, while -8/3 and 8/-3 are expressions.

Quote from the manual (http://www.singular.uni-kl.de/Manual/3-1-0/sing_354.htm)
If two numerical constants (i.e. two sequences of digits) are divided using the / operator,
...
Note: See TracTickets for help on using tickets.