Skip to content
Success

Changes

Summary

  1. ToSI tweaks (commit: 02fab0d) (details)
Commit 02fab0d671985f54d3a22d769affa904db3294b6 by lamont
ToSI tweaks

It looks like maxPrecision is designed to avoid things like
"0.0000000001 qm" for very small values and turn that into
"0.000 qm" instead.  What using values like "-1" did is just
kind of butcher the formatting for values smaller than 1.0 and
lose the significant digits.  There's an optimal value for a given
number of sigfigs to set maxPrecision to in order to get a fixed-width
number of characters of precision that doesn't overflow with very,
very tiny values.  That is now the default, and it adapts by default to
the setting of SigFigs..  The arguments have also been swapped so
that sigFigs is first and that's the one that should probably
be used.

When it comes to existing uses, stuff like ToSI(-1) has been converted
to the default.  When it comes to ToSI(3) that probably was intended to
mean 3 sigFigs but never did that so most of that is just set to the
default as well.  Stuff that was ToSI(-1, 3) has been converted to
ToSI(3) since that was correctly setting 3 sigFigs.

Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
(commit: 02fab0d)
The file was modified MechJebLibTest/Utils/StaticTests.cs (diff)
The file was modified MechJeb2/MechJebModuleFlightRecorderGraph.cs (diff)
The file was modified MechJeb2/MechJebModuleInfoItems.cs (diff)
The file was modified MechJeb2/MechJebLib/Utils/Statics.cs (diff)
The file was modified MechJeb2/MechJebStageStatsHelper.cs (diff)
The file was modified MechJeb2/MechJebModuleAscentClassicPathMenu.cs (diff)
The file was modified MechJeb2/ScriptsModule/MechJebModuleScriptCondition.cs (diff)
The file was modified MechJeb2/MechJebModuleLandingGuidance.cs (diff)
The file was modified MechJeb2/MechJebModuleSpaceplaneGuidance.cs (diff)
The file was modified MechJeb2/MechJebLib/PVG/Solution.cs (diff)
The file was modified MechJeb2/MechJebModuleCustomInfoWindow.cs (diff)
The file was modified MechJeb2/VesselState.cs (diff)
The file was modified MechJeb2/MechJebModuleRendezvousGuidance.cs (diff)