[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GADT printer patch



I wonder if we should explicitly ban %f in Mirage code and see how far we get.

We rarely need to render anything other than very limited precision floats,
and it's information that is only *required* in the Gc interface from the
standard library (unfortunately).

-anil

On 22 May 2013, at 15:09, Stephen Dolan <stephen.dolan@xxxxxxxxxxxx> wrote:

> Such an implementation would probably be some variant of
> http://www.netlib.org/fp/dtoa.c
> It turns out that formatting floats involves implementing a small
> bigint library (!).
> 
> On Wed, May 22, 2013 at 3:08 PM, Anil Madhavapeddy <anil@xxxxxxxxxx> wrote:
>> Right, I want to separate float formatting anyway. Some libraries (notably
>> FreeBSD's libkern printf) don't do floats at all, so separating those cleanly
>> in the OCaml layer would be lovely.
>> 
>> Currently, the whole format string gets shoved to vsnprintf(3).  With this
>> patch, we just need an implementation of caml_format_float, but not all the
>> other bits of printf.
>> 
>> -anil
>> 
>> On 22 May 2013, at 14:56, Stephen Dolan <Stephen.Dolan@xxxxxxxxxxxx> wrote:
>> 
>>> It still requires sprintf. In particular, it uses caml_format_float to
>>> do %f and friends, which uses sprintf internally. Correct float
>>> formatting is a surprisingly large amount of code.
>>> 
>>> Stephen
>>> 
>>> On Wed, May 22, 2013 at 2:19 PM, Anil Madhavapeddy <anil@xxxxxxxxxx> wrote:
>>>> This is really neat:
>>>> http://caml.inria.fr/mantis/view.php?id=6017
>>>> 
>>>> If I understand it right, it eliminates our need for the printf dietlibc 
>>>> bits, which means we could simplify mirage-platform quite a bit!
>>>> 
>>>> Should cook up an OPAM compiler patch to experiment with it...
>>>> 
>>>> -anil
>>> 
>> 
> 




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.