rtoy / maxima

A Clone of Maxima's repo
Other
0 stars 0 forks source link

floats with missing exponents / really minor #1556

Closed rtoy closed 2 days ago

rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 19:39:28 Created by willisb on 2003-04-23 18:16:51 Original: https://sourceforge.net/p/maxima/bugs/301


Some software allows the exponent of a float to default to zero. In Maxima, this isn't the case

(C1) 4.2d; (D1) 4.2D+ (C2) 4.2e; (D2) 4.2E+ (C3) ?print(%);

4.2E+ (D3) 4.2E+ (C4) 4.2b; Error: Unexpected end of #<string-input stream from "">. Fast links are on: do (si::use-fast-links nil) for debugging Error signalled by MACSYMA-TOP-LEVEL. Broken at MREAD-RAW. Type :H for Help. MAXIMA>>

Maxima version: 5.9.0 Maxima build date: 19:10 2/9/2003 host type: i686-pc-mingw32 lisp-implementation-type: Kyoto Common Lisp lisp-implementation-version: GCL-2-5.0

Not really a bug, but ...

Barton

rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 19:39:29 Created by macrakis on 2003-05-05 22:01:12 Original: https://sourceforge.net/p/maxima/bugs/301/#f775


Logged In: YES user_id=588346

I don't see any good reason to allow "4.2d" etc. as a short form of "4.2d0". This is not supported by any programming language I know. What software allows this??? My guess is that it is either (1) some sort of very permissive user front- end; (2) a fixed format where spaces are interpreted as zeroes; or (3) an accident/bug of the implementation.

On the other hand, the error message given is poor. It should give a normal syntax error, not an internal error. THAT is a bug.

rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 19:39:33 Created by macrakis on 2003-05-05 22:01:12 Original: https://sourceforge.net/p/maxima/bugs/301/#1593


rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 19:39:36 Created by willisb on 2003-05-07 15:14:45 Original: https://sourceforge.net/p/maxima/bugs/301/#44b8


Logged In: YES user_id=570592

Agreed, the internal error is a bug, and I agree that allowing the exponent to default to zero isn't a good thing. Should somebody fix this, all three inputs

(C1) 4.2b; Error: Unexpected end of #<string-input stream from "">. Fast links are on: do (si::use-fast-links nil) for debugging Error signalled by MACSYMA-TOP-LEVEL. Broken at MREAD-RAW. Type :H for Help. MAXIMA>>:q (C1) 4.2d; (D1) 4.2D+ (C2) 4.2e; (D2) 4.2E+

should generate more or less the same (comphensible) error message.

rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 19:39:40 Created by rtoy on 2003-05-13 04:17:40 Original: https://sourceforge.net/p/maxima/bugs/301/#2080


Logged In: YES user_id=28849

I think the following replacement in nparse.lisp will catch these errors. Help pick out a better error message.

(DEFUN SCAN-DIGITS (DATA CONTINUATION? CONTINUATION) (DO ((C (PARSE-TYIPEEK) (PARSE-TYIPEEK)) (L () (CONS C L))) ((NOT (ASCII-NUMBERP C)) (COND ((IMEMBER C CONTINUATION?) (FUNCALL CONTINUATION (LIST* (NCONS (FIXNUM-CHAR-UPCASE (PARSE-TYI))) (NREVERSE L) Data) )) ((null l) (merror "Incomplete number")) (T (MAKE-NUMBER (CONS (NREVERSE L) DATA))))) (PARSE-TYI)))

rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 19:39:43 Created by rtoy on 2003-05-16 00:33:53 Original: https://sourceforge.net/p/maxima/bugs/301/#3272


Logged In: YES user_id=28849

I think the following replacement in nparse.lisp will catch these errors. Help pick out a better error message.

(DEFUN SCAN-DIGITS (DATA CONTINUATION? CONTINUATION) (DO ((C (PARSE-TYIPEEK) (PARSE-TYIPEEK)) (L () (CONS C L))) ((NOT (ASCII-NUMBERP C)) (COND ((IMEMBER C CONTINUATION?) (FUNCALL CONTINUATION (LIST* (NCONS (FIXNUM-CHAR-UPCASE (PARSE-TYI))) (NREVERSE L) Data) )) ((null l) (merror "Incomplete number")) (T (MAKE-NUMBER (CONS (NREVERSE L) DATA))))) (PARSE-TYI)))

rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 19:39:47 Created by rtoy on 2003-05-16 00:39:09 Original: https://sourceforge.net/p/maxima/bugs/301/#7948


rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 19:39:50 Created by rtoy on 2003-05-16 00:39:09 Original: https://sourceforge.net/p/maxima/bugs/301/#cbd5


Logged In: YES user_id=28849

A slightly modified version of the patch has been committed. In all cases, if an exponent isn't given, an error is signaled about an incomplete number.