diff options
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -0,0 +1,25 @@ +#include <math.h> +#include <string.h> + +#include "util.h" + +float pressure_to_metres_asl(float real, float setting) +{ + return 44330.f*(1.f-pow(real/setting, 1/5.255)); +} + +void blank_to_eol(char *line, size_t len) +{ + size_t i = 0; + for (i = strlen(line); i < len - 1; i++) { + line[i] = ' '; + } + line[i] = '\0'; +} + +void split_float(float input, int *integer_part, float *float_part) +{ + *integer_part = (int)input; + *float_part = fabs(input - *integer_part); +} + |