#include <stdio.h>
#include <math.h>
void putll(long long n)
{
char r = n % 10;
if (n >= 10) {
putll(n / 10);
}
}
void putdouble(double d)
{
double x = d;
long long l;
int i;
char n;
if (x < 0) { // 負ならマイナス符号を出力してxの正負反転
x *= -1;
}
putll(l);
x -= l; // 小数部分を取り出す
for (i=0; i<6; ++i) { // 小数部は6桁表示
x *= 10;
x -= n;
}
}
int main(void) {
putdouble(-123.000123);
putdouble(123123);
putdouble(1.0/7.0);
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxtYXRoLmg+Cgp2b2lkIHB1dGxsKGxvbmcgbG9uZyBuKQp7CgljaGFyIHIgPSBuICUgMTA7CglpZiAobiA+PSAxMCkgewoJCXB1dGxsKG4gLyAxMCk7CQkKCX0KCXB1dGNoYXIoJzAnICsgcik7Cn0KCnZvaWQgcHV0ZG91YmxlKGRvdWJsZSBkKQp7Cglkb3VibGUgeCA9IGQ7Cglsb25nIGxvbmcgbDsKCWludCBpOwoJY2hhciBuOwoKCWlmICh4IDwgMCkgeyAvLyDosqDjgarjgonjg57jgqTjg4rjgrnnrKblj7fjgpLlh7rlipvjgZfjgaZ444Gu5q2j6LKg5Y+N6LuiCgkJcHV0Y2hhcignLScpOyAKCQl4ICo9IC0xOwoJfQoJbCA9IGZsb29yKHgpOyAvLyB444Gu5pW05pWw6YOo5YiGCglwdXRsbChsKTsKCQoJcHV0Y2hhcignLicpOwoJCgl4IC09IGw7IC8vIOWwj+aVsOmDqOWIhuOCkuWPluOCiuWHuuOBmQoJZm9yIChpPTA7IGk8NjsgKytpKSB7IC8vIOWwj+aVsOmDqOOBrzbmoYHooajnpLoKCQl4ICo9IDEwOwoJCW4gPSBmbG9vcih4KTsKCQlwdXRjaGFyICgnMCcgKyBuKTsKCQl4IC09IG47Cgl9CglwdXRjaGFyKCdcbicpOwp9CgppbnQgbWFpbih2b2lkKSB7CgoJcHV0ZG91YmxlKC0xMjMuMDAwMTIzKTsKCXB1dGRvdWJsZSgxMjMxMjMpOwoJcHV0ZG91YmxlKDEuMC83LjApOwoKCXJldHVybiAwOwp9Cgo=