From ec0c61cd1f33423a4fcc33e6dd99c96c5ea08471 Mon Sep 17 00:00:00 2001 From: Sam Anthony Date: Thu, 9 Feb 2023 10:41:33 -0330 Subject: cos and tan functions --- src/input.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/input.rs') diff --git a/src/input.rs b/src/input.rs index 4aae623..1dde8d5 100644 --- a/src/input.rs +++ b/src/input.rs @@ -59,6 +59,16 @@ impl Calculator { *f = f.sin(); } } + "cos" => { + if let Some(f) = self.stack.last_mut() { + *f = f.cos(); + } + } + "tan" => { + if let Some(f) = self.stack.last_mut() { + *f = f.tan(); + } + } _ => { if self.input_buffer.len() > 0 { self.stack.push(self.input_buffer.parse::().unwrap()); -- cgit v1.2.3