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: Bhaskar Bhat
Subject: Re: [pdf-devel] Number Conversion Routines
Date: Wed, 28 Jul 2010 09:14:57 +0530

Hello Jose,

Attaching herewith "routine.c".

It contains an implementation of pdf_fp_real_to_string().
Kindly review it and let me know if it is OK to merge.

NOTE : You can compile it using command "$ gcc routine.c"

Regards
Bhaskar

On Mon, Jul 26, 2010 at 5:43 PM, Jose E. Marchesi <address@hidden> wrote:

   *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

Attachment: routine.c
Description: Text Data


reply via email to

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