aboutsummaryrefslogtreecommitdiffstats
path: root/src/input.rs
diff options
context:
space:
mode:
authorSam Anthony <sam@samanthony.xyz>2023-02-09 10:41:33 -0330
committerSam Anthony <sam@samanthony.xyz>2023-02-09 10:41:33 -0330
commitec0c61cd1f33423a4fcc33e6dd99c96c5ea08471 (patch)
tree8bbe940fb62fa033bebece82a805525eb7a1cdc5 /src/input.rs
parent18d2de963b04e26c597189f0ccfa0fbd81bd7059 (diff)
downloadpfc-ec0c61cd1f33423a4fcc33e6dd99c96c5ea08471.zip
cos and tan functions
Diffstat (limited to 'src/input.rs')
-rw-r--r--src/input.rs10
1 files changed, 10 insertions, 0 deletions
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::<f64>().unwrap());