# HG changeset patch # User Steve Losh # Date 1711549331 14400 # Node ID d5710762069c01068d8194553bc455814ea67d79 # Parent 0329a2650981bcd94c682d686f41812ba1a2e862 Add +/- and to-bytes conversions diff -r 0329a2650981 -r d5710762069c src/math.lisp --- a/src/math.lisp Mon Jun 20 23:19:54 2022 -0400 +++ b/src/math.lisp Wed Mar 27 10:22:11 2024 -0400 @@ -128,6 +128,11 @@ (define-command ln (x) (push! (log x))) +(define-command pm (x y) + "Push both results of x ± y." + (push! (- x y)) + (push! (+ x y))) + (define-command kb (bytes) "Convert bytes to kilobytes." (push! (coerce (/ bytes (expt 1024 1)) 'double-float))) @@ -151,3 +156,27 @@ (define-command eb (bytes) "Convert bytes to exabytes." (push! (coerce (/ bytes (expt 1024 6)) 'double-float))) + +(define-command kbb (bytes) + "Convert kilobytes to bytes." + (push! (* bytes (expt 1024 1)))) + +(define-command mbb (bytes) + "Convert megabytes to bytes." + (push! (* bytes (expt 1024 2)))) + +(define-command gbb (bytes) + "Convert gigabytes to bytes." + (push! (* bytes (expt 1024 3)))) + +(define-command tbb (bytes) + "Convert terabytes to bytes." + (push! (* bytes (expt 1024 4)))) + +(define-command pbb (bytes) + "Convert petabytes to bytes." + (push! (* bytes (expt 1024 5)))) + +(define-command ebb (bytes) + "Convert exabytes to bytes." + (push! (* bytes (expt 1024 6))))