27 #ifndef MLN_CONVERT_IMPL_FROM_FLOAT_TO_VALUE_HH
28 # define MLN_CONVERT_IMPL_FROM_FLOAT_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 float& from, Value<V>&
to);
57 # ifndef MLN_INCLUDE_ONLY
67 from_float_to_value(
const float& from,
70 exact(to) = math::round<V>()(from);
78 from_float_to_value(
const float& from,
79 mln::value::Floating<V>&
to)
90 from_float_to_value(
const float& from,
95 mlc_abort(V)::check();
104 template <
typename V>
107 from_float_to_value_dispatch(
const float& from, Value<V>&
to)
109 impl::from_float_to_value(from, exact(to));
122 template <
typename V>
125 from_to_(
const float& from, Value<V>&
to)
127 internal::from_float_to_value_dispatch(from, to);
133 from_to_(
const float& from,
136 mln_precondition(from >= 0);
137 to = math::round<unsigned>()(from);
143 from_to_(
const float& from,
146 to = math::round<int>()(from);
152 from_to_(
const float& from,
155 to = math::round<short>()(from);
161 # endif // ! MLN_INCLUDE_ONLY
168 #endif // ! MLN_CONVERT_IMPL_FROM_FLOAT_TO_VALUE_HH