NetBSD-Users archive

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

Re: Regarding ecvt() & fcvt() implementation



The more details about this implementation is given below:

cvt() function present in NetBsd :
src/lib/libc/stdio/vfprintf.c

static char *
cvt(value, ndigits, flags, sign, decpt, ch, length)
{
:
:
}

So, I have written ecvt & fcvt functions as below

char *
ecvt(double value, int ndigit, int *decpt, int *sign)
{
   return(cvt(value, ndigit, 0, sign, decpt, 'e', &addr));
}

char *
fcvt(double value, int ndigit, int *decpt, int *sign)
{

   return(cvt(value, ndigit, 0, sign, decpt, 'f', &addr));
}

But When I tested with the sample test below,

test.c:

int main ()
{
 int decpt, sign;
 char buf[10];
  char *p;

 p = ecvt(10.0, 1, &decpt, &sign);
 printf("decpt = %d,sign = %d,p = %s \n",decpt,sign,p);
 return 0;
} 


I am getting the output as decpt = 2,sign = 12082816,p = 10 For netBsd
But with glibc output is decpt = 2, sign = 0, p =1

Please let me know is something wrong with my implementation ??
Or Do I need to modify the cvt() implementation, to get ecvt()
& fcvt() functions.

Please help me in this regard, Waiting for reply.

Thank You,
 Amol 


On Tue, 01 Sep 2009 14:40:11 +0530  wrote
>Hi,
I am the netbsd user from last one year.
I have one doubt which I would like to ask here.
When I checked the netbsd source, I found cvt() function is available but 
ecvt() & fcvt() 
is not implemented. So how can I implemented ecvt() & fcvt() functions using 
cvt().
Is it possible to implement these using cvt() ? 
I found in openbsd they have implemented ecvt & fcvt functions using cvt.
Can anybody already tried to implemented it in netbsd.
Please let me know.

Waiting for reply,

Thank You,
Amol Pise


Home | Main Index | Thread Index | Old Index