OpenCV  4.1.1-pre
Open Source Computer Vision
Looking for a C++ dev who knows OpenCV?
I'm looking for work. Hire me!

SoftFloat is a software implementation of floating-point calculations according to IEEE 754 standard. More...

Collaboration diagram for Softfloat support:

Classes

struct  cv::softdouble
 
struct  cv::softfloat
 

Functions

 cv::softdouble::softdouble ()
 Default constructor. More...
 
 cv::softdouble::softdouble (const softdouble &c)
 Copy constructor. More...
 
 cv::softdouble::softdouble (const uint32_t)
 Construct from integer. More...
 
 cv::softdouble::softdouble (const uint64_t)
 
 cv::softdouble::softdouble (const int32_t)
 
 cv::softdouble::softdouble (const int64_t)
 
 cv::softdouble::softdouble (const double a)
 Construct from double. More...
 
 cv::softfloat::softfloat ()
 Default constructor. More...
 
 cv::softfloat::softfloat (const softfloat &c)
 Copy constructor. More...
 
 cv::softfloat::softfloat (const uint32_t)
 Construct from integer. More...
 
 cv::softfloat::softfloat (const uint64_t)
 
 cv::softfloat::softfloat (const int32_t)
 
 cv::softfloat::softfloat (const int64_t)
 
 cv::softfloat::softfloat (const float a)
 Construct from float. More...
 
softfloat cv::abs (softfloat a)
 Absolute value. More...
 
softdouble cv::abs (softdouble a)
 
softfloat cv::cbrt (const softfloat &a)
 Cube root. More...
 
softdouble cv::cos (const softdouble &a)
 Cosine. More...
 
static softfloat cv::softfloat::eps ()
 Difference between 1 and next representable value. More...
 
static softdouble cv::softdouble::eps ()
 Difference between 1 and next representable value. More...
 
softfloat cv::exp (const softfloat &a)
 Exponent. More...
 
softdouble cv::exp (const softdouble &a)
 
static const softfloat cv::softfloat::fromRaw (const uint32_t a)
 Construct from raw. More...
 
static softdouble cv::softdouble::fromRaw (const uint64_t a)
 Construct from raw. More...
 
int cv::softfloat::getExp () const
 Get 0-based exponent. More...
 
int cv::softdouble::getExp () const
 Get 0-based exponent. More...
 
softfloat cv::softfloat::getFrac () const
 Get a fraction part. More...
 
softdouble cv::softdouble::getFrac () const
 Get a fraction part. More...
 
bool cv::softfloat::getSign () const
 Get sign bit. More...
 
bool cv::softdouble::getSign () const
 Get sign bit. More...
 
static softfloat cv::softfloat::inf ()
 Positive infinity constant. More...
 
static softdouble cv::softdouble::inf ()
 Positive infinity constant. More...
 
bool cv::softfloat::isInf () const
 Inf state indicator. More...
 
bool cv::softdouble::isInf () const
 Inf state indicator. More...
 
bool cv::softfloat::isNaN () const
 NaN state indicator. More...
 
bool cv::softdouble::isNaN () const
 NaN state indicator. More...
 
bool cv::softfloat::isSubnormal () const
 Subnormal number indicator. More...
 
bool cv::softdouble::isSubnormal () const
 Subnormal number indicator. More...
 
softfloat cv::log (const softfloat &a)
 Natural logarithm. More...
 
softdouble cv::log (const softdouble &a)
 
static softfloat cv::softfloat::max ()
 Biggest finite value. More...
 
static softdouble cv::softdouble::max ()
 Biggest finite value. More...
 
softfloat cv::max (const softfloat &a, const softfloat &b)
 
softdouble cv::max (const softdouble &a, const softdouble &b)
 
static softfloat cv::softfloat::min ()
 Smallest normalized value. More...
 
static softdouble cv::softdouble::min ()
 Smallest normalized value. More...
 
softfloat cv::min (const softfloat &a, const softfloat &b)
 Min and Max functions. More...
 
softdouble cv::min (const softdouble &a, const softdouble &b)
 
softfloat cv::mulAdd (const softfloat &a, const softfloat &b, const softfloat &c)
 Fused Multiplication and Addition. More...
 
softdouble cv::mulAdd (const softdouble &a, const softdouble &b, const softdouble &c)
 
static softfloat cv::softfloat::nan ()
 Default NaN constant. More...
 
static softdouble cv::softdouble::nan ()
 Default NaN constant. More...
 
static softfloat cv::softfloat::one ()
 One constant. More...
 
static softdouble cv::softdouble::one ()
 One constant. More...
 
 cv::softdouble::operator double () const
 
 cv::softfloat::operator float () const
 
 cv::softfloat::operator softdouble () const
 Type casts. More...
 
 cv::softdouble::operator softfloat () const
 Type casts. More...
 
