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>
54 from_to(
const double& from, Value<V>&
to);
57 # ifndef MLN_INCLUDE_ONLY
67 from_double_to_value(
const double& from,
70 exact(to) = math::round<V>()(from);
78 from_double_to_value(
const double& from,
79 mln::value::Floating<V>&
to)
90 from_double_to_value(
const double& from,
95 mlc_abort(V)::check();
104 template <
typename V>
107 from_double_to_value_dispatch(
const double& from, Value<V>&
to)
109 impl::from_double_to_value(from, exact(to));
122 template <
typename V>
125 from_to_(
const double& from, Value<V>&
to)
127 internal::from_double_to_value_dispatch(from, to);
133 from_to_(
const double& from,
136 mln_precondition(from >= 0);
137 to = math::round<unsigned>()(from);
143 from_to_(
const double& from,
146 to = math::round<int>()(from);
151 # endif // ! MLN_INCLUDE_ONLY
158 #endif // ! MLN_CONVERT_IMPL_FROM_DOUBLE_TO_VALUE_HH