Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %g
- %g
- %g
- %g
- %g
- #include <math.h>
- double x;
- ...
- if (floor(x) == x && x != 0.0) { // x is an non-zero integer value
- int digits = floor(log10(fabs(x)+0.5)) + 1;
- printf("x is %.*fn", digits, x);
- }
- x log10(x+0.5)
- 1 0.176091259055681000
- 9 0.977723605288848000
- 10 1.021189299069940000
- 99 1.997823080745730000
- 100 2.002166061756510000
- 999 2.999782798454140000
- 1000 3.000217092972230000
- 10000 4.000021714181250000
- 100000 5.000002171466980000
- 1000000 6.000000217147190000
- 10000000 7.000000021714720000
- 100000000 8.000000002171470000
- 1000000000 9.000000000217150000
Add Comment
Please, Sign In to add comment