Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

## sbcl-bugs — New bug reports. Moderated, subscription not required for posting.

You can subscribe to this list here.

 2009 2010 2011 2012 2013 2014 Jan Feb (3) Mar (1) Apr May Jun (5) Jul (3) Aug (5) Sep (2) Oct (6) Nov (2) Dec (1) Jan (16) Feb (1) Mar (10) Apr (4) May (3) Jun Jul (1) Aug (1) Sep (1) Oct (3) Nov Dec (1) Jan (3) Feb (6) Mar Apr (2) May (4) Jun (5) Jul (1) Aug (8) Sep (1) Oct (1) Nov (2) Dec (1) Jan (2) Feb (2) Mar (8) Apr (6) May (13) Jun (6) Jul (3) Aug (2) Sep (7) Oct (1) Nov Dec Jan (5) Feb (1) Mar (6) Apr (1) May (1) Jun (11) Jul (9) Aug Sep (4) Oct Nov (12) Dec (6) Jan (6) Feb (17) Mar (3) Apr (3) May Jun (4) Jul Aug Sep Oct Nov Dec
S M T W T F S

1

2

3

4

5

6

7

8

9

10

11
(1)
12
(2)
13

14

15

16

17

18

19

20

21
(1)
22

23

24

25

26

27

28

29
(1)
30
(1)
31

Showing 1 results of 1

 [Sbcl-bugs] a feature request/ extending rational arithmetic From: Richard Fateman - 2013-03-29 23:53:00 I have found it convenient to extend, in principle, the CL rational numbers by allowing division by zero. In particular 0/0, 1/0 are legitimate numbers representing "undefined" -- like the floating point NaN, and an unsigned projective infinity. This project infinity makes sense if you think of the rational numbers as positions on a circle where infinity and minus infinity are the same point, opposite 0. To do so generally requires LESS WORK, in the following senses. 1. first use a modified gcd such that gcd(x,0)=x except if x=0, then the gcd is 1. Right now, (gcd -4 0) is 4 rather than -4, and (gcd 0 0) =1 rather than 1. 2. computing a/b+c/d one computes the ratio(a*d+c*b, b*d). then reduces.. if a/b = 1/0, the result is ratio(d,0), divide numerator and denominator by gcd(d,0) which is d, giving ratio(1,0). 3. computing a/b * c/d one computes the ratio(a*c/b*d). if a/b = 0/0, the result is ratio(0,0). divide by gcd(0,0)=1. giving ratio(0,0) if a/b = 1/0, the result is ratio(c,0), divide by gcd to get ration(1,0). reference.. http://www.cs.berkeley.edu/~fateman/papers/extrat.pdf fringe stuff: conversion to float formats: use NaN and Inf. It is also possible to produce an AFFINE model with rationals, allowing -1/0 to represent negative infinity. And I think this would be more useful. This however requires a little more checking. See the reference above for details. Why do I care? I would like to do interval arithmetic really neatly in SBCL, as opposed to slightly-less neatly. Ideally one would be able to patch the rational arithmetic in a running SBCL by reading in some file. (Code for this using a user-defined class ERAT for extended rational is available, but it's building a whole layer on top of the rationals.) Richard Fateman

Showing 1 results of 1