Universal Numbers Library C++ API
sw::universal -- header-only custom arithmetic types (posit, cfloat, lns, fixpnt, dd/qd, and more)
Loading...
Searching...
No Matches
dragon.hpp File Reference
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <universal/number/support/decimal.hpp>

Classes

struct  sw::universal::dragon::dragon_context
 Dragon context: configuration for decimal conversion. More...

Namespaces

namespace  sw
 required std libraries
namespace  sw::universal
namespace  sw::universal::internal
namespace  sw::universal::dragon

Functions

void sw::universal::dragon::multiply_by_power_of_2 (support::decimal &d, int exp)
 multiply_by_power_of_2: multiply decimal by 2^exp using repeated doubling
void sw::universal::dragon::multiply_by_power_of_5 (support::decimal &d, int exp)
 multiply_by_power_of_5: multiply decimal by 5^exp
void sw::universal::dragon::divide_by_power_of_10 (support::decimal &d, int exp)
 divide_by_power_of_10: divide decimal by 10^exp
std::string sw::universal::dragon::dragon4 (const support::decimal &f, int e, int fbits, bool is_even, const dragon_context &ctx, int &decimal_exponent)
 Dragon4 algorithm: Generate digits using interval arithmetic.
int sw::universal::dragon::estimate_significant_bits (const support::decimal &d)
 significant_digits: estimate the number of significant bits in the mantissa This is a helper for the Dragon algorithm's initial k estimate
std::string sw::universal::dragon::format_decimal_string (bool sign, const std::string &digits, int decimal_exp, const dragon_context &ctx)
 format_decimal_string: format the digits and exponent according to ioflags
std::string sw::universal::dragon::to_decimal_string (bool sign, int scale, const support::decimal &mantissa, int fbits, std::ios_base::fmtflags flags=std::ios_base::dec, std::streamsize precision=6)
 to_decimal_string: main entry point for Dragon algorithm conversion