-
Notifications
You must be signed in to change notification settings - Fork 394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Average values for integer output variables fail debug assert and are rounded to 2 places #9000
Comments
At v9.3.0, prior to moving away from gio to fmt: EnergyPlus/src/EnergyPlus/OutputProcessor.cc Lines 5289 to 5290 in baff089
So it should be be First datapoint, I made a custom build of objexxFCL extracted from E+ source at v9.3.0, and added a test
So it seemed that before
The big question is what should be a good default here?** Way too much information: Tracking it down in ObjexxFCL::gioClick to expandBefore the move away from gio, it was doing EnergyPlus/src/EnergyPlus/OutputProcessor.cc Line 156 in baff089
static ObjexxFCL::gio::Fmt fmtLD("*");
void WriteReportIntegerData(..., Real64 const repValue, ...) {
[...]
Real64 repVal = repValue:
ObjexxFCL::gio::write(NumberOut, fmtLD) << repVal;
strip_trailing_zeros(strip(NumberOut)); So the selected option was: Format.cc: void
FormatLD::out( std::ostream & stream, double const v, std::string const & ter )
{
stream << spc( ter ) << fmt::LD( v );
} fmt.hh: // List-Directed: double Specialization
inline
std::string
LD( double const v )
{
typedef TraitsLD< double > Tr;
return G( v, Tr::w, Tr::d, Tr::e, 1 );
}
TraitsLD.hh // TraitsLD: double Specialization
template<>
struct TraitsLD< double >
{
typedef double traits_type;
typedef std::size_t Size;
static Size const w = 24; // Field width
static Size const d = 15; // Fraction width
static Size const e = 3; // Exponent width
}; Now the actual call: fmt.hh:
p is resolved to -1, so we end up calling // General
template< typename T >
inline
std::string
G( T const & t, Size w = TraitsG< T >::w, Size const d = TraitsG< T >::d, Size const e = TraitsG< T >::e, int const k = 0 )
{
if ( w == NOSIZE ) w = TraitsG< T >::w;
if ( std::numeric_limits< T >::is_integer ) { // Integer
return I( t, w );
} else { // Treat as floating point
T const m( std::abs( t ) );
if ( m == T( 0.0 ) ) {
Size const n( std::min( e + 2, w ) );
return F( t, w - n, d - 1 ) + std::string( n, ' ' );
} else {
int const p( static_cast< int >( std::floor( std::log10( m ) + T( 1 ) ) ) ); // Fortran 2003 rounding modes are not supported
// int const p( static_cast< int >( std::log10( m / ( T( 1.0 ) - ( T( 0.5 ) * std::pow( T( 10.0 ), -d ) ) ) ) + T( 1.0 ) ) ); // "Compatible" rounding mode: r = 0.5
if ( ( 0 <= p ) && ( p <= int( d ) + 2 ) ) { // Use F editing
Size const n( std::min( e + 2, w ) );
return F( t, w - n, d - std::min( Size( p ), d ) ) + std::string( n, ' ' );
} else { // Use E editing
if ( w == 0ul ) { // Choose width
Size const e_( TraitsG< T >::e ); // G0.dEe form not allowed in Fortran: Set exponent width based on type
return E( t, d + e_ + 4, d, e_, k );
} else { // Use specified width
return E( t, w, d, e, k );
}
}
}
}
} |
#9000 - Average values for integer output variables fail debug assert and are rounded to 1 place
Issue overview
Defect file requests an integer output variable, Site Rain Status, for timestep, hourly, and monthly. When the averaged value is reported in a debug build, it trips on this assert in
strip_trailing_zeros
which is called from here in WriteReportIntegerData. Looks like this needs to use a different format for the actual integer timestep values vs the real averaged value.When the defect file is run with a release build, the April average is reported as 0.03 while the average of the timestep values is 0.033529. Seems like averages of integers should report more than two decimal places?
Details
Some additional details for this issue (if relevant):
Checklist
Add to this list or remove from it as applicable. This is a simple templated set of guidelines.
Defect file added:
1ZoneUncontrolled-RainStatus-ChicagoOHareApril.idf.txt
Ticket added to Pivotal for defect (development team task)
Pull request created (the pull request will have additional tasks related to reviewing changes that fix this defect)
The text was updated successfully, but these errors were encountered: