adding floats. a peculiarity, and a proposal



 

> -----Original Message-----
> From: Raymond Toy [mailto:raymond.toy at ericsson.com] 
....> 
> Not sure I like this.  If I said 0.1d0, then I want 0.1d0.  
> If I wanted an exact rational I would have said 1/10.  

If you have an explicit marker "I want a double" that would make sense.

If you have a somewhat vaguer marker "I want to use decimal positional
notation,
(perhaps with an exponent e)" then what does that mean?
Does 0.1  or 0.1e0 mean  1/10 or does it mean
0.10000000000000000034694469519536141888238489627838134765625..... ?

I think that 1/10 is less confusing for the computationally naive; the
expert who
knows about floating point arithmetic can be told to use d.  The person who
knows
only a little about floats is often confused anyway :)


> However, it would be useful to have, say, 0.1234567r0 mean 
> the exact rational 1234567/100000000, without me having to 
> write the denominator explicitly.

This is possible too:  how many exponent markers do we want? eEdDsSbBrR?

RJF