Bug 5924: Particular scaled units show incorrect values (e.g. 1000 ML). Bug Number: 5924 Release notes (y/n): Yes 7.0.6 For Release Nums: 7.0.6 and 7.1 Gnats 5924: Numeric display incorrect when Scale equals scale of unit with respect to standard unit (e.g. 1000 ML). Certain Scale/Unit combinations produce incorrect value display (e.g. in the Open Slot Dialog). This is occurring, due to a coding mistake, for units of 1000 ML because 'ML' is 1000 times the standard volume unit (m3). (A cubic meter is 1000 liters. One million liters -- ML -- is 1000 cubic meters -- m3). See the middle, of three, slot dialogs in this screenshot. The value is actually 33.0 [1000 ML]. http://cadswes2.colorado.edu/~philw/2017/bugs/5924/KMLbug.png The 'units' file is used to defined units with respect to the standard unit of the unit's respective unit type (e.g. volume). (Units must be proportional to their unit type's standard unit). Here are the unit records for VOLUME units -- note the record for ML: m3 Volume 1.00 ft3 Volume 35.3146667214886 feet3 Volume 35.3146667214886 acre-ft Volume 0.000810713193789912 acre-feet Volume 0.000810713193789912 cfs-day Volume 0.000408734568535747 ksfd Volume 0.000000408734568535747 cfs-hr Volume 0.009809629644857928 kcfs-hr Volume 0.000009809629644857928 liters Volume 1000.0 ML Volume 0.001 <<<<<< SEE NOTE ABOVE <<<<<< GL Volume 0.000001 gal Volume 264.17210512 BG Volume 0.00000026417210512 KAF Volume 0.000000810713193789912 MAF Volume 0.000000000810713193789912 MCM Volume 0.000001 TCM Volume 0.001 survey_acreft Volume 0.000810708329520478 The cause of this bug is an incorrect optimization in method: SlotGUIUtils ::getValue (const Slot *slot, int slotTinx, int colNum, bool altUnits). The computation of the 'primFullFactor' product is used only for this optimization. See this code screenshot: http://cadswes2.colorado.edu/~philw/2017/bugs/5924/bug5924-Code.png Note that the optimization does happen to 'work' for the intended case: unscaled use of a standard unit (e.g. m3). This bug was introduced on 5-25-2006 (11 years ago) with development of the Flow/Volume Switch support for Account Slots in the Open SeriesSlot Dialog. (Commit 95d0fd3e6fad1143a05430cbece4f7c5b2783e4b). The fix consists of this change in double SlotGUIUtils::getValue() ... OLD: double primFullFactor = primUnitPtr->getFactor() * primUnitPtr->getScale(); if (primFullFactor == 1.0) ... { no conversion necessary; return standard value. } NEW: const double stdUnitFactor = primUnitPtr->getFactor(); const double scaleFactor = primUnitPtr->getScale(); if (stdUnitFactor == scaleFactor) { no conversion necessary; return standard value. } ---