[v0.05] Fix truncate function

This commit is contained in:
Dr-Noob
2021-08-16 21:49:03 +02:00
parent ea11da2368
commit ad75c7e6ca

View File

@@ -32,11 +32,7 @@ VENDOR get_gpu_vendor(struct gpu_info* gpu) {
return gpu->vendor; return gpu->vendor;
} }
double trunc(double val) { double trunc(double val) { return ((int)(100 * val)) / 100.0; }
int digits = floor (log10 (abs (val))) + 1;
int decimals = 4 - digits;
return val - (4 * pow(10, -(decimals + 1)));
}
int32_t get_value_as_smallest_unit(char ** str, uint64_t value) { int32_t get_value_as_smallest_unit(char ** str, uint64_t value) {
int32_t ret; int32_t ret;