comparison libinterp/octave-value/ov-base.cc @ 30868:79edd49a5a97

maint: Merge stable to default.
author Markus Mützel <markus.muetzel@gmx.de>
date Mon, 28 Mar 2022 19:52:24 +0200
parents 97504d2edcc7 014030798d5e
children
comparison
equal deleted inserted replaced
30866:a8d61c30f41a 30868:79edd49a5a97
472 catch (octave::execution_exception& ee) \ 472 catch (octave::execution_exception& ee) \
473 { \ 473 { \
474 err_wrong_type_arg (ee, "octave_base_value::" #F "_value ()", type_name ()); \ 474 err_wrong_type_arg (ee, "octave_base_value::" #F "_value ()", type_name ()); \
475 } \ 475 } \
476 \ 476 \
477 static const double out_of_range_top \
478 = static_cast<double>(std::numeric_limits<T>::max ()) + 1.; \
477 if (require_int && octave::math::x_nint (d) != d) \ 479 if (require_int && octave::math::x_nint (d) != d) \
478 error_with_cfn ("conversion of %g to " #T " value failed", d); \ 480 error_with_cfn ("conversion of %g to " #T " value failed", d); \
479 else if (d < std::numeric_limits<T>::min ()) \ 481 else if (d < std::numeric_limits<T>::min ()) \
480 retval = std::numeric_limits<T>::min (); \ 482 retval = std::numeric_limits<T>::min (); \
481 else if (d > std::numeric_limits<T>::max ()) \ 483 else if (d >= out_of_range_top) \
482 retval = std::numeric_limits<T>::max (); \ 484 retval = std::numeric_limits<T>::max (); \
483 else \ 485 else \
484 retval = static_cast<T> (octave::math::fix (d)); \ 486 retval = static_cast<T> (octave::math::fix (d)); \
485 \ 487 \
486 return retval; \ 488 return retval; \