commit ae7c43183148c8699e9357076c5d02ef6db4ef2b parent 604739e9e70cdbc9876556ad3e2617a23b687fe5 Author: Byron Torres <b@torresjrjr.com> Date: Wed, 24 Nov 2021 16:54:33 +0000 add ^ exponentiation cmd Diffstat:
M | dc.ha | | | 8 | ++++++++ |
1 file changed, 8 insertions(+), 0 deletions(-)
diff --git a/dc.ha b/dc.ha @@ -150,6 +150,14 @@ export fn main() void = { const b = pop(); const a = pop(); push(math::modf64(a, b)); + case '^' => + if (len(S) < 2) { + fmt::errorln("dc: stack has too few elements")?; + continue; + }; + const b = pop(); + const a = pop(); + push(math::powf64(a, b)); case => fmt::errorfln("dc: unimplemented '{}'", r)?; };