Project Euler Solutions
In_place_bcd_c_operators

The functions that implement in-place math operators using at least some C-style integers. More...

void BCD_int::imul_bcd_cint (BCD_int *const x, const intmax_t y)
 Multiply in-place a BCD_int by a C-style signed integer. More...
 
void BCD_int::imul_bcd_cuint (BCD_int *const x, const uintmax_t y)
 Multiply in-place a BCD_int by a C-style unsigned integer. More...
 
void BCD_int::imul_bcd_pow_10 (BCD_int *const x, const size_t tens)
 Multiply in-place a BCD_int by a power of ten. More...
 
void BCD_int::ishift_bcd_left (BCD_int *const a, const size_t tens)
 Multiply in-place a BCD_int by a power of ten. More...
 
void BCD_int::idiv_bcd_pow_10 (BCD_int *const x, const size_t tens)
 Divide in-place a BCD_int by a power of ten. More...
 
void BCD_int::ishift_bcd_right (BCD_int *const a, const size_t tens)
 Divide in-place a BCD_int by a power of ten. More...
 

Detailed Description

The functions that implement in-place math operators using at least some C-style integers.

in_place_c_operators

Function Documentation

void idiv_bcd_pow_10 ( BCD_int *const  x,
const size_t  tens 
)

Divide in-place a BCD_int by a power of ten.

Parameters
[in,out]xThe BCD_int in question
[in]tensThe power of ten you'd like to divide by (in the form of \((10^{\texttt{tens}})\))
See also
div_bcd_pow_10 for performance analysis
Attention
All in-place operators may "return" NaN with error set to NO_MEM
All in-place operators will "return" NaN if fed NaN, and set error to {OP}_NAN.
Todo:
This function is not yet supported for odd values of tens
void imul_bcd_cint ( BCD_int *const  x,
const intmax_t  y 
)

Multiply in-place a BCD_int by a C-style signed integer.

Parameters
[in,out]xThe BCD_int in question
[in]yThe C-style integer to multiply by
See also
mul_bcd_cuint for performance analysis
Attention
All in-place operators may "return" NaN with error set to NO_MEM
All in-place operators will "return" NaN if fed NaN, and set error to {OP}_NAN.
void imul_bcd_cuint ( BCD_int *const  x,
const uintmax_t  y 
)

Multiply in-place a BCD_int by a C-style unsigned integer.

Parameters
[in,out]xThe BCD_int in question
[in]yThe C-style integer to multiply by
See also
mul_bcd_cuint for performance analysis
Attention
All in-place operators may "return" NaN with error set to NO_MEM
All in-place operators will "return" NaN if fed NaN, and set error to {OP}_NAN.

Here is the caller graph for this function:

void imul_bcd_pow_10 ( BCD_int *const  x,
const size_t  tens 
)

Multiply in-place a BCD_int by a power of ten.

Parameters
[in,out]xThe BCD_int in question
[in]tensThe power of ten you'd like to multiply by (in the form of \((10^{\texttt{tens}})\))
See also
mul_bcd_pow_10 for performance analysis
Attention
All in-place operators may "return" NaN with error set to NO_MEM
All in-place operators will "return" NaN if fed NaN, and set error to {OP}_NAN.
void ishift_bcd_left ( BCD_int *const  a,
const size_t  tens 
)

Multiply in-place a BCD_int by a power of ten.

Parameters
[in,out]aThe BCD_int in question
[in]tensThe power of ten you'd like to multiply by (in the form of \((10^{\texttt{tens}})\))
See also
mul_bcd_pow_10 for performance analysis
Attention
All in-place operators may "return" NaN with error set to NO_MEM
All in-place operators will "return" NaN if fed NaN, and set error to {OP}_NAN.
void ishift_bcd_right ( BCD_int *const  a,
const size_t  tens 
)

Divide in-place a BCD_int by a power of ten.

Parameters
[in,out]aThe BCD_int in question
[in]tensThe power of ten you'd like to divide by (in the form of \((10^{\texttt{tens}})\))
See also
div_bcd_pow_10 for performance analysis
Attention
All in-place operators may "return" NaN with error set to NO_MEM
All in-place operators will "return" NaN if fed NaN, and set error to {OP}_NAN.
Todo:
This function is not yet supported for odd values of tens