mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
- Added clog2 function
- negative numbers can now be displayed in 2's compliment binary
This commit is contained in:
@@ -220,6 +220,14 @@ namespace Poincare
|
||||
Expression shallowReduce(ExpressionNode::ReductionContext reductionContext);
|
||||
};
|
||||
|
||||
class CeilingLog2 final : public Expression {
|
||||
public:
|
||||
CeilingLog2(const BinaryOperationNode<32> *n) : Expression(n) {}
|
||||
static CeilingLog2 Builder(Expression child1) { return TreeHandle::FixedArityBuilder<CeilingLog2, BinaryOperationNode<32> >({child1}); }
|
||||
static constexpr Expression::FunctionHelper s_functionHelper = Expression::FunctionHelper("clog2", 1, &UntypedBuilderOneChild<CeilingLog2>);
|
||||
Expression shallowReduce(ExpressionNode::ReductionContext reductionContext);
|
||||
};
|
||||
|
||||
} // namespace Poincare
|
||||
|
||||
#endif
|
||||
|
||||
@@ -36,6 +36,7 @@ class Expression : public TreeHandle {
|
||||
friend class BitsClearExplicit;
|
||||
friend class BitSet;
|
||||
friend class Ceiling;
|
||||
friend class CeilingLog2;
|
||||
friend class CommonLogarithm;
|
||||
template<typename T>
|
||||
friend class ComplexNode;
|
||||
|
||||
@@ -65,6 +65,7 @@ public:
|
||||
BinomialCoefficient,
|
||||
BinomPDF,
|
||||
Ceiling,
|
||||
CeilingLog2,
|
||||
ComplexArgument,
|
||||
Conjugate,
|
||||
Derivative,
|
||||
|
||||
@@ -169,6 +169,7 @@ public:
|
||||
static Integer LogicalBitFlip(const Integer &a, const Integer &bit);
|
||||
static Integer Truncate(const Integer &a, const Integer &num_bits);
|
||||
static Integer TwosComplementToBits(const Integer &a, const Integer &num_bits);
|
||||
static Integer CeilingLog2(const Integer &a);
|
||||
|
||||
// Derived expression builder
|
||||
static Expression CreateMixedFraction(const Integer & num, const Integer & denom);
|
||||
|
||||
Reference in New Issue
Block a user