exp.lsp 1.74 KB
Newer Older
1 2 3 4 5
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Mon Sep  1 21:24:44 2003
;;;; Contains: Tests of EXP

6

7

8 9


10

11 12
;;; Error tests

13
(deftest exp.error.1
14 15
  (signals-error (exp) program-error)
  t)
16 17

(deftest exp.error.2
18 19
  (signals-error (exp 0 nil) program-error)
  t)
20 21

(deftest exp.error.3
22 23 24 25
  (signals-error (exp 0 0 0) program-error)
  t)

;;; Other tests
26 27 28 29

(deftest exp.1
  (let ((result (exp 0)))
    (or (eqlt result 1)
sds's avatar
sds committed
30
        (eqlt result 1.0f0)))
31 32 33 34 35 36 37 38 39 40
  t)

(deftest exp.2
  (mapcar #'exp '(0.0s0 0.0f0 0.0d0 0.0l0))
  (1.0s0 1.0f0 1.0d0 1.0l0))

(deftest exp.3
  (mapcar #'exp '(-0.0s0 -0.0f0 -0.0d0 -0.0l0))
  (1.0s0 1.0f0 1.0d0 1.0l0))

41
;;; FIXME
42 43 44 45
;;; Add more tests here for floating point accuracy

(deftest exp.error.4
  (signals-error (exp (+ (log most-positive-short-float) 100))
sds's avatar
sds committed
46
                 floating-point-overflow)
47 48 49 50
  t)

(deftest exp.error.5
  (signals-error (exp (+ (log most-positive-single-float) 100))
sds's avatar
sds committed
51
                 floating-point-overflow)
52 53 54 55
  t)

(deftest exp.error.6
  (signals-error (exp (+ (log most-positive-double-float) 100))
sds's avatar
sds committed
56
                 floating-point-overflow)
57 58 59 60
  t)

(deftest exp.error.7
  (signals-error (exp (+ (log most-positive-long-float) 100))
sds's avatar
sds committed
61
                 floating-point-overflow)
62 63 64 65
  t)

(deftest exp.error.8
  (signals-error (exp (- (log least-positive-short-float) 100))
sds's avatar
sds committed
66
                 floating-point-underflow)
67 68 69 70
  t)

(deftest exp.error.9
  (signals-error (exp (- (log least-positive-single-float) 100))
sds's avatar
sds committed
71
                 floating-point-underflow)
72 73 74 75
  t)

(deftest exp.error.10
  (signals-error (exp (- (log least-positive-double-float) 100))
sds's avatar
sds committed
76
                 floating-point-underflow)
77 78 79 80
  t)

(deftest exp.error.11
  (signals-error (exp (- (log least-positive-double-float) 100))
sds's avatar
sds committed
81
                 floating-point-underflow)
82
  t)