Library for big numbers from http://www.ttmath.org/

Dependents:   PIDHeater82 Conceptcontroller_v_1_0 AlarmClockApp COG4050_adxl355_tilt ... more

Embed: (wiki syntax)

« Back to documentation index

Conv Struct Reference

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

Detailed Description

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

Definition at line 377 of file ttmathtypes.h.


Field Documentation

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

Definition at line 383 of file ttmathtypes.h.

bool 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 415 of file ttmathtypes.h.

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

Definition at line 446 of file ttmathtypes.h.

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 457 of file ttmathtypes.h.

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 466 of file ttmathtypes.h.

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

Definition at line 473 of file ttmathtypes.h.

sint 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 430 of file ttmathtypes.h.

bool 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 391 of file ttmathtypes.h.

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 400 of file ttmathtypes.h.

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 439 of file ttmathtypes.h.