Skip to content

A simple trial implementation of interval arithmetic in Common Lisp.

License

Notifications You must be signed in to change notification settings

biyori-sh/cliarith

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

CLiArith

NOTE: CLiarith is primarily for my practice.

CLiArith is a simple trial implementation of the interval arithmetic in Common Lisp based on the simple implementation coded by C/C++ (Simple Interval Arithmeric Library).

CLiArith is available only in SB CL.

Usage

To be described.

Examples

Set *read-default-float-format* to (fp-type)-float, and bind the values of (fp-type)-float-epsilon and (fp-type)-float-negative-epsilon to *positive-epsilon and *negative-epsilon respectively

(cliarith:set-float-format 'double-float)

Addition:

(cliarith:+[] 0.1 0.1 0.1 0.1 0.1)
;; => #S(CLIARITH:[] :LOW 0.49999999999999994 :HIGH 0.5000000000000001)

Subtraction:

(cliarith:-[] 0.1 0.1 0.1 0.1 0.1)
;; => #S(CLIARITH:[] :LOW -0.30000000000000004 :HIGH -0.3)

Multiplication:

(cliarith:*[] 0.1 0.1 0.1 0.1 0.1)
;; => #S(CLIARITH:[] :LOW 1.0e-5 :HIGH 1.0000000000000008e-5)

Division:

(cliarith:/[] 0.1 0.1 0.1 0.1 0.1)
;; => #S(CLIARITH:[] :LOW 1000.0 :HIGH 1000.0000000000005)

Extend a point and an interval with *negative-epsilon and *positive-epsilon

(cliarith:extend[] 1.0)
;; => #S(CLIARITH:[] :LOW 0.9999999999999999 :HIGH 1.0000000000000002)

Installation

Put this repository, for instance, got by git clone in your ASDF path and load it:

(asdf:load-system :cliarith)

or, if you use roswell, install this repository with

ros install biyori-sh/cliarith

and load it:

(ql:quickload :cliarith)

About

A simple trial implementation of interval arithmetic in Common Lisp.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published