Use g instead of e for the fp values.

Need to up the precision by one due to the difference between g and e, but
much prettier. Might need to rename that function :P I wish I'd thought to
check if g would work, but thanks to divVerent for the suggestion.
This commit is contained in:
Bill Currie 2013-01-08 20:14:30 +09:00
parent b096a0242e
commit 6b97967a68
2 changed files with 6 additions and 6 deletions

View file

@ -97,16 +97,16 @@ PR_UglyValueString (progs_t *pr, etype_t type, pr_type_t *val)
dstring_copystr (line, "void");
break;
case ev_float:
dsprintf (line, "%.8e", val->float_var);
dsprintf (line, "%.9g", val->float_var);
break;
case ev_integer:
dsprintf (line, "%d", val->integer_var);
break;
case ev_vector:
dsprintf (line, "%.8e %.8e %.8e", VectorExpand (val->vector_var));
dsprintf (line, "%.9g %.9g %.9g", VectorExpand (val->vector_var));
break;
case ev_quat:
dsprintf (line, "%.8e %.8e %.8e %.8e", QuatExpand (val->quat_var));
dsprintf (line, "%.9g %.9g %.9g %.9g", QuatExpand (val->quat_var));
break;
default:
dsprintf (line, "bad type %i", type);

View file

@ -398,7 +398,7 @@ spawn_parms_array (void)
const char *parm;
for (i = 0; i < NUM_SPAWN_PARMS; i++) {
parm = va ("%.8e", svs.clients->spawn_parms[i]);
parm = va ("%.9g", svs.clients->spawn_parms[i]);
PL_A_AddObject (parms, PL_NewString (parm));
}
return parms;
@ -447,8 +447,8 @@ game_dict (void)
PL_D_AddObject (game, "current_skill",
PL_NewString (va ("%d", current_skill)));
PL_D_AddObject (game, "name", PL_NewString (sv.name));
// sv.time is a double, so it gets 16 digits after the .
PL_D_AddObject (game, "time", PL_NewString (va ("%.16e", sv.time)));
// sv.time is a double, so it gets 17 digits
PL_D_AddObject (game, "time", PL_NewString (va ("%.17g", sv.time)));
PL_D_AddObject (game, "lightstyles", lightstyles_array ());
PL_D_AddObject (game, "globals", ED_GlobalsDict (&sv_pr_state));
PL_D_AddObject (game, "entities", entities_array ());