Clang says nan and isnan aren't in std namespace....

This commit is contained in:
Jeff Young 2022-06-11 21:10:07 +01:00
parent a0421b172a
commit 4f3cfdc92e
3 changed files with 33 additions and 33 deletions

View File

@ -61,7 +61,7 @@ bool IBIS_MATRIX_BANDED::Check()
for( int i = 0; i < m_bandwidth * m_dim; i++ ) for( int i = 0; i < m_bandwidth * m_dim; i++ )
{ {
if( std::isnan( m_data[i] ) ) if( isnan( m_data[i] ) )
{ {
Report( _( "There are NaN elements in a matrix." ), RPT_SEVERITY_ERROR ); Report( _( "There are NaN elements in a matrix." ), RPT_SEVERITY_ERROR );
status = false; status = false;
@ -84,7 +84,7 @@ bool IBIS_MATRIX_FULL::Check()
for( int i = 0; i < m_dim * m_dim; i++ ) for( int i = 0; i < m_dim * m_dim; i++ )
{ {
if( std::isnan( m_data[i] ) ) if( isnan( m_data[i] ) )
{ {
Report( _( "There are NaN elements in a matrix." ), RPT_SEVERITY_ERROR ); Report( _( "There are NaN elements in a matrix." ), RPT_SEVERITY_ERROR );
status = false; status = false;
@ -107,7 +107,7 @@ bool IBIS_MATRIX_SPARSE::Check()
for( int i = 0; i < m_dim * m_dim; i++ ) for( int i = 0; i < m_dim * m_dim; i++ )
{ {
if( std::isnan( m_data[i] ) ) if( isnan( m_data[i] ) )
{ {
Report( _( "There are NaN elements in a matrix." ), RPT_SEVERITY_ERROR ); Report( _( "There are NaN elements in a matrix." ), RPT_SEVERITY_ERROR );
status = false; status = false;
@ -121,7 +121,7 @@ bool IBIS_MATRIX_SPARSE::Check()
bool isNumberNA( double aNumber ) bool isNumberNA( double aNumber )
{ {
bool result = false; bool result = false;
double NA = std::nan( NAN_NA ); double NA = nan( NAN_NA );
return *reinterpret_cast<std::uint64_t*>(&aNumber) == *reinterpret_cast<std::uint64_t*>( &NA ); return *reinterpret_cast<std::uint64_t*>(&aNumber) == *reinterpret_cast<std::uint64_t*>( &NA );
} }
@ -129,11 +129,11 @@ bool TypMinMaxValue::Check()
{ {
bool status = true; bool status = true;
if( std::isnan( value[IBIS_CORNER::TYP] ) ) if( isnan( value[IBIS_CORNER::TYP] ) )
status = false; status = false;
if( std::isnan( value[IBIS_CORNER::MIN] ) && !isNumberNA( value[IBIS_CORNER::MIN] ) ) if( isnan( value[IBIS_CORNER::MIN] ) && !isNumberNA( value[IBIS_CORNER::MIN] ) )
status = false; status = false;
if( std::isnan( value[IBIS_CORNER::MAX] ) && !isNumberNA( value[IBIS_CORNER::MAX] ) ) if( isnan( value[IBIS_CORNER::MAX] ) && !isNumberNA( value[IBIS_CORNER::MAX] ) )
status = false; status = false;
return status; return status;
@ -188,17 +188,17 @@ bool IbisComponentPin::Check()
Report( _( "Model name cannot be empty." ), RPT_SEVERITY_ERROR ); Report( _( "Model name cannot be empty." ), RPT_SEVERITY_ERROR );
status = false; status = false;
} }
if( std::isnan( m_Rpin ) && !isNumberNA( m_Rpin ) ) if( isnan( m_Rpin ) && !isNumberNA( m_Rpin ) )
{ {
Report( _( "Rpin is not valid." ), RPT_SEVERITY_ERROR ); Report( _( "Rpin is not valid." ), RPT_SEVERITY_ERROR );
status = false; status = false;
} }
if( std::isnan( m_Lpin )&& !isNumberNA( m_Lpin ) ) if( isnan( m_Lpin )&& !isNumberNA( m_Lpin ) )
{ {
Report( _( "Lpin is not valid." ), RPT_SEVERITY_ERROR ); Report( _( "Lpin is not valid." ), RPT_SEVERITY_ERROR );
status = false; status = false;
} }
if( std::isnan( m_Cpin )&& !isNumberNA( m_Cpin ) ) if( isnan( m_Cpin )&& !isNumberNA( m_Cpin ) )
{ {
Report( _( "Cpin is not valid." ), RPT_SEVERITY_ERROR ); Report( _( "Cpin is not valid." ), RPT_SEVERITY_ERROR );
status = false; status = false;
@ -336,12 +336,12 @@ double IVtable::InterpolatedI( double aV, IBIS_CORNER aCorner )
} }
} }
Report( _( "Cannot interpolate the current based on this IV table." ), RPT_SEVERITY_ERROR ); Report( _( "Cannot interpolate the current based on this IV table." ), RPT_SEVERITY_ERROR );
return std::nan( "" ); return nan( "" );
} }
else else
{ {
// exiting the function here would mean the IV table is reversed. // exiting the function here would mean the IV table is reversed.
return std::nan( "" ); return nan( "" );
} }
// @TODO prefer another method such as a dichotomy // @TODO prefer another method such as a dichotomy
} }
@ -351,7 +351,7 @@ bool IVtable::Check()
bool status = true; bool status = true;
for( IVtableEntry& entry : m_entries ) for( IVtableEntry& entry : m_entries )
{ {
if( std::isnan( entry.V ) ) if( isnan( entry.V ) )
{ {
Report( _( "There is a Nan voltage in an IV table" ), RPT_SEVERITY_ERROR ); Report( _( "There is a Nan voltage in an IV table" ), RPT_SEVERITY_ERROR );
status = false; status = false;
@ -377,20 +377,20 @@ bool dvdtTypMinMax::Check()
{ {
bool status = true; bool status = true;
if( std::isnan( value[IBIS_CORNER::TYP].m_dv ) ) if( isnan( value[IBIS_CORNER::TYP].m_dv ) )
status = false; status = false;
if( std::isnan( value[IBIS_CORNER::TYP].m_dt ) ) if( isnan( value[IBIS_CORNER::TYP].m_dt ) )
status = false; status = false;
if( std::isnan( value[IBIS_CORNER::MIN].m_dv ) && !isNumberNA( value[IBIS_CORNER::MIN].m_dv ) ) if( isnan( value[IBIS_CORNER::MIN].m_dv ) && !isNumberNA( value[IBIS_CORNER::MIN].m_dv ) )
status = false; status = false;
if( std::isnan( value[IBIS_CORNER::MIN].m_dt ) && !isNumberNA( value[IBIS_CORNER::MIN].m_dt ) ) if( isnan( value[IBIS_CORNER::MIN].m_dt ) && !isNumberNA( value[IBIS_CORNER::MIN].m_dt ) )
status = false; status = false;
if( std::isnan( value[IBIS_CORNER::MIN].m_dv ) && !isNumberNA( value[IBIS_CORNER::MIN].m_dv ) ) if( isnan( value[IBIS_CORNER::MIN].m_dv ) && !isNumberNA( value[IBIS_CORNER::MIN].m_dv ) )
status = false; status = false;
if( std::isnan( value[IBIS_CORNER::MIN].m_dt ) && !isNumberNA( value[IBIS_CORNER::MIN].m_dt ) ) if( isnan( value[IBIS_CORNER::MIN].m_dt ) && !isNumberNA( value[IBIS_CORNER::MIN].m_dt ) )
status = false; status = false;
return status; return status;
@ -400,7 +400,7 @@ bool IbisRamp::Check()
{ {
bool status = true; bool status = true;
if( std::isnan( m_Rload ) ) if( isnan( m_Rload ) )
{ {
status = false; status = false;
Report( _( "Invalid R_load." ), RPT_SEVERITY_ERROR ); Report( _( "Invalid R_load." ), RPT_SEVERITY_ERROR );
@ -610,7 +610,7 @@ bool IbisPackageModel::Check()
status = false; status = false;
} }
if( std::isnan( m_numberOfPins ) ) if( isnan( m_numberOfPins ) )
{ {
Report( _( "Number of pins is invalid." ), RPT_SEVERITY_ERROR ); Report( _( "Number of pins is invalid." ), RPT_SEVERITY_ERROR );
status = false; status = false;
@ -813,8 +813,8 @@ bool IbisParser::readDvdt( std::string& aString, dvdt& aDest )
else if( aString == "NA" ) else if( aString == "NA" )
{ {
aDest.m_dv = std::nan( NAN_NA ); aDest.m_dv = nan( NAN_NA );
aDest.m_dt = std::nan( NAN_NA ); aDest.m_dt = nan( NAN_NA );
} }
else else
{ {
@ -848,11 +848,11 @@ bool IbisParser::parseDouble( double& aDest, std::string& aStr, bool aAllowModif
{ {
if( str == "NA" ) if( str == "NA" )
{ {
result = std::nan( NAN_NA ); result = nan( NAN_NA );
} }
else else
{ {
result = std::nan( NAN_INVALID ); result = nan( NAN_INVALID );
status = false; status = false;
} }
} }
@ -976,11 +976,11 @@ bool IbisParser::readInt( int& aDest )
{ {
if( str == "NA" ) if( str == "NA" )
{ {
result = std::nan( NAN_NA ); result = nan( NAN_NA );
} }
else else
{ {
result = std::nan( NAN_INVALID ); result = nan( NAN_INVALID );
status = false; status = false;
} }
} }

View File

@ -227,9 +227,9 @@ public:
std::string m_pinName; std::string m_pinName;
std::string m_signalName; std::string m_signalName;
std::string m_modelName; std::string m_modelName;
double m_Rpin = std::nan( NAN_NA ); double m_Rpin = nan( NAN_NA );
double m_Lpin = std::nan( NAN_NA ); double m_Lpin = nan( NAN_NA );
double m_Cpin = std::nan( NAN_NA ); double m_Cpin = nan( NAN_NA );
int m_Rcol = 0; int m_Rcol = 0;
int m_Lcol = 0; int m_Lcol = 0;

View File

@ -131,19 +131,19 @@ KIBIS_PIN::KIBIS_PIN( KIBIS* aTopLevel, IbisComponentPin& aPin, IbisComponentPac
// @TODO : Reading the IBIS standard, I can't figure out if we are supposed // @TODO : Reading the IBIS standard, I can't figure out if we are supposed
// to replace typ, min, and max, or just the typ ? // to replace typ, min, and max, or just the typ ?
if( !std::isnan( aPin.m_Lpin ) ) if( !isnan( aPin.m_Lpin ) )
{ {
R_pin->value[IBIS_CORNER::TYP] = aPin.m_Rpin; R_pin->value[IBIS_CORNER::TYP] = aPin.m_Rpin;
R_pin->value[IBIS_CORNER::MIN] = aPin.m_Rpin; R_pin->value[IBIS_CORNER::MIN] = aPin.m_Rpin;
R_pin->value[IBIS_CORNER::MAX] = aPin.m_Rpin; R_pin->value[IBIS_CORNER::MAX] = aPin.m_Rpin;
} }
if( !std::isnan( aPin.m_Lpin ) ) if( !isnan( aPin.m_Lpin ) )
{ {
L_pin->value[IBIS_CORNER::TYP] = aPin.m_Lpin; L_pin->value[IBIS_CORNER::TYP] = aPin.m_Lpin;
L_pin->value[IBIS_CORNER::MIN] = aPin.m_Lpin; L_pin->value[IBIS_CORNER::MIN] = aPin.m_Lpin;
L_pin->value[IBIS_CORNER::MAX] = aPin.m_Lpin; L_pin->value[IBIS_CORNER::MAX] = aPin.m_Lpin;
} }
if( !std::isnan( aPin.m_Cpin ) ) if( !isnan( aPin.m_Cpin ) )
{ {
C_pin->value[IBIS_CORNER::TYP] = aPin.m_Cpin; C_pin->value[IBIS_CORNER::TYP] = aPin.m_Cpin;
C_pin->value[IBIS_CORNER::MIN] = aPin.m_Cpin; C_pin->value[IBIS_CORNER::MIN] = aPin.m_Cpin;