项目作者: biyori-sh

项目描述 :
A simple trial implementation of interval arithmetic in Common Lisp.
高级语言: Common Lisp
项目地址: git://github.com/biyori-sh/cliarith.git
创建时间: 2021-04-10T09:31:14Z
项目社区:https://github.com/biyori-sh/cliarith

开源协议:MIT License

下载


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

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

Addition:

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

Subtraction:

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

Multiplication:

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

Division:

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

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

  1. (cliarith:extend[] 1.0)
  2. ;; => #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:

  1. (asdf:load-system :cliarith)

or, if you use roswell, install this repository with

  1. ros install biyori-sh/cliarith

and load it:

  1. (ql:quickload :cliarith)