From f14bb809c49692d8ce212947de35218fa3b65d73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Pe=C3=B1aranda?= Date: Fri, 6 Jul 2012 16:59:30 +0000 Subject: [PATCH] avoided one compiler warning in Gmpfr_type.h --- Number_types/include/CGAL/GMP/Gmpfr_type.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Number_types/include/CGAL/GMP/Gmpfr_type.h b/Number_types/include/CGAL/GMP/Gmpfr_type.h index 4c3002990c5..a1449d20fc9 100644 --- a/Number_types/include/CGAL/GMP/Gmpfr_type.h +++ b/Number_types/include/CGAL/GMP/Gmpfr_type.h @@ -1162,7 +1162,7 @@ std::ostream& operator<<(std::ostream& os,const Gmpfr &a){ return os; } else { // human-readable format - mp_exp_t expptr; + mpfr_exp_t expptr; char *str = mpfr_get_str(NULL, &expptr, 10, 0, a.fr(), mpfr_get_default_rounding_mode()); if (str == NULL) return os << "@err@"; @@ -1184,7 +1184,10 @@ std::ostream& operator<<(std::ostream& os,const Gmpfr &a){ } else if (expptr < 0) { s.insert(i, -expptr, '0'); // .00000125 -- .0125 s.insert(i, 1, '.'); - } else if (expptr < n) { // .125 -- 12.5 + // The following cast of expptr is done for avoiding some + // compiler warnings. The cast is exact, because we know + // expptr is not negative here. + } else if ((size_t)expptr < n) { // .125 -- 12.5 s.insert(i+expptr, 1, '.'); } else if (expptr - n <= 5) { // 125 -- 12500000 s.append(expptr - n, '0');