Re: Portable dtoa.c
Hi Simon,
thank you for your answer!
Simon McVittie <smcv@debian.org> writes:
> On 08/02/16 12:34, Ole Streicher wrote:
>> I am working to get my "pyephem" package done for all available
>> (official and unofficial) ports. The major problem here is that it uses
>> "ascii_strtod() from the file "dtoa.c" by David M. Gray [1] that is
>> machine dependent.
>
> From the name, is it an extension for Python?
Yes.
> Python has its own version of dtoa, crediting David M. Gay (I assume
> this is the same author you meant):
I know; however it has two disadvantages: first, the needed function is
marked as deprecated, and then, it just crashes. So, it is probably not
so simple as I thought.
> Failing that, GLib has g_ascii_strtod(), which looks machine-independent
> and reasonably separable from the rest of GLib, and is much, much
> simpler than the one in Python - it might be somewhat slower, but I
> doubt that matters much on current hardware.
I mostly worry for the accuracy, and therefore I would not like to use
something completely different.
> As a general rule of thumb, good places to find implementations of
> useful but not-necessarily-portable functions like this are "make C more
> portable/pleasant" libraries like GLib, and language runtimes like
> Python :-)
I was hoping that somebody used the (more or less) original version and
could say what to set for the different platforms.
Thank you anyway,
Best regards
Ole
Reply to: