From d8d07eff702b303b9458ac5622bdc42e5a0c1f93 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 1 Dec 2007 12:46:25 +0300 Subject: [PATCH] Fixed the build failure on Windows. It does not have trunc() defined in math.h, so we should not use it code. --- sql/field.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sql/field.cc b/sql/field.cc index c604f04339c..1878797297f 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -5909,6 +5909,7 @@ int Field_str::store(double nr) uint length; uint local_char_length= field_length / charset()->mbmaxlen; double anr= fabs(nr); + bool fractional= (anr != floor(anr)); int neg= (nr < 0.0) ? 1 : 0; uint max_length; int exp; @@ -5937,7 +5938,7 @@ int Field_str::store(double nr) calculate the maximum number of significant digits if the 'f'-format would be used (+1 for decimal point if the number has a fractional part). */ - digits= max(0, (int) max_length - (nr != trunc(nr))); + digits= max(0, (int) max_length - fractional); /* If the exponent is negative, decrease digits by the number of leading zeros after the decimal point that do not count as significant digits.