aboutsummaryrefslogtreecommitdiff
path: root/formatting.h
blob: b9ef53b2a9fd9d28c11e62f762c75bf2e2e701c3 (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

#ifndef FORMATTING_IS_IMPORTED
#define FORMATTING_IS_IMPORTED

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

exp_notated int_floored_exponent_notation_base(
	int x,
	unsigned int precision,
	unsigned int base
);
exp_notated int_ceiled_exponent_notation_base(
	int x,
	unsigned int precision,
	unsigned int base
);
exp_notated int_floored_exponent_notation(int x, unsigned int precision);
exp_notated int_ceiled_exponent_notation(int x, unsigned int precision);
int exp_notated_to_int(exp_notated x);
const char* binary_prefix(exp_notated x);
const char* prefix(exp_notated x);
int int_floored_with_binary_prefix(char** res, size_t* res_bufsize, int x);
int int_floored_with_prefix(char** res, size_t* res_bufsize, int x, unsigned int precision);

#endif