CARLsim  6.1.0
CARLsim: a GPU-accelerated SNN simulator
Util.cpp File Reference
#include "Util.h"
#include <cmath>
#include <sstream>
#include <stdexcept>
Include dependency graph for Util.cpp:

Go to the source code of this file.

Functions

bool equals (const float x, const float y, float epsilon)
 
bool equals (const double x, const double y, double epsilon)
 
double stringToDouble (const string &str)
 
float stringToFloat (const string &str)
 

Function Documentation

◆ equals() [1/2]

bool equals ( const float  x,
const float  y,
float  epsilon 
)

Consder to floats equal if they are within epsilon of each other.

Definition at line 42 of file Util.cpp.

◆ equals() [2/2]

bool equals ( const double  x,
const double  y,
double  epsilon 
)

Consder to floats equal if they are within epsilon of each other.

Definition at line 47 of file Util.cpp.

◆ stringToDouble()

double stringToDouble ( const string &  str)

Take a string representing a decimal point number and convert it to a double.

Throws std::invalid_argument if the string does not hold a decimal point number.

Definition at line 30 of file Util.cpp.

Here is the caller graph for this function:

◆ stringToFloat()

float stringToFloat ( const string &  str)

Take a string representing a decimal point number and convert it to a float.

Throws std::invalid_argument if the string does not hold a decimal point number.

Definition at line 14 of file Util.cpp.