From 65a0327e8510a24a5d2b379dc2e673abc2cd19c7 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Thu, 11 Aug 2016 14:41:55 +0200 Subject: [PATCH] Better normalization rules for SPICE_VALUE --- eeschema/sim/spice_value.cpp | 2 +- eeschema/sim/spice_value.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/eeschema/sim/spice_value.cpp b/eeschema/sim/spice_value.cpp index dadb4be3de..2d6c4a733f 100644 --- a/eeschema/sim/spice_value.cpp +++ b/eeschema/sim/spice_value.cpp @@ -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 ); diff --git a/eeschema/sim/spice_value.h b/eeschema/sim/spice_value.h index b6d47da857..571acdd7f4 100644 --- a/eeschema/sim/spice_value.h +++ b/eeschema/sim/spice_value.h @@ -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();