summaryrefslogtreecommitdiff
path: root/src/mongo/platform/decimal128.h
diff options
context:
space:
mode:
authorGeert Bosch <geert@mongodb.com>2016-05-11 00:13:54 -0400
committerGeert Bosch <geert@mongodb.com>2016-06-06 13:21:09 -0400
commit3ffb9e1ca369e3a5dee5ad4f420d9d4e9866e7af (patch)
tree224903b9e14b80a4241a3e9c27f00750e7cd4c4f /src/mongo/platform/decimal128.h
parent6a00e2746082e71691d27b3be0b75fe3be89fda7 (diff)
downloadmongo-3ffb9e1ca369e3a5dee5ad4f420d9d4e9866e7af.tar.gz
SERVER-19735: Add new Decimal128 operations needed by aggregation
Diffstat (limited to 'src/mongo/platform/decimal128.h')
-rw-r--r--src/mongo/platform/decimal128.h23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/mongo/platform/decimal128.h b/src/mongo/platform/decimal128.h
index d736efd9c34..5f9d72a3d5b 100644
--- a/src/mongo/platform/decimal128.h
+++ b/src/mongo/platform/decimal128.h
@@ -315,7 +315,7 @@ public:
/**
* This set of mathematical operation functions implement the corresponding
* IEEE 754-2008 operations on self and other.
- * The operations are commutative, so a.add(b) is equivalent to b.add(a).
+ * The 'add' and 'multiply' methods are commutative, so a.add(b) is equivalent to b.add(a).
* Rounding of results that require a precision greater than 34 decimal digits
* is performed using the supplied rounding mode (defaulting to kRoundTiesToEven).
* NaNs and infinities are handled according to the IEEE 754-2008 specification.
@@ -342,6 +342,27 @@ public:
Decimal128 divide(const Decimal128& other,
std::uint32_t* signalingFlags,
RoundingMode roundMode = kRoundTiesToEven) const;
+ Decimal128 exponential(RoundingMode roundMode = kRoundTiesToEven) const;
+ Decimal128 exponential(std::uint32_t* signalingFlags,
+ RoundingMode roundMode = kRoundTiesToEven) const;
+ Decimal128 logarithm(RoundingMode roundMode = kRoundTiesToEven) const;
+ Decimal128 logarithm(std::uint32_t* signalingFlags,
+ RoundingMode roundMode = kRoundTiesToEven) const;
+ Decimal128 logarithm(const Decimal128& other, RoundingMode roundMode = kRoundTiesToEven) const;
+ Decimal128 logarithm(const Decimal128& other,
+ std::uint32_t* signalingFlags,
+ RoundingMode roundMode = kRoundTiesToEven) const;
+ Decimal128 modulo(const Decimal128& other) const;
+ Decimal128 modulo(const Decimal128& other, std::uint32_t* signalingFlags) const;
+
+ Decimal128 power(const Decimal128& other, RoundingMode roundMode = kRoundTiesToEven) const;
+ Decimal128 power(const Decimal128& other,
+ std::uint32_t* signalingFlags,
+ RoundingMode roundMode = kRoundTiesToEven) const;
+
+ Decimal128 squareRoot(RoundingMode roundMode = kRoundTiesToEven) const;
+ Decimal128 squareRoot(std::uint32_t* signalingFlags,
+ RoundingMode roundMode = kRoundTiesToEven) const;
/**
* This function quantizes the current decimal given a quantum reference