read-ing scientific notation

Mark Carroll [email protected]
Fri, 12 Oct 2001 11:02:17 -0400 (EDT)


On Fri, 12 Oct 2001, Simon Peyton-Jones wrote:

> | GHC is oddly particular about decimal points in "read"-ing in 
> | of Doubles in scientific notation. It seems that read 
> | "3.0e-06" is acceptable but read "3e-06" is not (both read 
> | "3" and read "3.0" work fine as Doubles). It's the same in 
(snip)
> It's an unforced change and therefore to be regarded with
> deep suspicion. I'd be interested in people's views about this.

I was actually recently caught out by this - I'd assumed that 3e-06 would
work (as it does in Modula-3, etc.), and it didn't. Personally, my
preference would be for it to mean just the same as 3.0e-06 - it's
annoying having to go through my physical constants now adding the
rather-redundant ".0"'s everywhere. (-: But, with the sort of parsing I'm
doing, "terms" are largely separated by whitespace anyway; maybe if they
weren't I'd want things different.

-- Mark