bool cv::softfloat::operator!= (const softfloat &) const
 
bool cv::softdouble::operator!= (const softdouble &) const
 
softfloat cv::softfloat::operator% (const softfloat &) const
 Remainder operator. More...
 
softdouble cv::softdouble::operator% (const softdouble &) const
 Remainder operator. More...
 
softfloatcv::softfloat::operator%= (const softfloat &a)
 
softdoublecv::softdouble::operator%= (const softdouble &a)
 
softfloat cv::softfloat::operator* (const softfloat &) const
 
softdouble cv::softdouble::operator* (const softdouble &) const
 
softfloatcv::softfloat::operator*= (const softfloat &a)
 
softdoublecv::softdouble::operator*= (const softdouble &a)
 
softfloat cv::softfloat::operator+ (const softfloat &) const
 Basic arithmetics. More...
 
softdouble cv::softdouble::operator+ (const softdouble &) const
 Basic arithmetics. More...
 
softfloatcv::softfloat::operator+= (const softfloat &a)
 
softdoublecv::softdouble::operator+= (const softdouble &a)
 
softfloat cv::softfloat::operator- (const softfloat &) const
 
softfloat cv::softfloat::operator- () const
 
softdouble cv::softdouble::operator- (const softdouble &) const
 
softdouble cv::softdouble::operator- () const
 
softfloatcv::softfloat::operator-= (const softfloat &a)
 
softdoublecv::softdouble::operator-= (const softdouble &a)
 
softfloat cv::softfloat::operator/ (const softfloat &) const
 
softdouble cv::softdouble::operator/ (const softdouble &) const
 
softfloatcv::softfloat::operator/= (const softfloat &a)
 
softdoublecv::softdouble::operator/= (const softdouble &a)
 
bool cv::softfloat::operator< (const softfloat &) const
 
bool cv::softdouble::operator< (const softdouble &) const
 
bool cv::softfloat::operator<= (const softfloat &) const
 
bool cv::softdouble::operator<= (const softdouble &) const
 
softfloatcv::softfloat::operator= (const softfloat &c)
 Assign constructor. More...
 
softdoublecv::softdouble::operator= (const softdouble &c)
 Assign constructor. More...
 
bool cv::softfloat::operator== (const softfloat &) const
 Comparison operations. More...
 
bool cv::softdouble::operator== (const softdouble &) const
 Comparison operations. More...
 
bool cv::softfloat::operator> (const softfloat &) const
 
bool cv::softdouble::operator> (const softdouble &) const
 
bool cv::softfloat::operator>= (const softfloat &) const
 
bool cv::softdouble::operator>= (const softdouble &) const
 
static softfloat cv::softfloat::pi ()
 Correct pi approximation. More...
 
static softdouble cv::softdouble::pi ()
 Correct pi approximation. More...
 
softfloat cv::pow (const softfloat &a, const softfloat &b)
 Raising to the power. More...
 
softdouble cv::pow (const softdouble &a, const softdouble &b)
 
template<typename _Tp >
static _Tp cv::saturate_cast (softfloat a)
 Saturate casts. More...
 
template<typename _Tp >
static _Tp cv::saturate_cast (softdouble a)
 
template<>
int64_t cv::saturate_cast< int64_t > (softfloat a)
 
template<>
int64_t cv::saturate_cast< int64_t > (softdouble a)
 
template<>
schar cv::saturate_cast< schar > (softfloat a)
 
template<>
schar cv::saturate_cast< schar > (softdouble a)
 
template<>
short cv::saturate_cast< short > (softfloat a)
 
template<>
short cv::saturate_cast< short > (softdouble a)
 
template<>
uchar cv::saturate_cast< uchar > (softfloat a)
 
template<>
uchar cv::saturate_cast< uchar > (softdouble a)
 
template<>
uint64_t cv::saturate_cast< uint64_t > (softfloat a)
 
template<>
uint64_t cv::saturate_cast< uint64_t > (softdouble a)
 
template<>
unsigned cv::saturate_cast< unsigned > (softfloat a)
 Saturate cast to unsigned integer and unsigned long long integer We intentionally do not clip negative numbers, to make -1 become 0xffffffff etc. More...
 
template<>
unsigned cv::saturate_cast< unsigned > (softdouble a)
 
template<>
ushort cv::saturate_cast< ushort > (softfloat a)
 
template<>
ushort cv::saturate_cast< ushort > (softdouble a)
 
softfloat cv::softfloat::setExp (int e) const
 Construct a copy with new 0-based exponent. More...
 
