Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template<class F, class>
- void
- number::
- assign(F v) noexcept
- {
- static exponent_type const bias =
- static_cast<exponent_type>(std::floor(
- std::log10((std::numeric_limits<
- mantissa_type>::max)()))) - 1;
- if(v < 0)
- {
- v = -v;
- neg_ = true;
- }
- else
- {
- neg_ = false;
- }
- exp_ = static_cast<exponent_type>(
- std::floor(std::log10(v))) - bias;
- mant_ = static_cast<mantissa_type>(
- v / std::pow(10, exp_));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement