From: divVerent Date: Mon, 4 Feb 2019 14:14:58 +0000 (-0800) Subject: Fix printing of floating poing values in -dumpfin. X-Git-Tag: xonotic-v0.8.5~16^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=9c81ff263aa3f38252bdfe704e5051431e30aefa;p=xonotic%2Fgmqcc.git Fix printing of floating poing values in -dumpfin. %g is not lossless for single precision floats - %.9g is (other than distinguishing NaNs, who cares). --- diff --git a/ir.cpp b/ir.cpp index facbc33..8388aab 100644 --- a/ir.cpp +++ b/ir.cpp @@ -4054,10 +4054,11 @@ void ir_value::dump(int (*oprintf)(const char*, ...)) const oprintf("fn:%s", m_name.c_str()); break; case TYPE_FLOAT: - oprintf("%g", m_constval.vfloat); + // %.9g is lossless for IEEE single precision. + oprintf("%.9g", m_constval.vfloat); break; case TYPE_VECTOR: - oprintf("'%g %g %g'", + oprintf("'%.9g %.9g %.9g'", m_constval.vvec.x, m_constval.vvec.y, m_constval.vvec.z);