All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Public Attributes | List of all members
ttmath::Conv Struct Reference

#include <ttmathtypes.h>

Public Member Functions

 Conv ()

Public Attributes

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()/

Constructor & Destructor Documentation

ttmath::Conv::Conv ( )

Member Data Documentation

uint ttmath::Conv::base

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

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

uint ttmath::Conv::comma

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

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

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)

uint ttmath::Conv::group_digits

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

uint ttmath::Conv::group_exp
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)

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

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

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

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