add 'e' as evaluable functor for Euler's constant (#832)
This commit is contained in:
@@ -278,6 +278,12 @@ impl<'a> ArithmeticEvaluator<'a> {
|
|||||||
&Constant::Rational(ref n) => self
|
&Constant::Rational(ref n) => self
|
||||||
.interm
|
.interm
|
||||||
.push(ArithmeticTerm::Number(Number::Rational(n.clone()))),
|
.push(ArithmeticTerm::Number(Number::Rational(n.clone()))),
|
||||||
|
&Constant::Atom(ref name, _) if name.as_str() == "e" => {
|
||||||
|
self.interm
|
||||||
|
.push(ArithmeticTerm::Number(Number::Float(OrderedFloat(
|
||||||
|
f64::consts::E,
|
||||||
|
))))
|
||||||
|
}
|
||||||
&Constant::Atom(ref name, _) if name.as_str() == "pi" => {
|
&Constant::Atom(ref name, _) if name.as_str() == "pi" => {
|
||||||
self.interm
|
self.interm
|
||||||
.push(ArithmeticTerm::Number(Number::Float(OrderedFloat(
|
.push(ArithmeticTerm::Number(Number::Float(OrderedFloat(
|
||||||
|
|||||||
@@ -224,6 +224,9 @@ impl MachineState {
|
|||||||
&HeapCellValue::Atom(ref name, _) if name.as_str() == "pi" => {
|
&HeapCellValue::Atom(ref name, _) if name.as_str() == "pi" => {
|
||||||
interms.push(Number::Float(OrderedFloat(f64::consts::PI)))
|
interms.push(Number::Float(OrderedFloat(f64::consts::PI)))
|
||||||
}
|
}
|
||||||
|
&HeapCellValue::Atom(ref name, _) if name.as_str() == "e" => {
|
||||||
|
interms.push(Number::Float(OrderedFloat(f64::consts::E)))
|
||||||
|
}
|
||||||
&HeapCellValue::NamedStr(arity, ref name, _) => {
|
&HeapCellValue::NamedStr(arity, ref name, _) => {
|
||||||
let evaluable_stub = MachineError::functor_stub(name.clone(), arity);
|
let evaluable_stub = MachineError::functor_stub(name.clone(), arity);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user