I've declared a long double variable and tried to display it but could only display in exponential format.
The problem is, C allows me to declare a long double but printf and sprintf only handles up to the size of double (16 digits).
I need to at display the full value on the screen as well as converting it to a string using sprintf. To illustrate:
/* Dummy codes */
long double buf1, buf2, result;
buf1 = 12345678901234567.00;
buf2 = 12345678901234567.00;
result = buf1+buf2;
printf("result: %17.0f", result);
sprintf(ans, "%17.0f", result);
If printf and sprintf can't work please suggest other alternatives.
Note: The maximum length of the variable "result" can go up to 18 digits.
Please help, this is urgent. Thank you.