author | Rodrigo Campos
<rodrigo@sdfg.com.ar> 2010-09-05 16:42:30 UTC |
committer | Alberto Bertogli
<albertito@blitiri.com.ar> 2010-09-06 21:26:41 UTC |
parent | a7cda8f2502a9460d8ffeab8b55edf856015a762 |
aritmetica.hpp | +6 | -0 |
babilonio.cpp | +1 | -1 |
binomial.cpp | +4 | -4 |
calc.cpp | +3 | -3 |
fcont.cpp | +1 | -1 |
diff --git a/aritmetica.hpp b/aritmetica.hpp index 34f2868..5bd8f79 100644 --- a/aritmetica.hpp +++ b/aritmetica.hpp @@ -2,6 +2,12 @@ #ifndef _ARITMETICA_HPP #define _ARITMETICA_HPP +#if __WORDSIZE == 64 +#define print_64t "l" +#else +#define print_64t "ll" +#endif + class numero { public: diff --git a/babilonio.cpp b/babilonio.cpp index 4f50b1b..54e21e2 100644 --- a/babilonio.cpp +++ b/babilonio.cpp @@ -26,7 +26,7 @@ int main(int argc, char *argv[]) n1 = n0 / 2.0 + 1 / n0; } - printf("%.60f 0x%lx\n", n1.to_double(), to_u64(n1)); + printf("%.60f 0x%" print_64t "x\n", n1.to_double(), to_u64(n1)); return 0; } diff --git a/binomial.cpp b/binomial.cpp index a2fde3e..e311e6f 100644 --- a/binomial.cpp +++ b/binomial.cpp @@ -45,16 +45,16 @@ int main(int argc, char *argv[]) /* XXX DEBUG - SACAR */ #if 0 - printf(" %.60f 0x%lx\n", + printf(" %.60f 0x%" print_64t "x\n", numerador.to_double(), to_u64(numerador)); - printf(" %.60f 0x%lx\n", + printf(" %.60f 0x%" print_64t "x\n", denominador.to_double(), to_u64(denominador)); printf(" ---\n"); #endif - //printf(" %d %.60f 0x%lx\n", i, n.to_double(), to_u64(n)); + //printf(" %d %.60f 0x%" print_64t "x\n", i, n.to_double(), to_u64(n)); } - printf("%.60f 0x%lx\n", n.to_double(), to_u64(n)); + printf("%.60f 0x%" print_64t "x\n", n.to_double(), to_u64(n)); return 0; } diff --git a/calc.cpp b/calc.cpp index 4574fee..6e72178 100644 --- a/calc.cpp +++ b/calc.cpp @@ -16,8 +16,8 @@ int main(int argc, char *argv[]) char op = argv[3][0]; numero b(prec, strtod(argv[4], NULL)); - printf("a =\t %.60f 0x%lx\n", a.to_double(), to_u64(a)); - printf("b =\t %.60f 0x%lx\n", b.to_double(), to_u64(b)); + printf("a =\t %.60f 0x%" print_64t "x\n", a.to_double(), to_u64(a)); + printf("a =\t %.60f 0x%" print_64t "x\n", b.to_double(), to_u64(b)); numero res; switch (op) { @@ -38,7 +38,7 @@ int main(int argc, char *argv[]) return 1; } - printf("a %c b =\t %.60f 0x%lx\n", op, res.to_double(), to_u64(res)); + printf("a %c b =\t %.60f 0x%" print_64t "x\n", op, res.to_double(), to_u64(res)); return 0; } diff --git a/fcont.cpp b/fcont.cpp index c613f5d..0f2799f 100644 --- a/fcont.cpp +++ b/fcont.cpp @@ -25,7 +25,7 @@ int main(int argc, char *argv[]) /* El Ășltimo tĂ©rmino tiene sumado 1 en lugar de 2 */ n = numero(prec, 1) / n + 1.0; - printf("%.60f 0x%lx\n", n.to_double(), to_u64(n)); + printf("%.60f 0x%" print_64t "x\n", n.to_double(), to_u64(n)); return 0; }