Merge pull request #187 from divVerent/patch-1

Fix printing of floating poing values in -dumpfin.
This commit is contained in:
Dale Weiler 2019-02-04 09:20:23 -05:00 committed by GitHub
commit 451873ae52
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

5
ir.cpp
View file

@ -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);