File: math.l

package info (click to toggle)
picolisp 25.12-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 7,388 kB
  • sloc: ansic: 3,092; javascript: 1,004; makefile: 107; sh: 2
file content (49 lines) | stat: -rw-r--r-- 901 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# 14sep20 Software Lab. Alexander Burger

(and (=0 *Scl) (scl 6))                # Default scale 6

(setq                                  # Global constants
   pi    3.1415926535897932
   pi/2  1.5707963267948966
   "Dbl1" (0 . 1.0)
   "Dbl2" (0 . 1.0) )

(de pow (X Y)
   (set "Dbl1" X  "Dbl2" Y)
   (%@ "pow" 1.0 "Dbl1" "Dbl2") )

(de exp (X)
   (set "Dbl1" X)
   (%@ "exp" 1.0 "Dbl1") )

(de log (X)
   (when (gt0 (set "Dbl1" X))
      (%@ "log" 1.0 "Dbl1") ) )

(de sin (A)
   (set "Dbl1" A)
   (%@ "sin" 1.0 "Dbl1") )

(de cos (A)
   (set "Dbl1" A)
   (%@ "cos" 1.0 "Dbl1") )

(de tan (A)
   (set "Dbl1" A)
   (%@ "tan" 1.0 "Dbl1") )

(de asin (A)
   (set "Dbl1" A)
   (%@ "asin" 1.0 "Dbl1") )

(de acos (A)
   (set "Dbl1" A)
   (%@ "acos" 1.0 "Dbl1") )

(de atan (A)
   (set "Dbl1" A)
   (%@ "atan" 1.0 "Dbl1") )

(de atan2 (X Y)
   (set "Dbl1" X  "Dbl2" Y)
   (%@ "atan2" 1.0 "Dbl1" "Dbl2") )