50 result = std::to_string(
static_cast<int>( aValue ) );
66 int integer =
static_cast<int>( aValue );
67 result = std::to_string(integer);
71 double mantissa = aValue - integer;
74 result += std::to_string(
static_cast<int>( (mantissa*10)+0.5 ) );
100 int bufsize = 2*count*count;
104 for(
int ii = 0; ii < bufsize; ii++ )
114 std::vector<R_DATA> curr_list;
120 for(
int ii = 0; ; ii++ )
122 if( aList[ii] == 0.0 )
125 curr_r = curr_decade * aList[ii];
126 curr_list.emplace_back(
strValue( curr_r ), curr_r );
139 m_tables.push_back( std::move( curr_list ) );
151 if( i.e_value == aValue )
162 m_results.at(
S2R ).e_value = std::numeric_limits<double>::max();
164 for( i = 0; i < aSize; i++ )
188 for( i = 0; i < aSize; i++ )
190 for( j = 0; j < aSize; j++ )
198 std::string s =
"( ";
200 s.append(
" ) + ( " );
214 std::string s =
"( ";
216 s.append(
" ) | ( " );
226 printf(
"Calculation time = %d mS", timer.
msecs() );
247 uint32_t combi2R = 0;
265 m_combined_table[combi2R].e_value = i.e_value * j.e_value / ( i.e_value + j.e_value );
291 for( j = 0; j < aSize; j++ )
335 uint32_t no_of_2Rcombi = 0;
356 if( ( std::count( s.begin(), s.end(),
'+' ) == 2 )
357 || ( std::count( s.begin(), s.end(),
'|' ) == 2 ) )
359 s.erase( s.find(
"( " ), 2 );
360 s.erase( s.find(
" )" ), 2 );
375 if( ( std::count( s.begin(), s.end(),
'+' ) == 3 )
376 || ( std::count( s.begin(), s.end(),
'|' ) == 3 ) )
378 s.erase( s.find(
"( " ), 2 );
379 s.erase( s.find(
" )" ), 2 );
380 s.erase( s.find(
"( " ), 2 );
381 s.erase( s.find(
" )" ), 2 );
void combine4(uint32_t aSize)
Check if there is a better four component solution.
void Exclude(double aValue)
If any value of the selected E-series not available, it can be entered as an exclude value.
uint32_t combine2()
Build all 2R combinations from the selected E-series values.
int buildSeriesData(const double aList[])
Add values from aList to m_tables.
std::vector< R_DATA > m_combined_table
void Calculate()
called on calculate button to execute all the 2R, 3R and 4R calculations
std::vector< std::vector< R_DATA > > m_tables
void NewCalc()
initialize next calculation and erase results from previous calculation
std::array< R_DATA, S4R+1 > m_results
void simple_solution(uint32_t aSize)
Search for closest two component solution.
void combine3(uint32_t aSize)
Check if there is a better 3 R solution than previous one using only two components.
A small class to help profiling.
double msecs(bool aSinceLast=false)
static std::string strValue(double aValue)
#define E24_VALUES
E-Values derived from a geometric sequence formula by Charles Renard were already accepted and widely...
EDA_ANGLE abs(const EDA_ANGLE &aAngle)