Added float_div instruction

This commit is contained in:
Tom Helmuth 2023-11-07 20:43:24 -05:00
parent 739e975111
commit e00e34402c

View File

@ -183,6 +183,14 @@ Otherwise, acts as a NOOP"
;; FLOAT Instructions only ;; FLOAT Instructions only
;; ============================================================================= ;; =============================================================================
;; Divides the top two items on the float stack
;; If denominator is 0, returns 1.0
(def-instruction
:float_div
^{:stacks #{:float}}
(fn [state]
(make-instruction state #(float (if (zero? %2) 1 (/ %1 %2))) [:float :float] :float)))
;; Pushes the cosine of the top FLOAT ;; Pushes the cosine of the top FLOAT
(def-instruction (def-instruction
:float_cos :float_cos