From: Alex McGuire
Subject: Converting strings to double-float
Date: 
Message-ID: <43f585a9$0$29198$8fcfb975@news.wanadoo.fr>
Hi

I'm trying to convert the string "691308846.000" to a double-float, my 
first attempt lost accuracy, i.e.


* (coerce (read-from-string "691308846.000") 'double-float)

6.91308864d8   (Note, ends in '64' not '46')


The following works, but feels like a hack. Is there a cleaner way of 
going about this?


* (read-from-string (concatenate 'string "691308846.000" "d0"))

6.91308846d8



Thanks.
From: Alex McGuire
Subject: Re: Converting strings to double-float
Date: 
Message-ID: <43f58a64$0$6663$8fcfb975@news.wanadoo.fr>
Alex McGuire wrote:
> Hi
> 
> I'm trying to convert the string "691308846.000" to a double-float, my 
> first attempt lost accuracy, i.e.
> 
> 
> * (coerce (read-from-string "691308846.000") 'double-float)
> 
> 6.91308864d8   (Note, ends in '64' not '46')
> 
> 
> The following works, but feels like a hack. Is there a cleaner way of 
> going about this?
> 
> 
> * (read-from-string (concatenate 'string "691308846.000" "d0"))
> 
> 6.91308846d8
> 
> 
> 
> Thanks.

Aha!

I've just discovered *read-default-float-format*. That fixes it.

Thanks