From 3357ca4240a1a3d4fea3254908ad6d3f2c3b1241 Mon Sep 17 00:00:00 2001 From: jkriege2 Date: Thu, 21 Apr 2022 21:24:45 +0200 Subject: [PATCH] fixed issue #56: exponent-labels were 0 below ~1e-16 ... reason was using ::epsilon() instead of ::min() for checking close to zero --- lib/jkqtcommon/jkqtpstringtools.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/jkqtcommon/jkqtpstringtools.cpp b/lib/jkqtcommon/jkqtpstringtools.cpp index 261ae2e0eb..b202d46149 100644 --- a/lib/jkqtcommon/jkqtpstringtools.cpp +++ b/lib/jkqtcommon/jkqtpstringtools.cpp @@ -209,7 +209,7 @@ std::string jkqtp_tolower(const std::string& s){ if (ensurePlusMinus) return "+\\rm{0}"; else return "\\rm{0}"; } - if (fabs(data)<5*std::numeric_limits::epsilon()) { + if (fabs(data)<5.0*std::numeric_limits::min()) { if (ensurePlusMinus) return "+\\rm{0}"; else return "\\rm{0}"; } @@ -239,7 +239,7 @@ std::string jkqtp_tolower(const std::string& s){ std::string jkqtp_floattohtmlstr(double data, int past_comma, bool remove_trail0, double belowIsZero, double minNoExponent, double maxNoExponent){ std::string result; if ((belowIsZero>0) && (fabs(data)::epsilon()) return "0"; + if (fabs(data)<5.0*std::numeric_limits::min()) return "0"; double adata=fabs(data); std::string res=jkqtp_floattostr(data, past_comma, remove_trail0);