Files
Upsilon/apps/graph/values/float_to_string.h
Émilie Feral 5004b3af9c [apps/graph/values] add a temporary methods to print float in a buffer
Change-Id: Ib81339b4b7e41a59f20432c90310a8aee68c9299
2016-10-12 17:38:53 +02:00

27 lines
1013 B
C++

#ifndef GRAPH_FLOAT_TO_STRING_H
#define GRAPH_FLOAT_TO_STRING_H
#include <assert.h>
#include <math.h>
namespace FloatToString {
enum Mode {
SCIENTIFIC, DECIMAL
};
/* This function prints the int i in the buffer with a '.' at the position
* specified by the decimalMarkerPosition. It starts printing at the end of the
* buffer and print from right to left. The integer given should be of the right
* length to be written in bufferLength chars. If the integer is to small, the
* empty chars on the left side are completed with '0'. If the integer is too
* big, the printing stops when no more empty chars are available without
* returning any warning. */
void printBase10IntegerWithDecimalMarker(char * buffer, int bufferLength, int i, int decimalMarkerPosition);
/* The parameter 'mode' refers to the way to display float 'scientific' or
* 'decimal'. The code only handles 'scientific' so far. */
void convertFloatToText(float f, char * buffer, int maxNumberOfChar, Mode mode = SCIENTIFIC);
}
#endif