floating point value (fpv) with status informations and safe operations More...
#include <fpv.h>
Public Member Functions | |
| virtual double | stringToValue (const char *stringValue) |
| converts stringValue to double | |
| fpv (const double val) | |
| constructor (with check of val) | |
| fpv (const fpv &val) | |
| copy constructor (value = val.value; status = val.stat) | |
| void | printBitpattern (FILE *file=(FILE *) 0) const |
| prints the bitpattern of the floating point value in hex format | |
| void | printBitpatternFormatted (FILE *file=0) const |
| prints the formatted bitpattern of the floating point value (sign mantisse exponent) | |
| fpv | operator+ (const double addend) const |
| returns this->value + addend in a fpv object | |
| fpv | operator+ (const fpv &addend) const |
| returns this->value + addend in a fpv object | |
| fpv | operator- (const double &subtrahend) const |
| returns this->value - subtrahend in a fpv object | |
| fpv | operator- (const fpv &subtrahend) const |
| returns this->value - subtrahend in a fpv object | |
| fpv | operator* (const double multiplicand) const |
| returns this->value * multiplicand in a fpv object | |
| fpv | operator* (const fpv &multiplicand) const |
| returns this->value * multiplicand in a fpv object | |
| fpv | operator/ (const double denominator) const |
| returns this->value / denominator in a fpv object | |
| fpv | operator/ (const fpv &denominator) const |
| returns this->value / denominator in a fpv object | |
| fpv | operator% (const double denominator) const |
| returns the remainder of this->value / denominator in a fpv object | |
| fpv | operator% (const fpv &denominator) const |
| returns the remainder of this->value / denominator in a fpv object | |
| fpv & | assignReciproc () |
| calculates this->value = 1 / this->value | |
| fpv | reciproc () const |
| returns the reciproc value (1 / this->value) in a fpv object | |
| fpv & | assignCeil () |
| Calculates the ceiling of this->value. | |
| fpv | ceil () const |
| returns the ceiling of this->value in a fpv object | |
| fpv & | assignFloor () |
| Calculates the floor of this->value. | |
| fpv | floor () const |
| returns the floor of this->value in a fpv object | |
| fpv & | assignInteger () |
| strips the decimal places from this->value | |
| fpv | integer () const |
| copies the integer-part of this->value into a fpv object | |
| fpv & | assignRound (const int decPlaces=0) |
| rounds this->value to a specified number of decimal places | |
| fpv | round (const long decPlaces) const |
| returns this->value rounded to a specified number of decimal places in a fpv object | |
| fpv | positive () const |
| returns the absolute value of this->value in a fpv object | |
| fpv | negative () const |
| returns a negative absolute value of this->value in a fpv object | |
| fpv | inv () const |
| returns a fpv object with -this->value ( fpv = -value) | |
| fpv | pow (const double exponent) |
| returns a fpv object with this->value pow exp | |
| fpv | sqrt () const |
| returns the sqrt of this->value in a fpv object | |
| fpv | root (const long rootExp) const |
| returns the rootExp-root of this->value in a fpv object | |
| fpv | log (const double base) const |
| returns the base-logarithm of this->value in a fpv object | |
| fpv & | assignRad () |
| converts from degree into rad (circular measure) | |
| fpv | rad () const |
| returns the rad of this->value in a fpv object (deg to rad) | |
| fpv & | assignDeg () |
| converts from rad (circular measure) to degree | |
| fpv | deg () const |
| returns the degree measure of this->value in a fpv object (rad to deg) | |
| fpv & | assignSin () |
| calculates the sinus of this->value | |
| fpv | sin () const |
| returns the sinus of this->value in a fpv object | |
| fpv & | assignASin () |
| calculates the arcus sinus of this->value | |
| fpv | asin () const |
| returns the arcus sinus of this->value in a fpv object | |
| fpv & | assignCos () |
| calculates the cosinus of this->value | |
| fpv | cos () const |
| returns the cosinus of this->value in a fpv object | |
| fpv & | assignACos () |
| calculates the arcus cosinus of this->value | |
| fpv | acos () const |
| returns the arcus cosinus of this->value in a fpv object | |
| fpv & | assignTan () |
| calculates the tangent of this->value | |
| fpv | tan () const |
| returns the tangent of this->value in a fpv object | |
| fpv & | assignATan () |
| calculates the arcus tangent of this->value | |
| fpv | atan () const |
| returns the arcus tangent of this->value in a fpv object | |
| fpv & | assignCot () |
| calculates the cotangent of this->value | |
| fpv | cot () const |
| returns the cotangent of this->value in a fpv object | |
| fpv & | assignACot () |
| calculates the arcus cotangent of this->value | |
| fpv | acot () const |
| returns acot( this->value ) in a fpv object | |
floating point value (fpv) with status informations and safe operations
This fpv class provides a 64 bit value in floating point format and safe functions and operations on these values.
The safe functions and operations prevent FPU traps (exceptions). This allows hardware and operating system independend software development.
The status of a fpv acts accumulative. This allows straight forward programming of huge mathematical operations and checking the status only at the end of all calculations.
| fpv::fpv | ( | const double | val | ) | [inline] |
constructor (with check of val)
constructs an object with value = val
| val | the value for this object |
| fpv::fpv | ( | const fpv & | val | ) | [inline] |
copy constructor (value = val.value; status = val.stat)
constructs a copy of the object val
| val | the object to be copied. |
| fpv fpv::acos | ( | ) | const [inline] |
returns the arcus cosinus of this->value in a fpv object
| fpv fpv::acot | ( | ) | const [inline] |
returns acot( this->value ) in a fpv object
calculates the arcus cotangent of this->value and stores the result in a fpv object
| fpv fpv::asin | ( | ) | const [inline] |
returns the arcus sinus of this->value in a fpv object
this->value must be in range of [-1 .. +1]
| fpv& fpv::assignACos | ( | ) | [inline] |
calculates the arcus cosinus of this->value
| fpv& fpv::assignACot | ( | ) | [inline] |
calculates the arcus cotangent of this->value
| fpv& fpv::assignASin | ( | ) | [inline] |
calculates the arcus sinus of this->value
this->value must be in range of [-1 .. +1]
| fpv& fpv::assignATan | ( | ) | [inline] |
calculates the arcus tangent of this->value
this->value = atan( this->value )
| fpv& fpv::assignCeil | ( | ) | [inline] |
Calculates the ceiling of this->value.
Calculates the smallest integer that is greater than or equal to this->value before calling this method
| fpv& fpv::assignCos | ( | ) | [inline] |
calculates the cosinus of this->value
| fpv& fpv::assignCot | ( | ) | [inline] |
calculates the cotangent of this->value
| fpv& fpv::assignDeg | ( | ) | [inline] |
converts from rad (circular measure) to degree
interpretes this->value as rad and returns it in degree
this->value = this->value * 180 / PI
| fpv& fpv::assignFloor | ( | ) | [inline] |
Calculates the floor of this->value.
Calculates the largest integer that is less than or equal to this->value before calling this method
| fpv& fpv::assignInteger | ( | ) | [inline] |
strips the decimal places from this->value
Extracts the integer part from this->value
| fpv& fpv::assignRad | ( | ) | [inline] |
converts from degree into rad (circular measure)
interpretes this->value as degree and converts to rad (circular measure)
this->value = this->value * PI / 180
| fpv& fpv::assignReciproc | ( | ) | [inline] |
calculates this->value = 1 / this->value
calculates the reciproc value of this->value
| fpv& fpv::assignRound | ( | const int | decPlaces = 0 |
) | [inline] |
rounds this->value to a specified number of decimal places
| decPlaces | Positive number indicates how many places to the right of the decimal are included in the rounding. If omitted (decPlaces=0), assignRound() rounds to integer. Negative number indicates how many places to the left of the decimal are included in the rounding. |
| fpv& fpv::assignSin | ( | ) | [inline] |
calculates the sinus of this->value
and stores the result in this object
this->value = sin( this->value ).
| fpv& fpv::assignTan | ( | ) | [inline] |
calculates the tangent of this->value
| fpv fpv::atan | ( | ) | const [inline] |
returns the arcus tangent of this->value in a fpv object
| fpv fpv::ceil | ( | ) | const [inline] |
returns the ceiling of this->value in a fpv object
| fpv fpv::cos | ( | ) | const [inline] |
returns the cosinus of this->value in a fpv object
| fpv fpv::cot | ( | ) | const [inline] |
returns the cotangent of this->value in a fpv object
| fpv fpv::deg | ( | ) | const [inline] |
returns the degree measure of this->value in a fpv object (rad to deg)
converts from rad (circular measure) into deg (degree)
fpv result = this->value * 180 / PI
| fpv fpv::floor | ( | ) | const [inline] |
returns the floor of this->value in a fpv object
| fpv fpv::integer | ( | ) | const [inline] |
copies the integer-part of this->value into a fpv object
| fpv fpv::inv | ( | ) | const [inline] |
returns a fpv object with -this->value ( fpv = -value)
returns -( this->value )
| fpv fpv::log | ( | const double | base | ) | const [inline] |
returns the base-logarithm of this->value in a fpv object
the log-function solves the equation
base ^ result = this->value
and returns a fpv object containing result
| base | the base of the logarithm (useful >= 2) |
| fpv fpv::negative | ( | ) | const [inline] |
returns a negative absolute value of this->value in a fpv object
fpv-object = -fabs( this->value )
returns the remainder of this->value / denominator in a fpv object
| denominator | the value to be divided from this->value to calculate the remainder |
| fpv fpv::operator% | ( | const double | denominator | ) | const [inline] |
returns the remainder of this->value / denominator in a fpv object
| denominator | the value to be divided from this->value to calculate the remainder |
returns this->value * multiplicand in a fpv object
| multiplicand | the value to be multiplied with this->value |
| fpv fpv::operator* | ( | const double | multiplicand | ) | const [inline] |
returns this->value * multiplicand in a fpv object
| multiplicand | the value to be multiplied with this->value |
returns this->value + addend in a fpv object
| addend | the value to be added to this->value |
| fpv fpv::operator+ | ( | const double | addend | ) | const [inline] |
returns this->value + addend in a fpv object
| addend | the value to be added to this->value |
returns this->value - subtrahend in a fpv object
| subtrahend | the value to be subtracted from this->value |
| fpv fpv::operator- | ( | const double & | subtrahend | ) | const [inline] |
returns this->value - subtrahend in a fpv object
| subtrahend | the value to be subtracted from this->value |
returns this->value / denominator in a fpv object
| denominator | the value to be divided from this->value |
| fpv fpv::operator/ | ( | const double | denominator | ) | const [inline] |
returns this->value / denominator in a fpv object
| denominator | the value to be divided from this->value |
| fpv fpv::positive | ( | ) | const [inline] |
returns the absolute value of this->value in a fpv object
fpv-object = fabs( this->value )
| fpv fpv::pow | ( | const double | exponent | ) | [inline] |
| void fpv::printBitpattern | ( | FILE * | file = (FILE*)0 |
) | const [inline] |
prints the bitpattern of the floating point value in hex format
| file | pointer to a open FILE with write access. If file=0 (default) this function prints to stdout. If file is a valid pointer this function prints to file. |
| void fpv::printBitpatternFormatted | ( | FILE * | file = 0 |
) | const [inline] |
prints the formatted bitpattern of the floating point value (sign mantisse exponent)
| file | pointer to a open FILE with write access. If file=0 (default) this function prints to stdout. If file is a valid pointer this function prints to file. |
| fpv fpv::rad | ( | ) | const [inline] |
returns the rad of this->value in a fpv object (deg to rad)
interpretes this->value as degree and returns it in rad (circular measure)
fpv result = this->value * PI / 180
| fpv fpv::reciproc | ( | ) | const [inline] |
returns the reciproc value (1 / this->value) in a fpv object
calculates the reciproc value of this->value
| fpv fpv::root | ( | const long | rootExp | ) | const [inline] |
| fpv fpv::round | ( | const long | decPlaces | ) | const [inline] |
returns this->value rounded to a specified number of decimal places in a fpv object
| decPlaces | Positive number indicates how many places to the right of the decimal are included in the rounding. If omitted (decPlaces=0), round() rounds to integer. Negative number indicates how many places to the left of the decimal are included in the rounding. |
| fpv fpv::sin | ( | ) | const [inline] |
returns the sinus of this->value in a fpv object
| fpv fpv::sqrt | ( | ) | const [inline] |
| virtual double fpv::stringToValue | ( | const char * | stringValue | ) | [inline, virtual] |
converts stringValue to double
| stringValue | pointer to the first character in the string where the value begins |
| fpv fpv::tan | ( | ) | const [inline] |
returns the tangent of this->value in a fpv object
1.6.3