SoftFloat is a software implementation of floating-point calculations according to IEEE 754 standard. More...
Classes | |
struct | cv::softdouble |
struct | cv::softfloat |
Variables | |
uint32_t | cv::softfloat::v |
uint64_t | cv::softdouble::v |
SoftFloat is a software implementation of floating-point calculations according to IEEE 754 standard.
All calculations are done in integers, that's why they are machine-independent and bit-exact. This library can be useful in accuracy-critical parts like look-up tables generation, tests, etc. OpenCV contains a subset of SoftFloat partially rewritten to C++.
There are two basic types: softfloat and softdouble. These types are binary compatible with float and double types respectively and support conversions to/from them. Other types from original SoftFloat library like fp16 or fp128 were thrown away as well as quiet/signaling NaN support, on-the-fly rounding mode switch and exception flags (though exceptions can be implemented in the future).
Both types support the following:
|
inline |
#include <opencv2/core/softfloat.hpp>
Default constructor.
|
inline |
|
explicit |
#include <opencv2/core/softfloat.hpp>
Construct from integer.
|
explicit |
#include <opencv2/core/softfloat.hpp>
|
explicit |
#include <opencv2/core/softfloat.hpp>
|
explicit |
#include <opencv2/core/softfloat.hpp>
|
inlineexplicit |
|
inline |
#include <opencv2/core/softfloat.hpp>
Default constructor.
|
inline |
|
explicit |
#include <opencv2/core/softfloat.hpp>
Construct from integer.
|
explicit |
#include <opencv2/core/softfloat.hpp>
|
explicit |
#include <opencv2/core/softfloat.hpp>
|
explicit |
#include <opencv2/core/softfloat.hpp>
|
inlineexplicit |
#include <opencv2/core/softfloat.hpp>
Absolute value.
References cv::softfloat::v.
Referenced by cvflann::abs(), cv::abs(), cv::cv_abs(), cv::normInf(), cv::normL1(), and cv::SimilarRects::operator()().
|
inline |
#include <opencv2/core/softfloat.hpp>
References cv::cbrt(), cv::cos(), cv::exp(), cv::log(), cv::pow(), cv::sin(), and cv::softdouble::v.
#include <opencv2/core/softfloat.hpp>
Cube root.
Special cases:
Referenced by cv::abs().
softdouble cv::cos | ( | const softdouble & | a | ) |
#include <opencv2/core/softfloat.hpp>
Cosine.
Special cases:
Referenced by cv::abs().
|
inlinestatic |
#include <opencv2/core/softfloat.hpp>
Difference between 1 and next representable value.
References cv::softfloat::fromRaw().
|
inlinestatic |
#include <opencv2/core/softfloat.hpp>
Difference between 1 and next representable value.
References cv::softdouble::fromRaw().
#include <opencv2/core/softfloat.hpp>
Exponent.
Special cases:
Referenced by cv::abs(), and cv::hal::DCT2D::~DCT2D().
softdouble cv::exp | ( | const softdouble & | a | ) |
#include <opencv2/core/softfloat.hpp>
#include <opencv2/core/softfloat.hpp>
Construct from raw.
Builds new value from raw binary representation
References cv::softfloat::v.
Referenced by cv::softfloat::eps(), cv::softfloat::getFrac(), cv::softfloat::inf(), cv::softfloat::max(), cv::softfloat::min(), cv::softfloat::nan(), cv::softfloat::one(), cv::softfloat::pi(), and cv::softfloat::zero().
|
inlinestatic |
#include <opencv2/core/softfloat.hpp>
Construct from raw.
Builds new value from raw binary representation
References cv::softdouble::v.
Referenced by cv::softdouble::eps(), cv::softdouble::getFrac(), cv::softdouble::inf(), cv::softdouble::max(), cv::softdouble::min(), cv::softdouble::nan(), cv::softdouble::one(), cv::softdouble::pi(), and cv::softdouble::zero().
|
inline |
#include <opencv2/core/softfloat.hpp>
Get 0-based exponent.
|
inline |
#include <opencv2/core/softfloat.hpp>
Get 0-based exponent.
|
inline |
#include <opencv2/core/softfloat.hpp>
Get a fraction part.
Returns a number 1 <= x < 2 with the same significand
References cv::softfloat::fromRaw().
|
inline |
#include <opencv2/core/softfloat.hpp>
Get a fraction part.
Returns a number 1 <= x < 2 with the same significand
References cv::softdouble::fromRaw().
|
inline |
#include <opencv2/core/softfloat.hpp>
Get sign bit.
|
inline |
#include <opencv2/core/softfloat.hpp>
Get sign bit.
|
inlinestatic |
#include <opencv2/core/softfloat.hpp>
Positive infinity constant.
References cv::softfloat::fromRaw().
|
inlinestatic |
#include <opencv2/core/softfloat.hpp>
Positive infinity constant.
References cv::softdouble::fromRaw().
|
inline |
#include <opencv2/core/softfloat.hpp>
Inf state indicator.
|
inline |
#include <opencv2/core/softfloat.hpp>
Inf state indicator.
|
inline |
#include <opencv2/core/softfloat.hpp>
NaN state indicator.
|
inline |
#include <opencv2/core/softfloat.hpp>
NaN state indicator.
|
inline |
#include <opencv2/core/softfloat.hpp>
Subnormal number indicator.
|
inline |
#include <opencv2/core/softfloat.hpp>
Subnormal number indicator.
#include <opencv2/core/softfloat.hpp>
Natural logarithm.
Special cases:
Referenced by cv::abs(), cvflann::KL_Divergence< T >::accum_dist(), cvflann::KL_Divergence< T >::operator()(), and cv::hal::DCT2D::~DCT2D().
softdouble cv::log | ( | const softdouble & | a | ) |
#include <opencv2/core/softfloat.hpp>
|
inlinestatic |
#include <opencv2/core/softfloat.hpp>
Biggest finite value.
References cv::softfloat::fromRaw().
|
inlinestatic |
#include <opencv2/core/softfloat.hpp>
Biggest finite value.
References cv::softdouble::fromRaw().
#include <opencv2/core/softfloat.hpp>
Referenced by cv::abs(), cv::dnn::clamp(), cvflann::KNNUniqueResultSet< DistanceType >::clear(), cvflann::LshIndex< Distance >::findNeighbors(), cvflann::KDTreeSingleIndex< Distance >::findNeighbors(), cvflann::lsh::LshTable< ElementType >::getKey(), cvflann::KMeansIndex< Distance >::getParameters(), cvflann::KNNSimpleResultSet< DistanceType >::init(), cvflann::KNNResultSet< DistanceType >::init(), cvflann::KMeansIndex< Distance >::KMeansIndex(), cvflann::LshIndex< Distance >::knnSearch(), cv::Allocator< _Tp >::max_size(), cv::MatExpr::min(), cv::normInf(), cv::gapi::own::operator &=(), cv::gapi::own::saturate(), cv::saturate_cast< uchar >(), cv::saturate_cast< uint64 >(), cv::saturate_cast< unsigned >(), cv::saturate_cast< ushort >(), cv::DetectionBasedTracker::IDetector::setMaxObjectSize(), and cv::v_popcount().
|
inline |
#include <opencv2/core/softfloat.hpp>
Referenced by cv::saturate_cast< schar >(), cv::saturate_cast< short >(), cv::saturate_cast< uchar >(), and cv::saturate_cast< ushort >().
|
inlinestatic |
#include <opencv2/core/softfloat.hpp>
Smallest normalized value.
References cv::softfloat::fromRaw().
|
inlinestatic |
#include <opencv2/core/softfloat.hpp>
Smallest normalized value.
References cv::softdouble::fromRaw().
#include <opencv2/core/softfloat.hpp>
Min and Max functions.
Referenced by cv::abs(), cvflann::KMeansIndex< Distance >::chooseCentersKMeanspp(), cv::dnn::clamp(), cvflann::KDTreeSingleIndex< Distance >::findNeighbors(), cv::v_reg< _Tp, n >::get0(), cvflann::lsh::LshTable< ElementType >::getKey(), cvflann::KDTreeIndex< Distance >::getParameters(), cvflann::AutotunedIndex< Distance >::getType(), cv::gapi::own::operator &=(), cv::SimilarRects::operator()(), cv::MatExpr::operator^(), cv::FileNode::read(), cv::gapi::own::saturate(), cv::saturate_cast< int64 >(), cv::saturate_cast< schar >(), cv::saturate_cast< short >(), cv::saturate_cast< uchar >(), cv::saturate_cast< unsigned >(), cv::saturate_cast< ushort >(), cv::DetectionBasedTracker::IDetector::setMinObjectSize(), and cv::v_popcount().
|
inline |
#include <opencv2/core/softfloat.hpp>
Referenced by cv::saturate_cast< schar >(), cv::saturate_cast< short >(), cv::saturate_cast< uchar >(), and cv::saturate_cast< ushort >().
#include <opencv2/core/softfloat.hpp>
Fused Multiplication and Addition.
Computes (a*b)+c with single rounding
softdouble cv::mulAdd | ( | const softdouble & | a, |
const softdouble & | b, | ||
const softdouble & | c | ||
) |
#include <opencv2/core/softfloat.hpp>
|
inlinestatic |
#include <opencv2/core/softfloat.hpp>
Default NaN constant.
References cv::softfloat::fromRaw().
|
inlinestatic |
#include <opencv2/core/softfloat.hpp>
Default NaN constant.
References CV_BIG_INT, and cv::softdouble::fromRaw().
|
inlinestatic |
#include <opencv2/core/softfloat.hpp>
One constant.
References cv::softfloat::fromRaw().
|
inlinestatic |
#include <opencv2/core/softfloat.hpp>
One constant.
References cv::softdouble::fromRaw().
|
inline |
#include <opencv2/core/softfloat.hpp>
References Cv64suf::f, cv::operator*(), cv::operator+(), cv::operator-(), cv::operator/(), and Cv64suf::u.
|
inline |
#include <opencv2/core/softfloat.hpp>
References Cv32suf::f, cv::operator*(), cv::operator+(), cv::operator-(), cv::operator/(), and Cv32suf::u.
cv::softfloat::operator softdouble | ( | ) | const |
#include <opencv2/core/softfloat.hpp>
Type casts.
cv::softdouble::operator softfloat | ( | ) | const |
#include <opencv2/core/softfloat.hpp>
Type casts.
bool cv::softfloat::operator!= | ( | const softfloat & | ) | const |
#include <opencv2/core/softfloat.hpp>
bool cv::softdouble::operator!= | ( | const softdouble & | ) | const |
#include <opencv2/core/softfloat.hpp>
#include <opencv2/core/softfloat.hpp>
Remainder operator.
A quote from original SoftFloat manual:
The IEEE Standard remainder operation computes the value a - n * b, where n is the integer closest to a / b. If a / b is exactly halfway between two integers, n is the even integer closest to a / b. The IEEE Standard’s remainder operation is always exact and so requires no rounding. Depending on the relative magnitudes of the operands, the remainder functions can take considerably longer to execute than the other SoftFloat functions. This is an inherent characteristic of the remainder operation itself and is not a flaw in the SoftFloat implementation.
softdouble cv::softdouble::operator% | ( | const softdouble & | ) | const |
#include <opencv2/core/softfloat.hpp>
Remainder operator.
A quote from original SoftFloat manual:
The IEEE Standard remainder operation computes the value a - n * b, where n is the integer closest to a / b. If a / b is exactly halfway between two integers, n is the even integer closest to a / b. The IEEE Standard’s remainder operation is always exact and so requires no rounding. Depending on the relative magnitudes of the operands, the remainder functions can take considerably longer to execute than the other SoftFloat functions. This is an inherent characteristic of the remainder operation itself and is not a flaw in the SoftFloat implementation.
#include <opencv2/core/softfloat.hpp>
References cv::operator!=(), cv::operator<(), cv::operator<=(), cv::operator==(), cv::operator>(), and cv::operator>=().
|
inline |
#include <opencv2/core/softfloat.hpp>
References cv::operator!=(), cv::operator<(), cv::operator<=(), cv::operator==(), cv::operator>(), and cv::operator>=().
#include <opencv2/core/softfloat.hpp>
softdouble cv::softdouble::operator* | ( | const softdouble & | ) | const |
#include <opencv2/core/softfloat.hpp>
#include <opencv2/core/softfloat.hpp>
|
inline |
#include <opencv2/core/softfloat.hpp>
#include <opencv2/core/softfloat.hpp>
Basic arithmetics.
softdouble cv::softdouble::operator+ | ( | const softdouble & | ) | const |
#include <opencv2/core/softfloat.hpp>
Basic arithmetics.
#include <opencv2/core/softfloat.hpp>
|
inline |
#include <opencv2/core/softfloat.hpp>
#include <opencv2/core/softfloat.hpp>
|
inline |
#include <opencv2/core/softfloat.hpp>
References cv::softfloat::v.
softdouble cv::softdouble::operator- | ( | const softdouble & | ) | const |
#include <opencv2/core/softfloat.hpp>
|
inline |
#include <opencv2/core/softfloat.hpp>
References cv::softdouble::v.
#include <opencv2/core/softfloat.hpp>
|
inline |
#include <opencv2/core/softfloat.hpp>
#include <opencv2/core/softfloat.hpp>
softdouble cv::softdouble::operator/ | ( | const softdouble & | ) | const |
#include <opencv2/core/softfloat.hpp>
#include <opencv2/core/softfloat.hpp>
|
inline |
#include <opencv2/core/softfloat.hpp>
bool cv::softfloat::operator< | ( | const softfloat & | ) | const |
#include <opencv2/core/softfloat.hpp>
bool cv::softdouble::operator< | ( | const softdouble & | ) | const |
#include <opencv2/core/softfloat.hpp>
bool cv::softfloat::operator<= | ( | const softfloat & | ) | const |
#include <opencv2/core/softfloat.hpp>
bool cv::softdouble::operator<= | ( | const softdouble & | ) | const |
#include <opencv2/core/softfloat.hpp>
|
inline |
bool cv::softfloat::operator== | ( | const softfloat & | ) | const |
#include <opencv2/core/softfloat.hpp>
Comparison operations.
bool cv::softdouble::operator== | ( | const softdouble & | ) | const |
#include <opencv2/core/softfloat.hpp>
Comparison operations.
bool cv::softfloat::operator> | ( | const softfloat & | ) | const |
#include <opencv2/core/softfloat.hpp>
bool cv::softdouble::operator> | ( | const softdouble & | ) | const |
#include <opencv2/core/softfloat.hpp>
bool cv::softfloat::operator>= | ( | const softfloat & | ) | const |
#include <opencv2/core/softfloat.hpp>
bool cv::softdouble::operator>= | ( | const softdouble & | ) | const |
#include <opencv2/core/softfloat.hpp>
|
inlinestatic |
#include <opencv2/core/softfloat.hpp>
Correct pi approximation.
References cv::softfloat::fromRaw().
|
inlinestatic |
#include <opencv2/core/softfloat.hpp>
Correct pi approximation.
References CV_BIG_INT, and cv::softdouble::fromRaw().
#include <opencv2/core/softfloat.hpp>
Raising to the power.
Special cases:
Referenced by cv::abs(), cvflann::MinkowskiDistance< T >::accum_dist(), and cvflann::MinkowskiDistance< T >::operator()().
softdouble cv::pow | ( | const softdouble & | a, |
const softdouble & | b | ||
) |
#include <opencv2/core/softfloat.hpp>
|
inlinestatic |
#include <opencv2/core/softfloat.hpp>
Saturate casts.
|
inlinestatic |
#include <opencv2/core/softfloat.hpp>
|
inline |
#include <opencv2/core/softfloat.hpp>
References cvRound().
|
inline |
#include <opencv2/core/softfloat.hpp>
|
inline |
|
inline |
|
inline |
|
inline |
#include <opencv2/core/softfloat.hpp>
References cvRound(), cv::max(), cv::min(), and cv::saturate_cast().
|
inline |
|
inline |
|
inline |
#include <opencv2/core/softfloat.hpp>
References cvRound().
|
inline |
#include <opencv2/core/softfloat.hpp>
|
inline |
#include <opencv2/core/softfloat.hpp>
Saturate cast to unsigned integer and unsigned long long integer We intentionally do not clip negative numbers, to make -1 become 0xffffffff etc.
References cvRound().
|
inline |
#include <opencv2/core/softfloat.hpp>
References cvRound().
|
inline |
|
inline |
|
inline |
#include <opencv2/core/softfloat.hpp>
Construct a copy with new 0-based exponent.
References cv::softfloat::v.
|
inline |
#include <opencv2/core/softfloat.hpp>
Construct a copy with new 0-based exponent.
References cv::softdouble::v.
#include <opencv2/core/softfloat.hpp>
Construct a copy with provided significand.
Constructs a copy of a number with significand taken from parameter
References cv::softfloat::v.
|
inline |
#include <opencv2/core/softfloat.hpp>
Construct a copy with provided significand.
Constructs a copy of a number with significand taken from parameter
References cv::softdouble::v.
|
inline |
#include <opencv2/core/softfloat.hpp>
Construct a copy with new sign bit.
References cv::softfloat::v.
|
inline |
#include <opencv2/core/softfloat.hpp>
Construct a copy with new sign bit.
References cv::softdouble::v.
softdouble cv::sin | ( | const softdouble & | a | ) |
#include <opencv2/core/softfloat.hpp>
Sine.
Special cases:
Referenced by cv::abs().
#include <opencv2/core/softfloat.hpp>
Square root.
Referenced by cv::abs(), cvflann::HellingerDistance< T >::accum_dist(), cvflann::KMeansIndex< Distance >::getParameters(), cvflann::HellingerDistance< T >::operator()(), cv::L2< T >::operator()(), cvflann::simpleDistance< L2_Simple< ElementType >, ElementType >::operator()(), cvflann::simpleDistance< L2< ElementType >, ElementType >::operator()(), cvflann::simpleDistance< MinkowskiDistance< ElementType >, ElementType >::operator()(), cvflann::simpleDistance< HellingerDistance< ElementType >, ElementType >::operator()(), cvflann::simpleDistance< ChiSquareDistance< ElementType >, ElementType >::operator()(), cv::v_invsqrt(), cv::v_magnitude(), and cv::hal::DCT2D::~DCT2D().
softdouble cv::sqrt | ( | const softdouble & | a | ) |
#include <opencv2/core/softfloat.hpp>
|
inlinestatic |
#include <opencv2/core/softfloat.hpp>
Zero constant.
References cv::softfloat::fromRaw().
|
inlinestatic |
#include <opencv2/core/softfloat.hpp>
Zero constant.
References cv::softdouble::fromRaw().
uint32_t cv::softfloat::v |
uint64_t cv::softdouble::v |