[prev in list] [next in list] [prev in thread] [next in thread]
List: pdf-devel
Subject: [pdf-devel] pdf_fp_real_to_string
From: Bhaskar Bhat <bblingeek () gmail ! com>
Date: 2010-07-25 5:29:57
Message-ID: AANLkTikKaqTj=b=cXceXtrOmFL=AfbeEwP_3Rn60Kkqv () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Hello,
*Attaching herewith a routine to convert FP number to string.*
I would like to get feedback from those working on this task.
Whether this is what is required ?
If Yes, kindly guide me on the steps to contribute the same ?
If No, kindly suggest how to go about it ?
OR
Kindly let me know some other task to take up !!
Regards
*Bhaskar*
[Attachment #5 (text/html)]
Hello,<br><br><b>Attaching herewith a routine to convert FP number to strin=
g.</b><br><br>I would like to get feedback from those working on this task.=
<br>Whether this is what is required ?<br><br>If Yes, kindly guide me on th=
e steps to contribute the same ?<br>
If No, kindly suggest how to go about it ?<br><br>OR<br>Kindly let me know =
some other task to take up !!<br><br>Regards<br><b>Bhaskar</b><br>
--00163645928c1b28df048c2f64af--
["routine.c" (text/x-csrc)]
#include <stdio.h>
#include <malloc.h>
int double_to_string(double number, char* buffer, int size, int precision)
{
int i = 0;
if(precision > size)
return 1;
snprintf(buffer, size, "%lf", number);
while(buffer[i])
{
if(buffer[i] == '.')
{
if((precision == 0) || (i == size - 2))
buffer[i] = '\0';
else
buffer[i + precision + 1] = '\0';
break;
}
i++;
}
printf("%s\n", buffer);
return 0;
}
int main()
{
char *buff = NULL;
buff = (char*)malloc(15);
double_to_string(-0.322837, buff, 14, 6);
free(buff);
return 0;
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic