mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-21 05:00:09 +01:00
nir/print: print large floats as mantissa + exponent
This is silly: con 64 %18698 = load_const (0xf0f0f0f0f0f0f0f0 = -107730874267432137203343331820822035577514310242782965586097631855966576162301880634213986293205127792322062538351156704152182839736964151026851280176102232488321269248467172131803507875122376996725092200401040958124190100858265776685056.000000 = -1085102592571150096 = 17361641481138401520) This is better: con 64 %18698 = load_const (0xf0f0f0f0f0f0f0f0 = -1.077309e+236 = -1085102592571150096 = 17361641481138401520) Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com> Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33456>
This commit is contained in:
parent
6b0ba1109a
commit
f921b42c8c
1 changed files with 6 additions and 13 deletions
|
|
@ -210,19 +210,12 @@ print_hex_terse_const_value(const nir_const_value *value, unsigned bit_size, FIL
|
||||||
static void
|
static void
|
||||||
print_float_const_value(const nir_const_value *value, unsigned bit_size, FILE *fp)
|
print_float_const_value(const nir_const_value *value, unsigned bit_size, FILE *fp)
|
||||||
{
|
{
|
||||||
switch (bit_size) {
|
double dval = nir_const_value_as_float(*value, bit_size);
|
||||||
case 64:
|
|
||||||
fprintf(fp, "%f", value->f64);
|
if (fabs(dval) >= 1000000.0)
|
||||||
break;
|
fprintf(fp, "%e", dval);
|
||||||
case 32:
|
else
|
||||||
fprintf(fp, "%f", value->f32);
|
fprintf(fp, "%f", dval);
|
||||||
break;
|
|
||||||
case 16:
|
|
||||||
fprintf(fp, "%f", _mesa_half_to_float(value->u16));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
unreachable("unhandled bit size");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue