Ensure values with units are displayed correctly when numbers are very small.
from master branch. see https://gitlab.com/kicad/code/kicad/issues/5074
This commit is contained in:
parent
bab61dd249
commit
74adbbcc5d
|
@ -90,12 +90,18 @@ void SPICE_VALUE::Normalize()
|
||||||
{
|
{
|
||||||
m_base *= 0.001;
|
m_base *= 0.001;
|
||||||
m_prefix = (UNIT_PREFIX)( m_prefix + 3 );
|
m_prefix = (UNIT_PREFIX)( m_prefix + 3 );
|
||||||
|
|
||||||
|
if( m_prefix == PFX_TERA ) // this is the biggest unit available
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
while( m_base != 0.0 && std::fabs( m_base ) < 1.000 )
|
while( m_base != 0.0 && std::fabs( m_base ) < 1.000 )
|
||||||
{
|
{
|
||||||
m_base *= 1000.0;
|
m_base *= 1000.0;
|
||||||
m_prefix = (UNIT_PREFIX)( m_prefix - 3 );
|
m_prefix = (UNIT_PREFIX)( m_prefix - 3 );
|
||||||
|
|
||||||
|
if( m_prefix == PFX_FEMTO ) // this is the smallest unit available
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue