Opened 13 years ago

Closed 13 years ago

Last modified 11 years ago

#1040 closed bug (invalid)

read::Float does not handle string that are all digits, but end in "."

Reported by: guest Owned by:
Priority: low Milestone:
Component: Compiler Version: 6.6
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


(read a)::Float fails if a is a string that is all digits but ends int "."

(read "20.")::Float fails


(read "20.3")
Float succeeds

compare to the c atof function which succeeds in producing a correct value in both cases

Change History (3)

comment:1 Changed 13 years ago by thorkilnaur

Resolution: invalid
Status: newclosed

Describing "Numeric Literals" in Haskell programs, page 12 of the Haskell 98 reports says "A floating literal must contain digits both before and after the decimal point." The behaviour of read that you describe is in agreement with this. To me, the read behaviour thus seems entirely reasonable and I have taken the liberty of closing this ticket.

comment:2 Changed 11 years ago by simonmar

Architecture: UnknownUnknown/Multiple

comment:3 Changed 11 years ago by simonmar

Operating System: UnknownUnknown/Multiple
Note: See TracTickets for help on using tickets.