softdouble cv::softdouble::setExp (int e) const
 Construct a copy with new 0-based exponent. More...
 
softfloat cv::softfloat::setFrac (const softfloat &s) const
 Construct a copy with provided significand. More...
 
softdouble cv::softdouble::setFrac (const softdouble &s) const
 Construct a copy with provided significand. More...
 
softfloat cv::softfloat::setSign (bool sign) const
 Construct a copy with new sign bit. More...
 
softdouble cv::softdouble::setSign (bool sign) const
 Construct a copy with new sign bit. More...
 
softdouble cv::sin (const softdouble &a)
 Sine. More...
 
softfloat cv::sqrt (const softfloat &a)
 Square root. More...
 
softdouble cv::sqrt (const softdouble &a)
 
static softfloat cv::softfloat::zero ()
 Zero constant. More...
 
static softdouble cv::softdouble::zero ()
 Zero constant. More...
 

Variables

uint32_t cv::softfloat::v
 
uint64_t cv::softdouble::v
 

Detailed Description

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++.

Types

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).

Operations

Both types support the following:

Function Documentation

◆ softdouble() [1/7]

cv::softdouble::softdouble ( )
inline

#include <opencv2/core/softfloat.hpp>

Default constructor.

◆ softdouble() [2/7]

cv::softdouble::softdouble ( const softdouble c)
inline

#include <opencv2/core/softfloat.hpp>

Copy constructor.

References cv::softdouble::v.

◆ softdouble() [3/7]

cv::softdouble::softdouble ( const uint32_t  )
explicit

#include <opencv2/core/softfloat.hpp>

Construct from integer.

◆ softdouble() [4/7]

cv::softdouble::softdouble ( const uint64_t  )
explicit

#include <opencv2/core/softfloat.hpp>

◆ softdouble() [5/7]

cv::softdouble::softdouble ( const int32_t  )
explicit

#include <opencv2/core/softfloat.hpp>

◆ softdouble() [6/7]

cv::softdouble::softdouble ( const int64_t  )
explicit

#include <opencv2/core/softfloat.hpp>

◆ softdouble() [7/7]

cv::softdouble::softdouble ( const double  a)
inlineexplicit

#include <opencv2/core/softfloat.hpp>

Construct from double.

References Cv64suf::f, and Cv64suf::u.

◆ softfloat() [1/7]

cv::softfloat::softfloat ( )
inline

#include <opencv2/core/softfloat.hpp>

Default constructor.

◆ softfloat() [2/7]

cv::softfloat::softfloat ( const softfloat c)
inline

#include <opencv2/core/softfloat.hpp>

Copy constructor.

References cv::softfloat::v.

◆ softfloat() [3/7]

cv::softfloat::softfloat ( const uint32_t  )
explicit

#include <opencv2/core/softfloat.hpp>

Construct from integer.

◆ softfloat() [4/7]

cv::softfloat::softfloat ( const uint64_t  )
explicit

#include <opencv2/core/softfloat.hpp>

◆ softfloat() [5/7]

cv::softfloat::softfloat ( const int32_t  )
explicit

#include <opencv2/core/softfloat.hpp>

◆ softfloat() [6/7]

cv::softfloat::softfloat ( const int64_t  )
explicit

#include <opencv2/core/softfloat.hpp>

◆ softfloat() [7/7]

cv::softfloat::softfloat ( const float  a)
inlineexplicit

#include <opencv2/core/softfloat.hpp>

Construct from float.

References Cv32suf::f, and Cv32suf::u.

◆ abs() [1/2]

softfloat cv::abs ( softfloat  a)
inline

#include <opencv2/core/softfloat.hpp>

Absolute value.

Examples:
samples/cpp/camshiftdemo.cpp, samples/cpp/contours2.cpp, samples/cpp/stitching_detailed.cpp, samples/cpp/warpPerspective_demo.cpp, and samples/tapi/hog.cpp.

References cv::softfloat::v.

Referenced by cvflann::abs(), cv::abs(), cv::cv_abs(), cv::normInf(), cv::normL1(), and cv::SimilarRects::operator()().

Here is the caller graph for this function:

◆ abs() [2/2]

softdouble cv::abs ( softdouble  a)
inline

#include <opencv2/core/softfloat.hpp>

References cv::cbrt(), cv::cos(), cv::exp(), cv::log(), cv::pow(), cv::sin(), and cv::softdouble::v.

Here is the call graph for this function:

◆ cbrt()

softfloat cv::cbrt ( const softfloat a)

#include <opencv2/core/softfloat.hpp>

Cube root.

Special cases:

  • cbrt(NaN) is NaN
  • cbrt(+/-Inf) is +/-Inf

Referenced by cv::abs().

Here is the caller graph for this function:

