[Insight-developers] NrrdIO : ITK : Precision bug and printf formatting using Re: %g vs %lg vs %.17lg
Luis Ibanez
luis.ibanez at kitware.com
Mon Jan 11 16:11:05 EST 2010
Michel,
The commit message for version 1.12 indicates that this was
indeed a fix for a bug on the numerical precision:
http://public.kitware.com/cgi-bin/viewcvs.cgi/Utilities/NrrdIO/write.c?root=Insight&view=log
I'm copying Simon Warfield here, since he kindly contributed
the fix, and may help us clarify the best way to manage this
situation. I'm also copying the ITK dev list, to get a wider set
of eyes looking at this patch.
(BTW, looking at Simon's email, he was suggesting %g, not %lg)
My 2 cents
Luis
------------------------------------
On Mon, Jan 11, 2010 at 3:57 PM, Michel Audette
<michel.audette at kitware.com> wrote:
> Hi gents,
>
> I'm noticing that some printf-type function calls that in the past
> used the %lg format statement has on the one hand been modified to
> %.17lg in some cases in ITK, whereas in the Sourceforge repository
> these are now %g (e.g. write.c).
>
> The following link
> http://www.dgp.toronto.edu/~ajr/209/notes/printf.html
>
> indicates...
> Personally, I used to use %lg routinely for doubles in both printf and
> scanf, but this is out of favour these days and indeed gcc will give
> you a warning message for using %lg in printf. The usual procedure
> these days is to use %g for double in printf and %lg for double in
> scanf. It doesn't matter which you use for printf because the printf
> library function treats them as synonymous, but it's crucial to get it
> right for scanf.
>
> Gordon, was the movement from %lg to %g done with this in mind? Luis,
> if so, do we leave well alone, or implement some of the %.17lg
> statements such as in
> /Utilities/NrrdIO/write.c rev 12, lines 219, 476, and 484?
> http://public.kitware.com/cgi-bin/viewcvs.cgi/Utilities/NrrdIO/write.c?root=Insight&r1=1.11&r2=1.12
>
> Thoughts?
>
> Michel
>
>
> --
> Michel Audette, Ph.D.
> R & D Engineer,
> Kitware Inc.,
> Chapel Hill, N.C.
>
More information about the Insight-developers
mailing list