Better normalization rules for SPICE_VALUE
This commit is contained in:
parent
65c7520544
commit
65a0327e85
|
@ -87,7 +87,7 @@ void SPICE_VALUE::Normalize()
|
||||||
m_prefix = (UNIT_PREFIX)( m_prefix + 3 );
|
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_base *= 1000.0;
|
||||||
m_prefix = (UNIT_PREFIX)( m_prefix - 3 );
|
m_prefix = (UNIT_PREFIX)( m_prefix - 3 );
|
||||||
|
|
|
@ -56,11 +56,13 @@ public:
|
||||||
SPICE_VALUE( int aInt, UNIT_PREFIX aPrefix = PFX_NONE )
|
SPICE_VALUE( int aInt, UNIT_PREFIX aPrefix = PFX_NONE )
|
||||||
: m_base( aInt ), m_prefix( aPrefix ), m_spiceStr( false )
|
: m_base( aInt ), m_prefix( aPrefix ), m_spiceStr( false )
|
||||||
{
|
{
|
||||||
|
Normalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
SPICE_VALUE( double aDouble, UNIT_PREFIX aPrefix = PFX_NONE )
|
SPICE_VALUE( double aDouble, UNIT_PREFIX aPrefix = PFX_NONE )
|
||||||
: m_base( aDouble ), m_prefix( aPrefix ), m_spiceStr( false )
|
: m_base( aDouble ), m_prefix( aPrefix ), m_spiceStr( false )
|
||||||
{
|
{
|
||||||
|
Normalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Normalize();
|
void Normalize();
|
||||||
|
|
Loading…
Reference in New Issue