◆ cos()

softdouble cv::cos ( const softdouble a)

#include <opencv2/core/softfloat.hpp>

Cosine.

Special cases:

  • cos(Inf) or cos(NaN) is NaN
  • cos(x) == +/- 1 when cos(x) is close to +/- 1
Examples:
samples/cpp/contours2.cpp, samples/cpp/image_alignment.cpp, samples/cpp/kalman.cpp, samples/cpp/polar_transforms.cpp, samples/cpp/tutorial_code/ImgTrans/houghlines.cpp, samples/cpp/tutorial_code/ml/introduction_to_pca/introduction_to_pca.cpp, and samples/dnn/text_detection.cpp.

Referenced by cv::abs().

Here is the caller graph for this function:

◆ eps() [1/2]

static softfloat cv::softfloat::eps ( )
inlinestatic

#include <opencv2/core/softfloat.hpp>

Difference between 1 and next representable value.

References cv::softfloat::fromRaw().

Here is the call graph for this function:

◆ eps() [2/2]

static softdouble cv::softdouble::eps ( )
inlinestatic

#include <opencv2/core/softfloat.hpp>

Difference between 1 and next representable value.

References cv::softdouble::fromRaw().

Here is the call graph for this function:

◆ exp() [1/2]

softfloat cv::exp ( const softfloat a)

#include <opencv2/core/softfloat.hpp>

Exponent.

Special cases:

  • exp(NaN) is NaN
  • exp(-Inf) == 0
  • exp(+Inf) == +Inf
Examples:
samples/cpp/polar_transforms.cpp.

Referenced by cv::abs(), and cv::hal::DCT2D::~DCT2D().

Here is the caller graph for this function:

◆ exp() [2/2]

softdouble cv::exp ( const softdouble a)

#include <opencv2/core/softfloat.hpp>

◆ fromRaw() [1/2]

static const softfloat cv::softfloat::fromRaw ( const uint32_t  a)
inlinestatic

#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().

Here is the caller graph for this function:

◆ fromRaw() [2/2]

static softdouble cv::softdouble::fromRaw ( const uint64_t  a)
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().

Here is the caller graph for this function:

◆ getExp() [1/2]

int cv::softfloat::getExp ( ) const
inline

#include <opencv2/core/softfloat.hpp>

Get 0-based exponent.

◆ getExp() [2/2]

int cv::softdouble::getExp ( ) const
inline

#include <opencv2/core/softfloat.hpp>

Get 0-based exponent.

◆ getFrac() [1/2]

softfloat cv::softfloat::getFrac ( ) const
inline

#include <opencv2/core/softfloat.hpp>

Get a fraction part.

Returns a number 1 <= x < 2 with the same significand

References cv::softfloat::fromRaw().

Here is the call graph for this function:

◆ getFrac() [2/2]

softdouble cv::softdouble::getFrac ( ) const
inline

#include <opencv2/core/softfloat.hpp>

Get a fraction part.

Returns a number 1 <= x < 2 with the same significand

References cv::softdouble::fromRaw().

Here is the call graph for this function:

◆ getSign() [1/2]

bool cv::softfloat::getSign ( ) const
inline

#include <opencv2/core/softfloat.hpp>

Get sign bit.

◆ getSign() [2/2]

bool cv::softdouble::getSign ( ) const
inline

#include <opencv2/core/softfloat.hpp>

Get sign bit.

◆ inf() [1/2]

static softfloat cv::softfloat::inf ( )
inlinestatic

#include <opencv2/core/softfloat.hpp>

Positive infinity constant.

References cv::softfloat::fromRaw().

Here is the call graph for this function:

◆ inf() [2/2]

static softdouble cv::softdouble::inf ( )
inlinestatic

#include <opencv2/core/softfloat.hpp>

Positive infinity constant.

References cv::softdouble::fromRaw().

Here is the call graph for this function:

◆ isInf() [1/2]

bool cv::softfloat::isInf ( ) const
inline

#include <opencv2/core/softfloat.hpp>

Inf state indicator.

◆ isInf() [2/2]

bool cv::softdouble::isInf ( ) const
inline

#include <opencv2/core/softfloat.hpp>

Inf state indicator.

◆ isNaN() [1/2]

bool cv::softfloat::isNaN ( ) const
inline

#include <opencv2/core/softfloat.hpp>

NaN state indicator.

◆ isNaN() [2/2]

bool cv::softdouble::isNaN ( ) const
inline

#include <opencv2/core/softfloat.hpp>

NaN state indicator.

◆ isSubnormal() [1/2]

bool cv::softfloat::isSubnormal ( ) const
inline

#include <opencv2/core/softfloat.hpp>

Subnormal number indicator.

◆ isSubnormal() [2/2]

bool cv::softdouble::isSubnormal ( ) const
inline

#include <opencv2/core/softfloat.hpp>

Subnormal number indicator.

◆ log() [1/2]

softfloat cv::log ( const softfloat a)

#include <opencv2/core/softfloat.hpp>

Natural logarithm.

Special cases:

  • log(NaN), log(x < 0) are NaN
  • log(0) == -Inf
Examples:
samples/cpp/polar_transforms.cpp, and samples/cpp/stitching_detailed.cpp.

Referenced by cv::abs(), cvflann::KL_Divergence< T >::accum_dist(), cvflann::KL_Divergence< T >::operator()(), and cv::hal::DCT2D::~DCT2D().

Here is the caller graph for this function:

◆ log() [2/2]

softdouble cv::log ( const softdouble a)

#include <opencv2/core/softfloat.hpp>

◆ max() [1/4]

static softfloat cv::softfloat::max ( )
inlinestatic

#include <opencv2/core/softfloat.hpp>

Biggest finite value.

References cv::softfloat::fromRaw().

Here is the call graph for this function:

◆ max() [2/4]

static softdouble cv::softdouble::max ( )
inlinestatic

#include <opencv2/core/softfloat.hpp>

Biggest finite value.

References cv::softdouble::fromRaw().

Here is the call graph for this function:

◆ max() [3/4]

◆ max() [4/4]

softdouble cv::max ( const softdouble a,
const softdouble b 
)
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 >().

Here is the caller graph for this function:

◆ min() [1/4]

static softfloat cv::softfloat::min ( )
inlinestatic

#include <opencv2/core/softfloat.hpp>

Smallest normalized value.

References cv::softfloat::fromRaw().

Here is the call graph for this function:

◆ min() [2/4]

static softdouble cv::softdouble::min ( )
inlinestatic

#include <opencv2/core/softfloat.hpp>

Smallest normalized value.

References cv::softdouble::fromRaw().

Here is the call graph for this function:

◆ min() [3/4]

◆ min() [4/4]

softdouble cv::min ( const softdouble a,
const softdouble b 
)
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 >().

Here is the caller graph for this function:

◆ mulAdd() [1/2]

softfloat cv::mulAdd ( const softfloat a,
const softfloat b,
const softfloat c 
)

#include <opencv2/core/softfloat.hpp>

Fused Multiplication and Addition.

Computes (a*b)+c with single rounding

◆ mulAdd() [2/2]

softdouble cv::mulAdd ( const softdouble a,
const softdouble b,
const softdouble c 
)

#include <opencv2/core/softfloat.hpp>

◆ nan() [1/2]

static softfloat cv::softfloat::nan ( )
inlinestatic

#include <opencv2/core/softfloat.hpp>

Default NaN constant.

References cv::softfloat::fromRaw().

Here is the call graph for this function:

◆ nan() [2/2]

static softdouble cv::softdouble::nan ( )
inlinestatic

#include <opencv2/core/softfloat.hpp>

Default NaN constant.

References CV_BIG_INT, and cv::softdouble::fromRaw().

Here is the call graph for this function:

◆ one() [1/2]

static softfloat cv::softfloat::one ( )
inlinestatic

#include <opencv2/core/softfloat.hpp>

One constant.

References cv::softfloat::fromRaw().

Here is the call graph for this function:

◆ one() [2/2]

static softdouble cv::softdouble::one ( )
inlinestatic

#include <opencv2/core/softfloat.hpp>

One constant.

References cv::softdouble::fromRaw().

Here is the call graph for this function:

◆ operator double()

cv::softdouble::operator double ( ) const
inline

#include <opencv2/core/softfloat.hpp>

References Cv64suf::f, cv::operator*(), cv::operator+(), cv::operator-(), cv::operator/(), and Cv64suf::u.

Here is the call graph for this function:

◆ operator float()

cv::softfloat::operator float ( ) const
inline

#include <opencv2/core/softfloat.hpp>

References Cv32suf::f, cv::operator*(), cv::operator+(), cv::operator-(), cv::operator/(), and Cv32suf::u.

Here is the call graph for this function:

◆ operator softdouble()

cv::softfloat::operator softdouble ( ) const

#include <opencv2/core/softfloat.hpp>

Type casts.

◆ operator softfloat()

cv::softdouble::operator softfloat ( ) const

#include <opencv2/core/softfloat.hpp>

Type casts.

◆ operator!=() [1/2]

bool cv::softfloat::operator!= ( const softfloat ) const

#include <opencv2/core/softfloat.hpp>

◆ operator!=() [2/2]

bool cv::softdouble::operator!= ( const softdouble ) const

#include <opencv2/core/softfloat.hpp>

◆ operator%() [1/2]

softfloat cv::softfloat::operator% ( const softfloat ) 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.

◆ operator%() [2/2]

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.

◆ operator%=() [1/2]

softfloat& cv::softfloat::operator%= ( const softfloat a)
inline

#include <opencv2/core/softfloat.hpp>

References cv::operator!=(), cv::operator<(), cv::operator<=(), cv::operator==(), cv::operator>(), and cv::operator>=().

Here is the call graph for this function:

◆ operator%=() [2/2]

softdouble& cv::softdouble::operator%= ( const softdouble a)
inline

#include <opencv2/core/softfloat.hpp>

References cv::operator!=(), cv::operator<(), cv::operator<=(), cv::operator==(), cv::operator>(), and cv::operator>=().

Here is the call graph for this function:

◆ operator*() [1/2]

softfloat cv::softfloat::operator* ( const softfloat ) const

#include <opencv2/core/softfloat.hpp>

◆ operator*() [2/2]

softdouble cv::softdouble::operator* ( const softdouble ) const

#include <opencv2/core/softfloat.hpp>

◆ operator*=() [1/2]

softfloat& cv::softfloat::operator*= ( const softfloat a)
inline

#include <opencv2/core/softfloat.hpp>

◆ operator*=() [2/2]

softdouble& cv::softdouble::operator*= ( const softdouble a)
inline

#include <opencv2/core/softfloat.hpp>

◆ operator+() [1/2]

softfloat cv::softfloat::operator+ ( const softfloat ) const

#include <opencv2/core/softfloat.hpp>

Basic arithmetics.

◆ operator+() [2/2]

softdouble cv::softdouble::operator+ ( const softdouble ) const

#include <opencv2/core/softfloat.hpp>

Basic arithmetics.

◆ operator+=() [1/2]

softfloat& cv::softfloat::operator+= ( const softfloat a)
inline

#include <opencv2/core/softfloat.hpp>

◆ operator+=() [2/2]

softdouble& cv::softdouble::operator+= ( const softdouble a)
inline

#include <opencv2/core/softfloat.hpp>

◆ operator-() [1/4]

softfloat cv::softfloat::operator- ( const softfloat ) const

#include <opencv2/core/softfloat.hpp>

◆ operator-() [2/4]

softfloat cv::softfloat::operator- ( ) const
inline

#include <opencv2/core/softfloat.hpp>

References cv::softfloat::v.

◆ operator-() [3/4]

softdouble cv::softdouble::operator- ( const softdouble ) const

#include <opencv2/core/softfloat.hpp>

◆ operator-() [4/4]

softdouble cv::softdouble::operator- ( ) const
inline

#include <opencv2/core/softfloat.hpp>

References cv::softdouble::v.

◆ operator-=() [1/2]

softfloat& cv::softfloat::operator-= ( const softfloat a)
inline

#include <opencv2/core/softfloat.hpp>

◆ operator-=() [2/2]

softdouble& cv::softdouble::operator-= ( const softdouble a)
inline

#include <opencv2/core/softfloat.hpp>

◆ operator/() [1/2]

softfloat cv::softfloat::operator/ ( const softfloat ) const

#include <opencv2/core/softfloat.hpp>

◆ operator/() [2/2]

softdouble cv::softdouble::operator/ ( const softdouble ) const

#include <opencv2/core/softfloat.hpp>

◆ operator/=() [1/2]

softfloat& cv::softfloat::operator/= ( const softfloat a)
inline

#include <opencv2/core/softfloat.hpp>

◆ operator/=() [2/2]

softdouble& cv::softdouble::operator/= ( const softdouble a)
inline

#include <opencv2/core/softfloat.hpp>

◆ operator<() [1/2]

bool cv::softfloat::operator< ( const softfloat ) const

#include <opencv2/core/softfloat.hpp>

◆ operator<() [2/2]

bool cv::softdouble::operator< ( const softdouble ) const

#include <opencv2/core/softfloat.hpp>

◆ operator<=() [1/2]

bool cv::softfloat::operator<= ( const softfloat ) const

#include <opencv2/core/softfloat.hpp>

◆ operator<=() [2/2]

bool cv::softdouble::operator<= ( const softdouble ) const

#include <opencv2/core/softfloat.hpp>

◆ operator=() [1/2]

softfloat& cv::softfloat::operator= ( const softfloat c)
inline

#include <opencv2/core/softfloat.hpp>

Assign constructor.

References cv::softfloat::v.

◆ operator=() [2/2]

softdouble& cv::softdouble::operator= ( const softdouble c)
inline

#include <opencv2/core/softfloat.hpp>

Assign constructor.

References cv::softdouble::v.

◆ operator==() [1/2]

bool cv::softfloat::operator== ( const softfloat ) const

#include <opencv2/core/softfloat.hpp>

Comparison operations.

  • Any operation with NaN produces false
    • The only exception is when x is NaN: x != y for any y.
  • Positive and negative zeros are equal

◆ operator==() [2/2]

bool cv::softdouble::operator== ( const softdouble ) const

#include <opencv2/core/softfloat.hpp>

Comparison operations.

  • Any operation with NaN produces false
    • The only exception is when x is NaN: x != y for any y.
  • Positive and negative zeros are equal

◆ operator>() [1/2]

bool cv::softfloat::operator> ( const softfloat ) const

#include <opencv2/core/softfloat.hpp>

◆ operator>() [2/2]

bool cv::softdouble::operator> ( const softdouble ) const

#include <opencv2/core/softfloat.hpp>

◆ operator>=() [1/2]

bool cv::softfloat::operator>= ( const softfloat ) const

#include <opencv2/core/softfloat.hpp>

◆ operator>=() [2/2]

bool cv::softdouble::operator>= ( const softdouble ) const

#include <opencv2/core/softfloat.hpp>

◆ pi() [1/2]

static softfloat cv::softfloat::pi ( )
inlinestatic

#include <opencv2/core/softfloat.hpp>

Correct pi approximation.

References cv::softfloat::fromRaw().

Here is the call graph for this function:

◆ pi() [2/2]

static softdouble cv::softdouble::pi ( )
inlinestatic

#include <opencv2/core/softfloat.hpp>

Correct pi approximation.

References CV_BIG_INT, and cv::softdouble::fromRaw().

Here is the call graph for this function:

◆ pow() [1/2]

softfloat cv::pow ( const softfloat a,
const softfloat b 
)

#include <opencv2/core/softfloat.hpp>

Raising to the power.

Special cases:

  • x**NaN is NaN for any x
  • ( |x| == 1 )**Inf is NaN
  • ( |x| > 1 )**+Inf or ( |x| < 1 )**-Inf is +Inf
  • ( |x| > 1 )**-Inf or ( |x| < 1 )**+Inf is 0
  • x ** 0 == 1 for any x
  • x ** 1 == 1 for any x
  • NaN ** y is NaN for any other y
  • Inf**(y < 0) == 0
  • Inf ** y is +Inf for any other y
  • (x < 0)**y is NaN for any other y if x can't be correctly rounded to integer
  • 0 ** 0 == 1
  • 0 ** (y < 0) is +Inf
  • 0 ** (y > 0) is 0
Examples:
samples/cpp/distrans.cpp.

Referenced by cv::abs(), cvflann::MinkowskiDistance< T >::accum_dist(), and cvflann::MinkowskiDistance< T >::operator()().

Here is the caller graph for this function:

◆ pow() [2/2]

softdouble cv::pow ( const softdouble a,
const softdouble b 
)

#include <opencv2/core/softfloat.hpp>

◆ saturate_cast() [1/2]

template<typename _Tp >
static _Tp cv::saturate_cast ( softfloat  a)
inlinestatic

#include <opencv2/core/softfloat.hpp>

Saturate casts.

◆ saturate_cast() [2/2]

template<typename _Tp >
static _Tp cv::saturate_cast ( softdouble  a)
inlinestatic

#include <opencv2/core/softfloat.hpp>

◆ saturate_cast< int64_t >() [1/2]

template<>
int64_t cv::saturate_cast< int64_t > ( softfloat  a)
inline

#include <opencv2/core/softfloat.hpp>

References cvRound().

Here is the call graph for this function:

◆ saturate_cast< int64_t >() [2/2]

template<>
int64_t cv::saturate_cast< int64_t > ( softdouble  a)
inline

#include <opencv2/core/softfloat.hpp>

◆ saturate_cast< schar >() [1/2]

template<>
schar cv::saturate_cast< schar > ( softfloat  a)
inline

#include <opencv2/core/softfloat.hpp>

References cvRound(), cv::max(), and cv::min().

Here is the call graph for this function:

◆ saturate_cast< schar >() [2/2]

template<>
schar cv::saturate_cast< schar > ( softdouble  a)
inline

#include <opencv2/core/softfloat.hpp>

References cvRound(), cv::max(), and cv::min().

Here is the call graph for this function:

◆ saturate_cast< short >() [1/2]

template<>
short cv::saturate_cast< short > ( softfloat  a)
inline

#include <opencv2/core/softfloat.hpp>

References cvRound(), cv::max(), and cv::min().

Here is the call graph for this function:

◆ saturate_cast< short >() [2/2]

template<>
short cv::saturate_cast< short > ( softdouble  a)
inline

#include <opencv2/core/softfloat.hpp>

References cvRound(), cv::max(), cv::min(), and cv::saturate_cast().

Here is the call graph for this function:

◆ saturate_cast< uchar >() [1/2]

template<>
uchar cv::saturate_cast< uchar > ( softfloat  a)
inline

#include <opencv2/core/softfloat.hpp>

References cvRound(), cv::max(), and cv::min().

Here is the call graph for this function:

◆ saturate_cast< uchar >() [2/2]

template<>
uchar cv::saturate_cast< uchar > ( softdouble  a)
inline

#include <opencv2/core/softfloat.hpp>

References cvRound(), cv::max(), and cv::min().

Here is the call graph for this function:

◆ saturate_cast< uint64_t >() [1/2]

template<>
uint64_t cv::saturate_cast< uint64_t > ( softfloat  a)
inline

#include <opencv2/core/softfloat.hpp>

References cvRound().

Here is the call graph for this function:

◆ saturate_cast< uint64_t >() [2/2]

template<>
uint64_t cv::saturate_cast< uint64_t > ( softdouble  a)
inline

#include <opencv2/core/softfloat.hpp>

◆ saturate_cast< unsigned >() [1/2]

template<>
unsigned cv::saturate_cast< unsigned > ( softfloat  a)
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().

Here is the call graph for this function:

◆ saturate_cast< unsigned >() [2/2]

template<>
unsigned cv::saturate_cast< unsigned > ( softdouble  a)
inline

#include <opencv2/core/softfloat.hpp>

References cvRound().

Here is the call graph for this function:

◆ saturate_cast< ushort >() [1/2]

template<>
ushort cv::saturate_cast< ushort > ( softfloat  a)
inline

#include <opencv2/core/softfloat.hpp>

References cvRound(), cv::max(), and cv::min().

Here is the call graph for this function:

◆ saturate_cast< ushort >() [2/2]

template<>
ushort cv::saturate_cast< ushort > ( softdouble  a)
inline

#include <opencv2/core/softfloat.hpp>

References cvRound(), cv::max(), and cv::min().

Here is the call graph for this function:

◆ setExp() [1/2]

softfloat cv::softfloat::setExp ( int  e) const
inline

#include <opencv2/core/softfloat.hpp>

Construct a copy with new 0-based exponent.

References cv::softfloat::v.

◆ setExp() [2/2]

softdouble cv::softdouble::setExp ( int  e) const
inline

#include <opencv2/core/softfloat.hpp>

Construct a copy with new 0-based exponent.

References cv::softdouble::v.

◆ setFrac() [1/2]

softfloat cv::softfloat::setFrac ( const softfloat s) const
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::softfloat::v.

◆ setFrac() [2/2]

softdouble cv::softdouble::setFrac ( const softdouble s) const
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.

◆ setSign() [1/2]

softfloat cv::softfloat::setSign ( bool  sign) const
inline

#include <opencv2/core/softfloat.hpp>

Construct a copy with new sign bit.

References cv::softfloat::v.

◆ setSign() [2/2]

softdouble cv::softdouble::setSign ( bool  sign) const
inline

#include <opencv2/core/softfloat.hpp>

Construct a copy with new sign bit.

References cv::softdouble::v.

◆ sin()

softdouble cv::sin ( const softdouble a)

#include <opencv2/core/softfloat.hpp>

Sine.

Special cases:

  • sin(Inf) or sin(NaN) is NaN
  • sin(x) == x when sin(x) is close to zero
Examples:
samples/cpp/contours2.cpp, samples/cpp/image_alignment.cpp, samples/cpp/kalman.cpp, samples/cpp/polar_transforms.cpp, samples/cpp/tutorial_code/ImgTrans/houghlines.cpp, samples/cpp/tutorial_code/ml/introduction_to_pca/introduction_to_pca.cpp, and samples/dnn/text_detection.cpp.

Referenced by cv::abs().

Here is the caller graph for this function:

◆ sqrt() [1/2]

◆ sqrt() [2/2]

softdouble cv::sqrt ( const softdouble a)

#include <opencv2/core/softfloat.hpp>

◆ zero() [1/2]

static softfloat cv::softfloat::zero ( )
inlinestatic

#include <opencv2/core/softfloat.hpp>

Zero constant.

References cv::softfloat::fromRaw().

Here is the call graph for this function:

◆ zero() [2/2]

static softdouble cv::softdouble::zero ( )
inlinestatic

#include <opencv2/core/softfloat.hpp>

Zero constant.

References cv::softdouble::fromRaw().

Here is the call graph for this function:

Variable Documentation

◆ v [1/2]

◆ v [2/2]