mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-15 10:43:15 +02:00
Protect from_chars from clang
This commit is contained in:
parent
fd57f637ac
commit
af852ea15d
@ -387,12 +387,16 @@ std::string SIM_VALUE::ConvertNotation( const std::string& aString, NOTATION aFr
|
|||||||
int expReduction = 0;
|
int expReduction = 0;
|
||||||
std::string prefix = SIM_VALUE_PARSER::ExponentToUnitPrefix( exponent, expReduction,
|
std::string prefix = SIM_VALUE_PARSER::ExponentToUnitPrefix( exponent, expReduction,
|
||||||
aToNotation );
|
aToNotation );
|
||||||
|
|
||||||
double significand{};
|
double significand{};
|
||||||
|
#ifndef defined( __clang__ )
|
||||||
|
// clang still violates the standard
|
||||||
// best effort, ignore errors
|
// best effort, ignore errors
|
||||||
std::from_chars( parseResult.significand.data(),
|
std::from_chars( parseResult.significand.data(),
|
||||||
parseResult.significand.data() + parseResult.significand.size(),
|
parseResult.significand.data() + parseResult.significand.size(),
|
||||||
significand );
|
significand );
|
||||||
|
#else
|
||||||
|
wxString( parseResult.significand ).ToCDouble( &significand );
|
||||||
|
#endif
|
||||||
|
|
||||||
exponent -= expReduction;
|
exponent -= expReduction;
|
||||||
return fmt::format( "{:g}{}", significand * std::pow( 10, exponent ),
|
return fmt::format( "{:g}{}", significand * std::pow( 10, exponent ),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user