#301 floats with missing exponents / really minor

closed
Lisp Core (471)
3
2003-05-16
2003-04-23
No

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

Discussion

  • Stavros Macrakis

    • priority: 5 --> 3
     
  • Stavros Macrakis

    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.

     
  • Barton Willis

    Barton Willis - 2003-05-07

    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.

     
  • Raymond Toy

    Raymond Toy - 2003-05-13

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

     
  • Raymond Toy

    Raymond Toy - 2003-05-16

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

     
  • Raymond Toy

    Raymond Toy - 2003-05-16
    • status: open --> closed
    • labels: --> Lisp Core
    • assigned_to: nobody --> rtoy
     
  • Raymond Toy

    Raymond Toy - 2003-05-16

    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.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks