99 if(&c !=
this) v = c.v;
114#ifdef CV_INT32_T_IS_LONG_INT
124 operator float()
const {
Cv32suf s; s.u = v;
return s.f; }
150 softfloat& operator *= (
const softfloat& a) { *
this = *
this * a;
return *
this; }
151 softfloat& operator /= (
const softfloat& a) { *
this = *
this / a;
return *
this; }
152 softfloat& operator %= (
const softfloat& a) { *
this = *
this % a;
return *
this; }
161 bool operator != (
const softfloat& )
const;
162 bool operator > (
const softfloat& )
const;
163 bool operator >= (
const softfloat& )
const;
164 bool operator < (
const softfloat& )
const;
165 bool operator <= (
const softfloat& )
const;
168 inline bool isNaN()
const {
return (v & 0x7fffffff) > 0x7f800000; }
170 inline bool isInf()
const {
return (v & 0x7fffffff) == 0x7f800000; }
172 inline bool isSubnormal()
const {
return ((v >> 23) & 0xFF) == 0; }
175 inline bool getSign()
const {
return (v >> 31) != 0; }
179 inline int getExp()
const {
return ((v >> 23) & 0xFF) - 127; }
189 uint_fast32_t vv = (v & 0x007fffff) | (127 << 23);
199 x.v = (v & 0xff800000) | (s.v & 0x007fffff);
236 if(&c !=
this) v = c.v;
251#ifdef CV_INT32_T_IS_LONG_INT
261 operator double()
const {
Cv64suf s; s.u = v;
return s.f; }
287 softdouble& operator *= (
const softdouble& a) { *
this = *
this * a;
return *
this; }
288 softdouble& operator /= (
const softdouble& a) { *
this = *
this / a;
return *
this; }
289 softdouble& operator %= (
const softdouble& a) { *
this = *
this % a;
return *
this; }
305 inline bool isNaN()
const {
return (v & 0x7fffffffffffffff) > 0x7ff0000000000000; }
307 inline bool isInf()
const {
return (v & 0x7fffffffffffffff) == 0x7ff0000000000000; }
309 inline bool isSubnormal()
const {
return ((v >> 52) & 0x7FF) == 0; }
312 inline bool getSign()
const {
return (v >> 63) != 0; }
316 inline int getExp()
const {
return ((v >> 52) & 0x7FF) - 1023; }
321 x.v = (v & 0x800FFFFFFFFFFFFF) | ((uint_fast64_t)((e + 1023) & 0x7FF) << 52);
331 uint_fast64_t vv = (v & 0x000FFFFFFFFFFFFF) | ((uint_fast64_t)(1023) << 52);
341 x.v = (v & 0xFFF0000000000000) | (s.v & 0x000FFFFFFFFFFFFF);
407template<
typename _Tp>
static inline _Tp
saturate_cast(softdouble a) {
return _Tp(a); }
409template<>
inline uchar saturate_cast<uchar>(softfloat a) {
return (uchar)std::max(std::min(
cvRound(a), (
int)UCHAR_MAX), 0); }
410template<>
inline uchar saturate_cast<uchar>(softdouble a) {
return (uchar)std::max(std::min(
cvRound(a), (
int)UCHAR_MAX), 0); }
412template<>
inline schar saturate_cast<schar>(softfloat a) {
return (schar)std::min(std::max(
cvRound(a), (
int)SCHAR_MIN), (
int)SCHAR_MAX); }
413template<>
inline schar saturate_cast<schar>(softdouble a) {
return (schar)std::min(std::max(
cvRound(a), (
int)SCHAR_MIN), (
int)SCHAR_MAX); }
415template<>
inline ushort saturate_cast<ushort>(softfloat a) {
return (ushort)std::max(std::min(
cvRound(a), (
int)USHRT_MAX), 0); }
416template<>
inline ushort saturate_cast<ushort>(softdouble a) {
return (ushort)std::max(std::min(
cvRound(a), (
int)USHRT_MAX), 0); }
418template<>
inline short saturate_cast<short>(softfloat a) {
return (
short)std::min(std::max(
cvRound(a), (
int)SHRT_MIN), (
int)SHRT_MAX); }
419template<>
inline short saturate_cast<short>(softdouble a) {
return (
short)std::min(std::max(
cvRound(a), (
int)SHRT_MIN), (
int)SHRT_MAX); }
421template<>
inline int saturate_cast<int>(softfloat a) {
return cvRound(a); }
422template<>
inline int saturate_cast<int>(softdouble a) {
return cvRound(a); }
424template<>
inline int64_t saturate_cast<int64_t>(softfloat a) {
return cvRound(a); }
425template<>
inline int64_t saturate_cast<int64_t>(softdouble a) {
return cvRound64(a); }
431template<>
inline unsigned saturate_cast<unsigned>(softdouble a) {
return cvRound(a); }
433template<>
inline uint64_t saturate_cast<uint64_t>(softfloat a) {
return cvRound(a); }
434template<>
inline uint64_t saturate_cast<uint64_t>(softdouble a) {
return cvRound64(a); }
438inline softdouble
min(
const softdouble& a,
const softdouble& b) {
return (a > b) ? b : a; }
440inline softfloat
max(
const softfloat& a,
const softfloat& b) {
return (a > b) ? a : b; }
441inline softdouble
max(
const softdouble& a,
const softdouble& b) {
return (a > b) ? a : b; }
445inline softdouble abs( softdouble a) { softdouble x; x.v = a.v & ((1ULL << 63) - 1);
return x; }
CV_EXPORTS_W void max(InputArray src1, InputArray src2, OutputArray dst)
Calculates per-element maximum of two arrays or an array and a scalar.
CV_EXPORTS_W void sqrt(InputArray src, OutputArray dst)
Calculates a square root of array elements.
CV_EXPORTS_W void exp(InputArray src, OutputArray dst)
Calculates the exponent of every array element.
CV_EXPORTS_W void pow(InputArray src, double power, OutputArray dst)
Raises every array element to a power.
CV_EXPORTS_W void min(InputArray src1, InputArray src2, OutputArray dst)
Calculates per-element minimum of two arrays or an array and a scalar.
CV_EXPORTS_W void log(InputArray src, OutputArray dst)
Calculates the natural logarithm of every array element.
CV_INLINE v_reg< _Tp, n > operator/(const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
Divide values
int getExp() const
Get 0-based exponent
Definition: softfloat.hpp:179
softfloat(const float a)
Construct from float
Definition: softfloat.hpp:120
softfloat getFrac() const
Get a fraction part
Definition: softfloat.hpp:187
CV_EXPORTS softfloat mulAdd(const softfloat &a, const softfloat &b, const softfloat &c)
Fused Multiplication and Addition
softdouble(const uint32_t)
Construct from integer
static softfloat inf()
Positive infinity constant
Definition: softfloat.hpp:206
softfloat(const softfloat &c)
Copy constructor
Definition: softfloat.hpp:95
static softfloat one()
One constant
Definition: softfloat.hpp:210
softdouble setExp(int e) const
Construct a copy with new 0-based exponent
Definition: softfloat.hpp:318
static softfloat min()
Smallest normalized value
Definition: softfloat.hpp:212
softfloat setSign(bool sign) const
Construct a copy with new sign bit
Definition: softfloat.hpp:177
bool getSign() const
Get sign bit
Definition: softfloat.hpp:312
softfloat setFrac(const softfloat &s) const
Construct a copy with provided significand
Definition: softfloat.hpp:196
bool isInf() const
Inf state indicator
Definition: softfloat.hpp:170
softfloat setExp(int e) const
Construct a copy with new 0-based exponent
Definition: softfloat.hpp:181
softfloat()
Default constructor
Definition: softfloat.hpp:93
softdouble & operator=(const softdouble &c)
Assign constructor
Definition: softfloat.hpp:234
static softdouble max()
Biggest finite value
Definition: softfloat.hpp:358
static softdouble pi()
Correct pi approximation
Definition: softfloat.hpp:360
softdouble setFrac(const softdouble &s) const
Construct a copy with provided significand
Definition: softfloat.hpp:338
bool isInf() const
Inf state indicator
Definition: softfloat.hpp:307
bool isNaN() const
NaN state indicator
Definition: softfloat.hpp:168
bool isSubnormal() const
Subnormal number indicator
Definition: softfloat.hpp:172
softdouble(const softdouble &c)
Copy constructor
Definition: softfloat.hpp:232
static softfloat max()
Biggest finite value
Definition: softfloat.hpp:216
static softdouble zero()
Zero constant
Definition: softfloat.hpp:346
softfloat abs(softfloat a)
Absolute value
Definition: softfloat.hpp:444
softfloat(const uint32_t)
Construct from integer
static softfloat eps()
Difference between 1 and next representable value
Definition: softfloat.hpp:214
static softdouble one()
One constant
Definition: softfloat.hpp:352
static softfloat zero()
Zero constant
Definition: softfloat.hpp:204
softdouble setSign(bool sign) const
Construct a copy with new sign bit
Definition: softfloat.hpp:314
static softdouble eps()
Difference between 1 and next representable value
Definition: softfloat.hpp:356
static softfloat nan()
Default NaN constant
Definition: softfloat.hpp:208
CV_EXPORTS softfloat cbrt(const softfloat &a)
Cube root
static softdouble min()
Smallest normalized value
Definition: softfloat.hpp:354
bool isSubnormal() const
Subnormal number indicator
Definition: softfloat.hpp:309
int getExp() const
Get 0-based exponent
Definition: softfloat.hpp:316
softdouble(const double a)
Construct from double
Definition: softfloat.hpp:257
softdouble getFrac() const
Get a fraction part
Definition: softfloat.hpp:329
static softfloat pi()
Correct pi approximation
Definition: softfloat.hpp:218
static softdouble inf()
Positive infinity constant
Definition: softfloat.hpp:348
bool isNaN() const
NaN state indicator
Definition: softfloat.hpp:305
bool getSign() const
Get sign bit
Definition: softfloat.hpp:175
static const softfloat fromRaw(const uint32_t a)
Construct from raw
Definition: softfloat.hpp:106
softdouble()
Default constructor
Definition: softfloat.hpp:230
softfloat & operator=(const softfloat &c)
Assign constructor
Definition: softfloat.hpp:97
static softdouble nan()
Default NaN constant
Definition: softfloat.hpp:350
static softdouble fromRaw(const uint64_t a)
Construct from raw
Definition: softfloat.hpp:243
CV_INLINE int cvRound(double value)
Rounds floating-point number to the nearest integer
Definition: fast_math.hpp:200
CV_INLINE int cvCeil(double value)
Rounds floating-point number to the nearest integer not smaller than the original.
Definition: fast_math.hpp:254
static _Tp saturate_cast(uchar v)
Template function for accurate conversion from one primitive type to another.
Definition: saturate.hpp:80
CV_INLINE int cvFloor(double value)
Rounds floating-point number to the nearest integer not larger than the original.
Definition: fast_math.hpp:234
Quat< T > cos(const Quat< T > &q)
Quat< T > sin(const Quat< T > &q)
"black box" representation of the file storage associated with a file on disk.
Definition: aruco.hpp:75
Definition: softfloat.hpp:227
Definition: softfloat.hpp:90