jplus-0.4.7
util.h
Go to the documentation of this file.
1/* -*- mode: c++; indent-tabs-mode:nil -*- */
2#ifndef UTIL_H
3#define UTIL_H
4
5#include <complex>
6#include <string>
7#include "sha1.h"
8
9// the base type is "double" (64 bits on x86/x87)
10typedef double Real;
11typedef std::complex<double> Cmplx;
12typedef long double lReal;
13#define fftw(name) fftw_ ## name
14#define TYPE_STR ""
15
16#ifndef _WIN32
17#define _stdcall
18#endif
19
20// parses string as a positive integer, reporting errors
21// to stderr and returning 1 in case of failure, 0 if success.
22int parseint(char *str, int& res);
23
24// additionally error is signalled if the number is <0
25int parsepositiveint(char *str, int& res);
26
27// parses string as a positive double, reporting errors
28// to stderr and returning 1 in case of failure, 0 if success.
29int parsedouble(char *str, double& res);
30
31// additionally error is signalled if the number is <0
32int parsepositivedouble(char *str, double& res);
33
35std::string sha1tostring(SHA1 &sha1);
36
38bool tol_eq(double a, double b);
39
40#endif
long double lReal
Definition util.h:12
int parsepositiveint(char *str, int &res)
double Real
Definition util.h:10
std::string sha1tostring(SHA1 &sha1)
convert sha1 to string
int parsepositivedouble(char *str, double &res)
int parseint(char *str, int &res)
int parsedouble(char *str, double &res)
std::complex< double > Cmplx
Definition util.h:11
bool tol_eq(double a, double b)
tolerant comparison of two double numbers