On Dec 17, 2007 10:28 AM, Bob Ippolito <[EMAIL PROTECTED]> wrote:
>
> On 12/17/07, Joneksi <[EMAIL PROTECTED]> wrote:
> >
> > Hi
> >
> > In erlsql.erl:
> >
> > encode(Val, false) when is_integer(Val) ->
> >     integer_to_list(Val);
> > encode(Val, false) when is_float(Val) ->
> >     [Res] = io_lib:format("~w", [Val]),
> >     Res;
> >
> > Is there still a reason to not to use more  accurate float_to_list?
> >
> > Eshell V5.5.5  (abort with ^G)
> > 1> A=0.0000012345678.
> > 1.23457e-6
> > 2> io_lib:fwrite("~w", [A]).
> > [["1.23457",101,45,54]]
> > 3> float_to_list(A).
> > "1.23456780000000008931e-06"
> > 4>
>
> You can get the best of both (compactness and accuracy) with 
> mochinum:digits/1.
>
> http://mochiweb.googlecode.com/svn/trunk/src/mochinum.erl
>
> 1> mochinum:digits(0.0000012345678).
> "0.0000012345678"
> 2> float_to_list(0.1).
> "1.00000000000000005551e-01"
> 3> mochinum:digits(0.1).
> "0.1"
>
> -bob

This looks good! The only issue is including it in the ErlyWeb
distribution (I prefer to avoid adding another dependency). Do you see
any problems with that? Do you think this file may change?

Yariv

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"erlyweb" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to