Opened 9 years ago

Closed 9 years ago

Last modified 7 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: Test Case:
Blocked By: Blocking:
Related Tickets: Differential Revisions:

Description

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

(read "20.")::Float fails

but

(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 9 years ago by thorkilnaur

  • Resolution set to invalid
  • Status changed from new to closed

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 7 years ago by simonmar

  • Architecture changed from Unknown to Unknown/Multiple

comment:3 Changed 7 years ago by simonmar

  • Operating System changed from Unknown to Unknown/Multiple
Note: See TracTickets for help on using tickets.