Merge pull request #933 from pmoura/add_epsilon_arithmetic_constant
Add epsilon/0 arithmetic constant
This commit is contained in:
@@ -290,6 +290,12 @@ impl<'a> ArithmeticEvaluator<'a> {
|
|||||||
f64::consts::PI,
|
f64::consts::PI,
|
||||||
))))
|
))))
|
||||||
}
|
}
|
||||||
|
&Constant::Atom(ref name, _) if name.as_str() == "epsilon" => {
|
||||||
|
self.interm
|
||||||
|
.push(ArithmeticTerm::Number(Number::Float(OrderedFloat(
|
||||||
|
f64::EPSILON,
|
||||||
|
))))
|
||||||
|
}
|
||||||
_ => return Err(ArithmeticError::NonEvaluableFunctor(c.clone(), 0)),
|
_ => return Err(ArithmeticError::NonEvaluableFunctor(c.clone(), 0)),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -227,6 +227,9 @@ impl MachineState {
|
|||||||
&HeapCellValue::Atom(ref name, _) if name.as_str() == "e" => {
|
&HeapCellValue::Atom(ref name, _) if name.as_str() == "e" => {
|
||||||
interms.push(Number::Float(OrderedFloat(f64::consts::E)))
|
interms.push(Number::Float(OrderedFloat(f64::consts::E)))
|
||||||
}
|
}
|
||||||
|
&HeapCellValue::Atom(ref name, _) if name.as_str() == "epsilon" => {
|
||||||
|
interms.push(Number::Float(OrderedFloat(f64::EPSILON)))
|
||||||
|
}
|
||||||
&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