Bug #936
ReadExpr: cannot handle exponent which is not integer literal
Description
The fn ReadExpr
fails if input contains an exponent which is not an integer literal: for instance
ReadExpr(QQ, "1.2*10^(-3)");
triggers an error saying that the
"("
is unexpected.
At least negative exponents in brackets should be allowed!
Related issues
History
#1 Updated by John Abbott over 7 years ago
What exactly do we want to allow in the exponents?
The simplest solution would be to allow either an integer literal (possibly with whitespace before it), or an integer literal inside round brackets. This would cover the most common cases.
Is there any reason to allow more complicated exponents? For instance 10^(2+3+4)
I can see no real need for this.
The KISS philosophy suggests that we should aim for the simplest reasonable solution.
#2 Updated by John Abbott over 7 years ago
The relevant source is around line 100 of RingElemInput.C
#3 Updated by Anna Maria Bigatti over 7 years ago
John Abbott wrote:
What exactly do we want to allow in the exponents?
The simplest solution would be to allow either an integer literal (possibly with whitespace before it), or an integer literal inside round brackets. This would cover the most common cases.
I agree
#4 Updated by John Abbott over 7 years ago
- Status changed from New to Feedback
- Assignee set to John Abbott
- % Done changed from 0 to 90
I have now implemented the following:
after ^
there may be an unsigned integer literal or (
optional-sign unsigned integer literal )
Whitespace is allowed around ^
and (
and )
.
Note that a negative exponent must be placed in round brackets; giving ReadExpr
the string 1^-1
will produce an error.
#5 Updated by John Abbott over 7 years ago
- Related to Bug #938: ReadExpr: misreads 2/3^4 added
#6 Updated by John Abbott over 7 years ago
- Related to Feature #909: ReadExpr: decimal point added
#7 Updated by John Abbott over 7 years ago
- Target version changed from CoCoALib-0.99560 to CoCoALib-0.99550 spring 2017
#8 Updated by John Abbott over 7 years ago
- Status changed from Feedback to Closed
- % Done changed from 90 to 100
- Estimated time set to 1.50 h