Csd 1.1.4; VERSION ${PROJECT_VERSION}
Loading...
Searching...
No Matches
Classes | Namespaces | Macros | Functions | Variables
csd.hpp File Reference

Canonical Signed Digit (CSD) representation library. More...

#include <stdexcept>
#include <string>
Include dependency graph for csd.hpp:

Go to the source code of this file.

Classes

class  csd::invalid_csd_format
 Exception thrown when invalid CSD characters are encountered. More...
 

Namespaces

namespace  csd
 

Macros

#define CONSTEXPR14   inline
 

Functions

auto csd::to_csd (double decimal_value, int places) -> std::string
 
auto csd::to_csd_i (int decimal_value) -> std::string
 
auto csd::to_csdnnz (double decimal_value, unsigned int nnz) -> std::string
 Convert a floating-point number to CSD with limited non-zero digits.
 
auto csd::to_csdnnz_i (int decimal_value, unsigned int nnz) -> std::string
 Convert an integer to CSD with limited non-zero digits.
 
CONSTEXPR14 auto csd::to_decimal_using_switch (const char *csd) -> double
 
CONSTEXPR14 auto csd::to_decimal_integral (const char *&csd) -> int
 Convert the integral part of a CSD string to a decimal.
 
CONSTEXPR14 auto csd::to_decimal_fractional (const char *csd) -> double
 Convert the fractional part of a CSD string to a decimal.
 
CONSTEXPR14 auto csd::to_decimal (const char *csd) -> double
 Convert the CSD string to a decimal.
 
CONSTEXPR14 auto csd::to_decimal_i (const char *csd) -> int
 Convert CSD string to integer.
 

Variables

constexpr int csd::MAX_DECIMAL_PLACES = 20
 Maximum number of decimal places supported by CSD conversion.
 
constexpr unsigned int csd::MIN_NONZERO_DIGITS = 1
 Minimum value for non-zero digit count in CSDNNZ functions.
 

Detailed Description

Canonical Signed Digit (CSD) representation library.

This library provides functions for converting between decimal numbers and Canonical Signed Digit (CSD) representation. CSD is a signed-digit representation where each digit can be -1, 0, or 1, with no consecutive non-zero digits.

CSD representation is particularly useful in digital signal processing and hardware design as it minimizes the number of non-zero digits, leading to more efficient implementations using only adders and subtractors.

Author
Harnesser
See also
https://sourceforge.net/projects/pycsd/
License
GPL2

Macro Definition Documentation

◆ CONSTEXPR14

#define CONSTEXPR14   inline