[FFmpeg-devel] [PATCH] eval: implement av_strtod internally.
eclipse7 at gmx.net
Mon Feb 27 20:58:54 CET 2012
Michael Niedermayer wrote:
> On Sun, Feb 19, 2012 at 03:02:42PM +0100, Nicolas George wrote:
> > Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> > ---
> > libavutil/eval.c | 155 ++++++++++++++++++++++++++++++++++++++++++++----------
> > 1 files changed, 127 insertions(+), 28 deletions(-)
> > I do not know if people will like it, and I will not insist if not.
> > This patch implements our own version of strtod, with pros and cons;
> > hopefully more pros but YMMV. The cons are:
> > - More code to maintain.
> > - Does not set errno (we do not use it).
> > - Does not support "NAN(blah)".
> > - Probably less optimized than the libc's.
> > The pros, on the other hand:
> > - Does not break if LC_NUMERIC is set (LC_NUMERIC is synonym with
> > PLEASE_BREAK_HALF_MY_CODE, but still, some program init it).
> > - Supports hexadecimal non-integers (the current implementation implements
> > hexadecimal integers by wrapping strtod, therefore making it impossible to
> > use them if they are supported; this would be easily fixed though).
> > - Can use a string terminated by a pointer rather than an extra NUL. This is
> > useful when parsing a substring, to avoid copying it.
> I like the idea
One comment for now:
Your implementation might also be less precise than most standard C library
implementations. The attached program should reveal few of those occurrences.
You might want to dig into Rick Regan's blog if you don't have already.
He should have accumulated plenty of information that is useful to consider
when doing a project similar to your patch.
I believe this explains the problem I have mentioned above:
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 668 bytes
Desc: not available
More information about the ffmpeg-devel