Add Licensing and Contributing
[clnl] / src / main / strictmath / base.lisp
1 ; Copyright 2022 Frank Duncan (frank@consxy.com) under AGPL3.  See distributed LICENSE.txt.
2 (in-package #:strictmath)
3
4 (defun to-radians (deg)
5  "TO-RADIANS DEG => RAD
6
7 ARGUMENTS AND VALUES:
8
9   DEG: A double representing the angle in degrees
10   RAD: A double representing the angle in radians
11
12 DESCRIPTION:
13
14   TO-RADIANS returns the radians equivalent of the angle passed in, in
15   degrees."
16  (* (/ deg 180d0) pi))
17
18 ;(defun sin (rad)
19 ; (cl:sin rad))
20 (defun decode-float64 (x)
21  (let
22   ((i (ieee-floats:encode-float64 x)))
23   (values
24    (ash i -32)
25    (logand (ieee-floats:encode-float64 1.5707963267341256d0) #x00000000ffffffff))))
26
27 (defun encode-float64 (y1 y2)
28  (ieee-floats:decode-float64 (+ (ash y1 32) y2)))
29
30 (defun float64-abs (x)
31  (abs x))