Skip to content

Commit

Permalink
Major overhaul of implementation
Browse files Browse the repository at this point in the history
- Split default_float_traits into two, ieee754_binary_traits and default_float_bit_carrier_conversion_traits. The first is responsible for interpretation of given bit patterns stored in an unsigned integer type, and the second is responsible for converting between floating-point types and unsigned integer bit carrier types.
- remove_exponent_bits() now doesnt' take exponent_bits. It now performs masking rather than XOR-ing.
- Add missing 32-bit/64-bit maskings for std::uint_least32_t/std::uint_least64_t instances.
- Correct several typos and misleading comments.
- float_bits, signed_significand_bits are now only parametrized over the format-traits type, rather than floating-point & traits pair. Any features involving conversion into/from floating-point types are thus removed.
- Instead, add a factory function make_float_bits. For the reverse conversion, direct use of the conversion-traits is required.
- Remove carrier_uint alias inside decimal_fp, as it's not necessary.
- Move cache_holder out of the detail namespace, because user may need to specialize it.
- Rename compressed_cache_detail into compressed_cache_holder and also move it out of the detail namespace for the same reason.
- Add several static members and type aliases into compressed_cache_holder, and rename pow5 into pow5_table.
- Move compressed cache retrieval mechanism from detail::policy_impl::cache::compact into compressed_cache_holder, because it may need to be specialized by user.
- detail::impl is now parametrized over only format-traits type.
- Replace several constexpr by JKJ_CONSTEXPR20 as it was technically UB.
- Handling of shorter interval case is now copy-pasted into the main routine to simplify argument passing. May need to add [[unlikely]] in the future?
- Sign handling is also done inside the main routine now.
- Simplify the policy-dependent dispatch mechanism. Thes three together resolve #53.
- Move compute_mul_impl out of detail::impl, and also out of the detail namespace, and then rename it into multiplication_traits, because user may want to specialize it.
- Remove several unneeded members from detail::impl.
- Rename to_decimal taking signed_significand_bits & exponent bits pair into to_decimal_ex. Previously it was impossible to call this overload without manually specifying the template parameters.
  • Loading branch information
jk-jeon committed Mar 28, 2024
1 parent 799437b commit 09c474e
Show file tree
Hide file tree
Showing 2 changed files with 1,452 additions and 1,453 deletions.
Loading

0 comments on commit 09c474e

Please sign in to comment.