|
Retro Rocket Kernel
BASIC-Powered Operating System
|
#include "kernel.h"Functions | |
| void | enable_fpu () |
| Enable floating point operations. More... | |
| void | enable_sse () |
| Enable SSE. More... | |
| uint8_t | double_determine_decimal_places (double f) |
| Determine the approximate number of decimal places in a double value. This uses a very simple loop which repeatedly multiplies the value by ten, until all that remains is a whole number greater than or equal to 1. More... | |
| char * | double_to_string (double x, char *p, int64_t len, uint8_t precision) |
| Convert a doubleing point number to char* string, with a specified decimal precision. More... | |
| uint8_t double_determine_decimal_places | ( | double | f | ) |
Determine the approximate number of decimal places in a double value. This uses a very simple loop which repeatedly multiplies the value by ten, until all that remains is a whole number greater than or equal to 1.
| f | double to count decimal places |
| char* double_to_string | ( | double | x, |
| char * | p, | ||
| int64_t | len, | ||
| uint8_t | precision | ||
| ) |
Convert a doubleing point number to char* string, with a specified decimal precision.
This function retains accuraccy by converting to 64 bit integers and string representations as early as possible, then operating on fixed-point representations of the floating point number. When we deal with fixed point, we don't lose accuraccy due to rounding.
| x | Float to convert |
| p | Output buffer |
| len | Size of output buffer |
| precision | Precision of decimal part. Set to 0 to display full stored precision of the value. |
| void enable_fpu | ( | ) |
Enable floating point operations.
| void enable_sse | ( | ) |
Enable SSE.