#include <iostream>
#include <math.h>
#include <stdlib.h>
#include <string>
Go to the source code of this file.
Definitions of common low-level and typically inline functions This is OPEN SOURCE software developed by James R. Miller (jrmil.nosp@m.ler@.nosp@m.ku.ed.nosp@m.u) Original version: ca. 1996. See README_*.txt for more information.
std::string cryph::closeStr |
( |
char |
openStr | ) |
|
|
inline |
Return the closing bracketing character for the given opening one For example closeStr('(') returns ')'
- Parameters
-
openStr | the opening bracketing character |
- Returns
- the corresponding closing bracketing character (as an std::string)
double cryph::degreesToRadians |
( |
double |
angleInDegrees | ) |
|
|
inline |
Convert the given angle in degrees to radians and return it
- Parameters
-
angleInDegrees | the given angle to be converted to radians |
- Returns
- the angle converted to radians
bool cryph::equalScalars |
( |
double |
s1, |
|
|
double |
s2, |
|
|
double |
tol |
|
) |
| |
|
inline |
Determine whether the two given values are equal within the given tolerance
- Parameters
-
s1 | the first number to be compared |
s2 | the second number to be compared |
tol | the tolerance to be used to decide if the values are the same |
- Returns
- true if and only if s1 and s2 are equal within the given tolerance
template<typename T >
T cryph::maximum |
( |
T |
s1, |
|
|
T |
s2 |
|
) |
| |
|
inline |
Return the maximum of the two given quantities
- Parameters
-
s1 | the first quantity to be compared |
s2 | the second quantity to be compared |
- Returns
- the maximum of the two quantities
template<typename T >
T cryph::minimum |
( |
T |
s1, |
|
|
T |
s2 |
|
) |
| |
|
inline |
Return the minimum of the two given quantities
- Parameters
-
s1 | the first quantity to be compared |
s2 | the second quantity to be compared |
- Returns
- the minimum of the two quantities
double cryph::radiansToDegrees |
( |
double |
angleInRadians | ) |
|
|
inline |
Convert the given angle in radians to degrees and return it
- Parameters
-
angleInRadians | the given angle to be converted to degrees |
- Returns
- the angle converted to degrees
double cryph::random0To1_next |
( |
| ) |
|
|
inline |
Return the next random number in the range 0 <= r < 1
- Returns
- the next random number
void cryph::random0To1_seed |
( |
long |
seedVal | ) |
|
|
inline |
Set the random number seed
- Parameters
-
seedVal | the value to be used as the seed |
int cryph::roundR2I |
( |
double |
val | ) |
|
|
inline |
Return the rounded integer for the given floating point value
- Parameters
-
val | the floating point number to be rounded |
- Returns
- the rounded integral value
void cryph::skipNonblankChars |
( |
std::istream & |
is, |
|
|
int |
nNonBlankChars |
|
) |
| |
|
inline |
Skip over the given number of non-blank characters
- Parameters
-
is | the input stream on which we wish to skip non-blank characters |
nNonBlankChars | the number of non-blank characters to be skipped |
double cryph::square |
( |
double |
s | ) |
|
|
inline |
Return the square of the given number
- Parameters
-
s | the number to be squared |
- Returns
- the square of the given number
template<typename T >
void cryph::swap2 |
( |
T & |
t1, |
|
|
T & |
t2 |
|
) |
| |
|
inline |
Swap the two given quantities
- Parameters
-
s1 | the first quantity to be swapped |
s2 | the second quantity to be swapped |