# HG changeset patch # User Steve Losh # Date 1474207469 0 # Node ID 75229fb62b8c099d96fd92eb4643d6930493dba9 # Parent ca0a5dd962168893ad6fc4e24df3fef8d816adde Moar tau diff -r ca0a5dd96216 -r 75229fb62b8c losh.lisp --- a/losh.lisp Sun Sep 18 13:03:03 2016 +0000 +++ b/losh.lisp Sun Sep 18 14:04:29 2016 +0000 @@ -17,7 +17,41 @@ ;;;; Math -(defconstant tau (coerce (* pi 2) 'single-float)) ; fuck a pi +(defconstant tau (* pi 2)) ; fuck a pi + +(defconstant tau/2 (* tau 1/2)) +(defconstant 1tau/2 (* tau 1/2)) + +(defconstant tau/4 (* tau 1/4)) +(defconstant 1tau/4 (* tau 1/4)) +(defconstant 2tau/4 (* tau 2/4)) +(defconstant 3tau/4 (* tau 3/4)) + +(defconstant tau/8 (* tau 1/8)) +(defconstant 1tau/8 (* tau 1/8)) +(defconstant 2tau/8 (* tau 2/8)) +(defconstant 3tau/8 (* tau 3/8)) +(defconstant 4tau/8 (* tau 4/8)) +(defconstant 5tau/8 (* tau 5/8)) +(defconstant 6tau/8 (* tau 6/8)) +(defconstant 7tau/8 (* tau 7/8)) + + +(defun-inline degrees (radians) + "Convert `radians` into degrees. + + The result will be the same type as `tau` and `pi`. + + " + (* radians (/ 360 tau))) + +(defun-inline radians (degrees) + "Convert `degrees` into radians. + + The result will be the same type as `tau` and `pi`. + + " + (* degrees (/ tau 360))) (defun-inline square (x) diff -r ca0a5dd96216 -r 75229fb62b8c package.lisp --- a/package.lisp Sun Sep 18 13:03:03 2016 +0000 +++ b/package.lisp Sun Sep 18 14:04:29 2016 +0000 @@ -23,6 +23,23 @@ (:documentation "Utilities related to math and numbers.") (:export #:tau + #:tau/2 + #:1tau/2 + #:tau/4 + #:1tau/4 + #:2tau/4 + #:3tau/4 + #:tau/8 + #:1tau/8 + #:2tau/8 + #:3tau/8 + #:4tau/8 + #:5tau/8 + #:6tau/8 + #:7tau/8 + + #:radians + #:degrees #:square #:dividesp #:norm