pdf-devel
[Top][All Lists]
Advanced

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

Re: [pdf-devel] Number Conversion Routines


From: Jose E . Marchesi
Subject: Re: [pdf-devel] Number Conversion Routines
Date: Mon, 26 Jul 2010 14:13:38 +0200 (CEST)

    
    *Regarding "pdf_fp_real_to_string ()",*
    
    *- If the precision is 0, we need to take the max precision.
      My question is we need to find the precision from the number given or do
    we have a macro defined for max precision ?*

Since we are using float variables to implement pdf_realt_t, we can
use the FLT_DIG constant from float.h as the maximum precision.

  FLT_DIG
   
    This is the number of decimal digits of precision for the float
    data type. Technically, if p and b are the precision and base
    (respectively) for the representation, then the decimal precision
    q is the maximum number of decimal digits such that any floating
    point number with q base 10 digits can be rounded to a floating
    point number with p base b digits and back again, without change
    to the q decimal digits.
   
    The value of this macro is supposed to be at least 6, to satisfy ISO C.

BTW, it would good to make to make it clear in the manual what happens
if the requested precision is bigger than the max precision.
Something like:

@item precision
The number of decimal digits to include in the textual representation.
The maximum precision is used if the requested precision is @code{0}
or if it exceeds the maximum precision.

--
Jose E. Marchesi    address@hidden
GNU Project         http://www.gnu.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]