aboutsummaryrefslogtreecommitdiff
path: root/formatting.h
blob: 1f96d35df4feeef55b64dc0c9c6649204618e136 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

#ifndef FORMATTING_IS_IMPORTED
#define FORMATTING_IS_IMPORTED

struct exp_val {
	unsigned long long mantissa;
	int exponent;
	int base;
};
typedef struct exp_val exp_notated;

exp_notated ull_floored_exponent_notation_base(
	unsigned long long x,
	unsigned int precision,
	unsigned int base
);
exp_notated ull_ceiled_exponent_notation_base(
	unsigned long long x,
	unsigned int precision,
	unsigned int base
);
exp_notated ull_floored_exponent_notation(
	unsigned long long x,
	unsigned int precision
);
exp_notated ull_ceiled_exponent_notation(
	unsigned long long x,
	unsigned int precision
);
unsigned long long exp_notated_to_ull(exp_notated x);
const char* binary_prefix(exp_notated x);
const char* prefix(exp_notated x);
int ull_floored_with_binary_prefix(
	char** res,
	size_t* res_bufsize,
	unsigned long long x
);
int ull_floored_with_prefix(
	char** res,
	size_t* res_bufsize,
	unsigned long long x,
	unsigned int precision
);

#endif