void normalize();
+ void multiplyBy(double rhs, UErrorCode& status);
void multiplyBy(const DecNum& rhs, UErrorCode& status);
+ void divideBy(double rhs, UErrorCode& status);
void divideBy(const DecNum& rhs, UErrorCode& status);
+ void add(double rhs, UErrorCode& status);
void add(const DecNum& rhs, UErrorCode& status);
+ void subtract(double rhs, UErrorCode& status);
void subtract(const DecNum& rhs, UErrorCode& status);
+ void power(int32_t power);
+
bool isNegative() const;
bool isZero() const;
bool equalTo(const DecNum& rhs, UErrorCode& status) const;
+ StringPiece toString(UErrorCode& status) const;
+
void toString(ByteSink& output, UErrorCode& status) const;
inline const decNumber* getRawDecNumber() const {
uprv_decNumberReduce(fData, fData, &fContext);
}
+void DecNum::multiplyBy(double rhs, UErrorCode& status){
+ DecNum rhsDecNum;
+ rhsDecNum.setTo(rhs, status);
+ multiplyBy(rhsDecNum, status);
+}
+
void DecNum::multiplyBy(const DecNum& rhs, UErrorCode& status) {
uprv_decNumberMultiply(fData, fData, rhs.fData, &fContext);
if (fContext.status != 0) {
}
}
+void DecNum::divideBy(double rhs, UErrorCode& status) {
+ DecNum rhsDecNum;
+ rhsDecNum.setTo(rhs, status);
+ divideBy(rhsDecNum, status);
+}
+
void DecNum::divideBy(const DecNum& rhs, UErrorCode& status) {
uprv_decNumberDivide(fData, fData, rhs.fData, &fContext);
if ((fContext.status & DEC_Inexact) != 0) {
}
}
+void DecNum::add(double rhs, UErrorCode& status) {
+ DecNum rhsDecNum;
+ rhsDecNum.setTo(rhs, status);
+ add(rhsDecNum, status);
+}
+
void DecNum::add(const DecNum& rhs, UErrorCode& status) {
uprv_decNumberAdd_66(fData, fData, rhs.fData, &fContext);
if (fContext.status != 0) {
}
}
+void DecNum::subtract(double rhs, UErrorCode& status) {
+ DecNum rhsDecNum;
+ rhsDecNum.setTo(rhs, status);
+ subtract(rhsDecNum, status);
+}
+
void DecNum::subtract(const DecNum& rhs, UErrorCode& status) {
uprv_decNumberSubtract_66(fData, fData, rhs.fData, &fContext);
if (fContext.status != 0) {
return false; // TODO(younies): implement this function
}
+StringPiece DecNum::toString(UErrorCode& status) const {
+ StringPiece result;
+
+ // TODO(younies): implement
+
+ return result;
+}
+
void DecNum::toString(ByteSink& output, UErrorCode& status) const {
if (U_FAILURE(status)) {
return;