Float arithmetic 7.5 except two SQRT methods
This commit is contained in:
parent
609b9eb948
commit
a7fc90ffa1
@ -272,6 +272,15 @@ private ref class MPEXPR(name) : base
|
||||
negativeOp(destination, destination, (mpir_ui)-Right); \
|
||||
}
|
||||
|
||||
#define DEFINE_BINARY_ASSIGNMENT_REF_SI2(name, leftTypeAbbr, rightTypeAbbr, operation, negateOp) \
|
||||
DEFINE_ASSIGNMENT_PROLOG(name##leftTypeAbbr##rightTypeAbbr) \
|
||||
{ \
|
||||
Left->AssignTo(destination); \
|
||||
operation(destination, destination, (Right >= 0) ? (mpir_ui)Right : (mpir_ui)-Right); \
|
||||
if (Right < 0) \
|
||||
negateOp(destination, destination); \
|
||||
}
|
||||
|
||||
#define DEFINE_BINARY_ASSIGNMENT_SI_REF(name, leftTypeAbbr, rightTypeAbbr, positiveOp, negativeOp1, negativeOp2) \
|
||||
DEFINE_ASSIGNMENT_PROLOG(name##leftTypeAbbr##rightTypeAbbr) \
|
||||
{ \
|
||||
@ -285,6 +294,19 @@ private ref class MPEXPR(name) : base
|
||||
} \
|
||||
}
|
||||
|
||||
#define DEFINE_BINARY_ASSIGNMENT_SI_REF2(name, leftTypeAbbr, rightTypeAbbr, positiveOp, negativeOp1, negativeOp2) \
|
||||
DEFINE_ASSIGNMENT_PROLOG(name##leftTypeAbbr##rightTypeAbbr) \
|
||||
{ \
|
||||
Right->AssignTo(destination); \
|
||||
if (Left >= 0) \
|
||||
positiveOp(destination, (mpir_ui)Left, destination); \
|
||||
else \
|
||||
{ \
|
||||
negativeOp1(destination, (mpir_ui)-Left, destination); \
|
||||
negativeOp2(destination, destination); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define DEFINE_TERNARY_ASSIGNMENT_REF_REF_REF(name, typeAbbr, operation) \
|
||||
DEFINE_ASSIGNMENT_PROLOG(name##typeAbbr##typeAbbr##typeAbbr) \
|
||||
{ \
|
||||
|
@ -247,24 +247,24 @@ return result->ToString();
|
||||
DEFINE_UNARY_ASSIGNMENT_REF(Abs, Flt, MP(abs))
|
||||
|
||||
DEFINE_BINARY_ASSIGNMENT_REF_REF(Add, Flt, MP(add))
|
||||
DEFINE_BINARY_ASSIGNMENT_REF_RATVAL(Add, Flt, Ui, MP(add))
|
||||
DEFINE_BINARY_ASSIGNMENT_REF_RATVAL(Add, Flt, Si, MP(add))
|
||||
DEFINE_BINARY_ASSIGNMENT_REF_VAL(Add, Flt, Ui, MP(add_ui))
|
||||
DEFINE_BINARY_ASSIGNMENT_REF_SI (Add, Flt, Si, MP(add_ui), MP(sub_ui))
|
||||
|
||||
DEFINE_BINARY_ASSIGNMENT_REF_REF(Subtract, Flt, MP(sub))
|
||||
DEFINE_BINARY_ASSIGNMENT_REF_RATVAL(Subtract, Flt, Ui, MP(sub))
|
||||
DEFINE_BINARY_ASSIGNMENT_RATVAL_REF(Subtract, Ui, Flt, MP(sub))
|
||||
DEFINE_BINARY_ASSIGNMENT_REF_RATVAL(Subtract, Flt, Si, MP(sub))
|
||||
DEFINE_BINARY_ASSIGNMENT_RATVAL_REF(Subtract, Si, Flt, MP(sub))
|
||||
DEFINE_BINARY_ASSIGNMENT_REF_VAL(Subtract, Flt, Ui, MP(sub_ui))
|
||||
DEFINE_BINARY_ASSIGNMENT_VAL_REF(Subtract, Ui, Flt, MP(ui_sub))
|
||||
DEFINE_BINARY_ASSIGNMENT_REF_SI (Subtract, Flt, Si, MP(sub_ui), MP(add_ui))
|
||||
DEFINE_BINARY_ASSIGNMENT_SI_REF (Subtract, Si, Flt, MP(ui_sub), MP(add_ui), MP(neg))
|
||||
|
||||
DEFINE_BINARY_ASSIGNMENT_REF_REF(Multiply, Flt, MP(mul))
|
||||
DEFINE_BINARY_ASSIGNMENT_REF_RATVAL(Multiply, Flt, Ui, MP(mul))
|
||||
DEFINE_BINARY_ASSIGNMENT_REF_RATVAL(Multiply, Flt, Si, MP(mul))
|
||||
DEFINE_BINARY_ASSIGNMENT_REF_VAL(Multiply, Flt, Ui, MP(mul_ui))
|
||||
DEFINE_BINARY_ASSIGNMENT_REF_SI2(Multiply, Flt, Si, MP(mul_ui), MP(neg))
|
||||
|
||||
DEFINE_BINARY_ASSIGNMENT_REF_REF(Divide, Flt, MP(div))
|
||||
DEFINE_BINARY_ASSIGNMENT_REF_RATVAL(Divide, Flt, Ui, MP(div))
|
||||
DEFINE_BINARY_ASSIGNMENT_RATVAL_REF(Divide, Ui, Flt, MP(div))
|
||||
DEFINE_BINARY_ASSIGNMENT_REF_RATVAL(Divide, Flt, Si, MP(div))
|
||||
DEFINE_BINARY_ASSIGNMENT_RATVAL_REF(Divide, Si, Flt, MP(div))
|
||||
DEFINE_BINARY_ASSIGNMENT_REF_VAL(Divide, Flt, Ui, MP(div_ui))
|
||||
DEFINE_BINARY_ASSIGNMENT_VAL_REF(Divide, Ui, Flt, MP(ui_div))
|
||||
DEFINE_BINARY_ASSIGNMENT_REF_SI2(Divide, Flt, Si, MP(div_ui), MP(neg))
|
||||
DEFINE_BINARY_ASSIGNMENT_SI_REF2(Divide, Si, Flt, MP(ui_div), MP(ui_div), MP(neg))
|
||||
|
||||
DEFINE_BINARY_ASSIGNMENT_REF_VAL(ShiftLeft, Flt, Bits, MP(mul_2exp))
|
||||
DEFINE_BINARY_ASSIGNMENT_REF_VAL(ShiftRight, Flt, Bits, MP(div_2exp))
|
||||
|
Loading…
Reference in New Issue
Block a user