File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -2929,14 +2929,14 @@ fmountlens[] = {
29292929
29302930 if (temp == 0 )
29312931 os << 0 ;
2932- else if ( std::numeric_limits< float >:: min () > temp || temp > std::numeric_limits< float >:: max () )
2932+ else if (! std::isfinite ( temp) )
29332933 os << " (" << value << " )" ;
2934- else if ( ( int (temp)/temp) > 0.999 )
2935- os << int (temp);
2936- else if ( std::numeric_limits< float >:: min () <= (temp* 2 ) && (temp* 2 ) <= std::numeric_limits< float >:: max () && (( int ( temp*2 )/(temp* 2 )) > 0.999 ) )
2937- os << int (temp)* 2 << " /2" ;
2938- else if ( std::numeric_limits< float >:: min () <= (temp* 3 ) && (temp* 3 ) <= std::numeric_limits< float >:: max () && (( int ( temp*3 )/(temp* 3 )) > 0.999 ) )
2939- os << int (temp)* 3 << " /3" ;
2934+ else if (std::abs ( std::fmod (temp, 1 )) < 0.001 )
2935+ os << std::round (temp);
2936+ else if (std::abs ( std::fmod ( temp*2 , 1 )) < 0.001 )
2937+ os << std::round (temp* 2 ) << " /2" ;
2938+ else if (std::abs ( std::fmod ( temp*3 , 1 )) < 0.001 )
2939+ os << std::round (temp* 3 ) << " /3" ;
29402940 else
29412941 os << std::setprecision (3 ) << temp;
29422942
You can’t perform that action at this time.
0 commit comments