UPDATE: Adds GCD and LCM functions (#502)
* UPDATE: Adds GCD and LCM functions They follow SUM and accept arrays * FIX: Implement copilot suggestions
This commit is contained in:
committed by
GitHub
parent
efb3b66777
commit
3e2b177ffe
@@ -108,6 +108,9 @@ pub enum Function {
|
||||
Mround,
|
||||
Trunc,
|
||||
|
||||
Gcd,
|
||||
Lcm,
|
||||
|
||||
// Information
|
||||
ErrorType,
|
||||
Formulatext,
|
||||
@@ -301,7 +304,7 @@ pub enum Function {
|
||||
}
|
||||
|
||||
impl Function {
|
||||
pub fn into_iter() -> IntoIter<Function, 243> {
|
||||
pub fn into_iter() -> IntoIter<Function, 245> {
|
||||
[
|
||||
Function::And,
|
||||
Function::False,
|
||||
@@ -361,6 +364,8 @@ impl Function {
|
||||
Function::Quotient,
|
||||
Function::Mround,
|
||||
Function::Trunc,
|
||||
Function::Gcd,
|
||||
Function::Lcm,
|
||||
Function::Max,
|
||||
Function::Min,
|
||||
Function::Product,
|
||||
@@ -667,6 +672,9 @@ impl Function {
|
||||
"MROUND" => Some(Function::Mround),
|
||||
"TRUNC" => Some(Function::Trunc),
|
||||
|
||||
"GCD" => Some(Function::Gcd),
|
||||
"LCM" => Some(Function::Lcm),
|
||||
|
||||
"PI" => Some(Function::Pi),
|
||||
"ABS" => Some(Function::Abs),
|
||||
"SQRT" => Some(Function::Sqrt),
|
||||
@@ -1128,6 +1136,8 @@ impl fmt::Display for Function {
|
||||
Function::Quotient => write!(f, "QUOTIENT"),
|
||||
Function::Mround => write!(f, "MROUND"),
|
||||
Function::Trunc => write!(f, "TRUNC"),
|
||||
Function::Gcd => write!(f, "GCD"),
|
||||
Function::Lcm => write!(f, "LCM"),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1399,6 +1409,8 @@ impl Model {
|
||||
Function::Quotient => self.fn_quotient(args, cell),
|
||||
Function::Mround => self.fn_mround(args, cell),
|
||||
Function::Trunc => self.fn_trunc(args, cell),
|
||||
Function::Gcd => self.fn_gcd(args, cell),
|
||||
Function::Lcm => self.fn_lcm(args, cell),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user