Functions
decpoint.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <math.h>
#include "include/decpoint.h"
Include dependency graph for decpoint.c:

Functions

int dec_comma_is (char *str)
 
double atof_dpi (char *str)
 
int dec_nr (char *str)
 
int atof_with_check (char *double_as_string, double *result_value)
 

Function Documentation

◆ atof_dpi()

double atof_dpi ( char *  str)

Replacement of atof(), which works whether string contains decimal dots or decimal commas. Possible commas are replaced by dots in the argument string.

Referenced by atof_with_check().

◆ atof_with_check()

int atof_with_check ( char *  double_as_string,
double *  result_value 
)

Converts a string to float using strtod(), but if its return value is zero this function checks that argument string actually contains a number.

Returns
Returns 0 if successful, and 1 in case of an error.
Parameters
double_as_stringString which is converted to a double
result_valuePointer to the double float

References atof_dpi().

Here is the call graph for this function:

◆ dec_comma_is()

int dec_comma_is ( char *  str)

Checks whether argument string contains a decimal comma instead of dot.

Returns
Returns 1 if decimal comma is found and 0 if not found.

◆ dec_nr()

int dec_nr ( char *  str)

Returns the number of decimapl places in the argument string, representing a floating point value. String can contain either decimal dots or commas.