Re: Big numbers
- From: "Chris M. Thomasson" <no@xxxxxxxxxxxx>
- Date: Tue, 13 Jan 2009 11:27:22 -0800
"marc" <marc.tessis@xxxxxxxxxxxx> wrote in message news:95e1eae0-1267-4985-8362-2b06001a9f32@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hello,
I get a number like 33748440199875750.25 from a database.
I must convert it to a string.
How could I do ?
I tried double, float, _int64, etc... I always lose precison (eg, I
get 33748440199875752. => + 2 ) before converting it.
I know it's relative to IEEE, but I can't find a solution to simply
convert it to a string
Thanks in advance.
I guess you could try something out that is analogous to the following MSVC++ specific code:
___________________________________________________________________
#include <stdio.h>
struct number_parts {
char sign;
unsigned __int64 decimal;
unsigned __int64 non_decimal;
};
union number {
struct number_parts parts;
unsigned char buf[sizeof(struct number_parts)];
};
int main(void) {
union number x;
x.parts.sign = '+';
x.parts.decimal = 25;
x.parts.non_decimal = 33748440199875750;
printf("%c%I64u.%I64u\n", x.parts.sign, x.parts.non_decimal, x.parts.decimal);
return 0;
}
___________________________________________________________________
lol! ;^)
.
- Follow-Ups:
- Re: Big numbers
- From: Chris M. Thomasson
- Re: Big numbers
- References:
- Big numbers
- From: marc
- Big numbers
- Prev by Date: Re: Big numbers
- Next by Date: Re: large array?? how to avoid stack overflow?
- Previous by thread: Re: Big numbers
- Next by thread: Re: Big numbers
- Index(es):
Relevant Pages
|