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.
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