diff options
author | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2015-03-19 22:11:13 +0200 |
---|---|---|
committer | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2015-03-19 22:11:13 +0200 |
commit | 6b77a1fe3fa2328aca929900454ace1f7eb4da16 (patch) | |
tree | a54510b9818f5a8cf2ca1f90d0744981106bfbe7 /src/web_buffer.c | |
parent | 9da67ae21ab296027e229db0092b9019c717305e (diff) |
math library optional
Diffstat (limited to 'src/web_buffer.c')
-rwxr-xr-x | src/web_buffer.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/web_buffer.c b/src/web_buffer.c index 513471827b..7c57ce8c6a 100755 --- a/src/web_buffer.c +++ b/src/web_buffer.c @@ -1,5 +1,8 @@ #include <stdlib.h> + +#ifdef STORAGE_WITH_MATH #include <math.h> +#endif #include "web_buffer.h" @@ -24,9 +27,13 @@ int print_calculated_number(char *str, calculated_number value) int sign = (value < 0) ? 1 : 0; if(sign) value = -value; +#ifdef STORAGE_WITH_MATH // without llrint() there are rounding problems // for example 0.9 becomes 0.89 unsigned long long uvalue = llrint(value * (calculated_number)100000); +#else + unsigned long long uvalue = value * (calculated_number)100000; +#endif // print each digit do *wstr++ = (char)(48 + (uvalue % 10)); while(uvalue /= 10); |