[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: Re: printf can't handle the '+' char in front of an integer
From: Emmanuel Deloget <logout () free ! fr>
Date: 2018-10-31 12:36:23
Message-ID: CAKh=nwHUOZ_Kj4vOzMreg+Xs0ZfO6TQAtobjf4daMnzD71oVKw () mail ! gmail ! com
[Download RAW message or body]
Hello,
Just my two cents here.
On Wed, Oct 31, 2018 at 12:34 PM Bernhard Reutner-Fischer
<rep.dot.nop@gmail.com> wrote:
>
> >
> > 64-bit double's mantissa is only 53 bits...
> >
> > With "long double" shenanigans, I managed to "improve" this to:
> >
> > $ ./busybox printf "%f\n" 18446744073709550592 18446744073709553665
> > 18446744073709550591.500000
> > 18446744073709553663.500000
> >
> > at this cost:
> >
> > function old new delta
> > printf_main 909 976 +67
> > strtold - 19 +19
> > print_direc 457 475 +18
> > conv_strtod 54 61 +7
> > ------------------------------------------------------------------------------
> > (add/remove: 3/0 grow/shrink: 3/0 up/down: 130/0) Total: 111 bytes
> >
> > See attached. Do you think it's worth it?
>
> I don't know.
> long double can be very slow (emulated) and complex to support, which
> might not be of concern here though.
> But first and foremost nobody complained yet AFAIK.
> Maybe keep it as is? Actively reject values too large for plain double
> in printf(1) for now?
> dunno.
Maybe hide the float/double/long double behind a config ? Some people
may want printf to support long values, while some other (like me)
does not need it.
Best regards,
-- Emmanuel Deloget
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic