Better normalization rules for SPICE_VALUE

This commit is contained in:
Maciej Suminski 2016-08-11 14:41:55 +02:00
parent 65c7520544
commit 65a0327e85
2 changed files with 3 additions and 1 deletions

View File

@ -87,7 +87,7 @@ void SPICE_VALUE::Normalize()
m_prefix = (UNIT_PREFIX)( m_prefix + 3 );
}
while( m_base != 0.0 && std::fabs( m_base ) <= 0.001 )
while( m_base != 0.0 && std::fabs( m_base ) <= 1.000 )
{
m_base *= 1000.0;
m_prefix = (UNIT_PREFIX)( m_prefix - 3 );

View File

@ -56,11 +56,13 @@ public:
SPICE_VALUE( int aInt, UNIT_PREFIX aPrefix = PFX_NONE )
: m_base( aInt ), m_prefix( aPrefix ), m_spiceStr( false )
{
Normalize();
}
SPICE_VALUE( double aDouble, UNIT_PREFIX aPrefix = PFX_NONE )
: m_base( aDouble ), m_prefix( aPrefix ), m_spiceStr( false )
{
Normalize();
}
void Normalize();