(what: &str)
| 6 | use wasm_pdk::*; |
| 7 | |
| 8 | fn too_large(what: &str) -> Error { |
| 9 | Error::Value(match what { |
| 10 | "factorial" => String::from("factorial() result exceeds the i128 range"), |
| 11 | "comb" => String::from("comb() result exceeds the i128 range"), |
| 12 | "perm" => String::from("perm() result exceeds the i128 range"), |
| 13 | _ => String::from("lcm() result exceeds the i128 range"), |
| 14 | }) |
| 15 | } |
| 16 | |
| 17 | // Euclidean gcd on non-negative inputs. |
| 18 | fn gcd2(mut a: i128, mut b: i128) -> i128 { |