d5710762069c default tip

Add +/- and to-bytes conversions
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Wed, 27 Mar 2024 10:22:11 -0400
parents 0329a2650981
children (none)
branches/tags default tip
files src/math.lisp

Changes

--- 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))))