TTMath  0.9.4
 C++ bignum library
Data Fields
ttmath::Conv Struct Reference

#include <ttmathtypes.h>

Data Fields

uint base
 
bool scient
 
sint scient_from
 
bool base_round
 
sint round
 
bool trim_zeroes
 
uint comma
 
uint comma2
 
uint group
 
uint group_digits
 
uint group_exp
 

Detailed Description

this struct is used when converting to/from a string /temporarily only in Big::ToString() and Big::FromString()/

Definition at line 406 of file ttmathtypes.h.

Field Documentation

§ base

uint ttmath::Conv::base

base (radix) on which the value will be shown (or read) default: 10

Definition at line 412 of file ttmathtypes.h.

Referenced by ttmath::Big< exp, man >::FromString(), ttmath::Parser< ValueType >::GetValueOfVariable(), ttmath::Big< exp, man >::ToString(), and ttmath::Big< exp, man >::ToWString().

§ base_round

bool ttmath::Conv::base_round

if 'base_round' is true and 'base' is different from 2, 4, 8, or 16 and the result value is not an integer then we make an additional rounding (after converting the last digit from the result is skipped) default: true

e.g.

Conv c;
c.base_round = false;
Big<1, 1> a = "0.1";                       // decimal input
std::cout << a.ToString(c) << std::endl;   // the result is: 0.099999999

Definition at line 445 of file ttmathtypes.h.

§ comma

uint ttmath::Conv::comma

the main comma operator (used when reading and writing) default is a dot '.'

Definition at line 476 of file ttmathtypes.h.

Referenced by ttmath::Big< exp, man >::FromString(), ttmath::Parser< ValueType >::GetValueOfVariable(), and ttmath::Big< exp, man >::ToString().

§ comma2

uint ttmath::Conv::comma2

additional comma operator (used only when reading) if you don't want it just set it to zero default is a comma ','

this allowes you to convert from a value: 123.45 as well as from 123,45

Definition at line 487 of file ttmathtypes.h.

Referenced by ttmath::Big< exp, man >::FromString(), and ttmath::Parser< ValueType >::GetValueOfVariable().

§ group

uint ttmath::Conv::group

it sets the character which is used for grouping if group=' ' then: 1234,56789 will be printed as: 1 234,567 89

if you don't want grouping just set it to zero (which is default)

Definition at line 496 of file ttmathtypes.h.

Referenced by ttmath::Big< exp, man >::FromString(), and ttmath::Parser< ValueType >::GetValueOfVariable().

§ group_digits

uint ttmath::Conv::group_digits

how many digits should be grouped (it is used if 'group' is non zero) default: 3

Definition at line 503 of file ttmathtypes.h.

§ round

sint ttmath::Conv::round

used only in Big::ToString() tells how many digits after comma are possible default: -1 which means all digits are printed

set it to zero if you want integer value only

for example when the value is: 12.345678 and 'round' is 4 then the result will be 12.3457 (the last digit was rounded)

Definition at line 460 of file ttmathtypes.h.

Referenced by ttmath::Big< exp, man >::ToString().

§ scient

bool ttmath::Conv::scient

used only in Big::ToString() if true the value will be always shown in the scientific mode, e.g: 123e+30 default: false

Definition at line 420 of file ttmathtypes.h.

Referenced by ttmath::Big< exp, man >::ToString().

§ scient_from

sint ttmath::Conv::scient_from

used only in Big::ToString() if scient is false then the value will be printed in the scientific mode only if the exponent is greater than scien_from default: 15

Definition at line 429 of file ttmathtypes.h.

Referenced by ttmath::Big< exp, man >::ToString().

§ trim_zeroes

bool ttmath::Conv::trim_zeroes

if true that not mattered digits in the mantissa will be cut off (zero characters at the end – after the comma operator) e.g. 1234,78000 will be: 1234,78 default: true

Definition at line 469 of file ttmathtypes.h.

Referenced by ttmath::Big< exp, man >::ToString().


The documentation for this struct was generated from the following file: