Opened 22 months ago

Last modified 18 months ago

#7044 new bug

reject reading rationals with exponent notation

Reported by: maeder Owned by:
Priority: normal Milestone: 7.8.3
Component: Compiler Version: 7.4.2
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets: #5692

Description

The program

main = print (1E1000000000 :: Rational)

fails in the same way as for doubles currently. This should not happen at compile time! Therefore I suggest to forbid using the e-notation for rationals, it is not legal for integers either.

(An alternative would be to evaluate the rational only at run-time)

Change History (4)

comment:1 Changed 22 months ago by pcapriotti

  • Difficulty set to Unknown
  • Resolution set to duplicate
  • Status changed from new to closed

This is essentially the same issue as #5692. Let's keep the discussion on that ticket..

comment:2 Changed 22 months ago by maeder

  • Resolution duplicate deleted
  • Status changed from closed to new

It's not the same issue. "1E1000000000" can be easily converted to the Double "Infinity", whereas this is not possible for rationals. Therefore even

main = print (1E10 :: Rational)

should fail as it does for integers!

comment:3 Changed 22 months ago by maeder

hugs has a pragmatic "solution"

Hugs> 1E309 :: Rational

Program error: arithmetic overflow

comment:4 Changed 18 months ago by igloo

  • Milestone set to 7.8.1
Note: See TracTickets for help on using tickets.