27 #ifndef MLN_CONVERT_IMPL_FROM_DOUBLE_TO_VALUE_HH
28 # define MLN_CONVERT_IMPL_FROM_DOUBLE_TO_VALUE_HH
37 # include <mln/value/concept/integer.hh>
38 # include <mln/value/concept/floating.hh>
39 # include <mln/core/concept/value.hh>
40 # include <mln/math/round.hh>
50 void from_to_(
const double& from, Value<V>& to);
53 void from_to_(
const double& from,
unsigned& to);
56 void from_to_(
const double& from,
int& to);
59 # ifndef MLN_INCLUDE_ONLY
72 from_double_to_value(
const double& from,
75 exact(to) = math::round<V>(from);
83 from_double_to_value(
const double& from,
95 from_double_to_value(
const double& from,
100 mlc_abort(V)::check();
109 template <
typename V>
112 from_double_to_value_dispatch(
const double& from, Value<V>&
to)
114 impl::from_double_to_value(from,
exact(to));
123 template <
typename V>
126 from_to_(
const double& from, Value<V>& to)
128 convert::internal::from_double_to_value_dispatch(from, to);
134 from_to_(
const double& from,
unsigned& to)
136 mln_precondition(from >= 0);
137 to = math::round<unsigned>(from);
143 from_to_(
const double& from,
int& to)
145 to = math::round<int>(from);
148 # endif // ! MLN_INCLUDE_ONLY
153 #endif // ! MLN_CONVERT_IMPL_FROM_DOUBLE_TO_VALUE_HH