ViewVC logotype

Log of /src/code/irrat.lisp

Parent Directory Parent Directory | Revision Log Revision Log

Links to HEAD: (view) (annotate)
Links to double-double-reader-branch: (view) (annotate)
Sticky Tag:

Revision - (view) (annotate) - [select for diffs]
Sun Jun 11 20:11:45 2006 UTC (7 years, 10 months ago) by rtoy
Branch: double-double-reader-branch
CVS Tags: double-double-array-base, double-double-reader-checkpoint-1
Branch point for: double-double-array-branch
Changes since +4 -3 lines
Diff to previous
Add basic support for reading and printing double-double-floats.  I
think this needs to be built from a binary that already has basic
double-double support.  That is, you need to compile these changes
with a binary built from the double-double-branch.  (It may work
to cross-compile this from the 2006-06 snapshot, but I did not try

Reading double-double-floats appears to work.  PRINT appears to work.
However, formatted output of double-double-floats may not be accurate
because SCALE-EXPONENT still only supports double-floats.

o Add support for coercing a BIGNUM to a DOUBLE-DOUBLE-FLOAT.

o Add support for converting a RATIO to a DOUBLE-DOUBLE-FLOAT.  This
  is needed to be able to read a double-double-float correctly.
o INTEGER-DECODE-DOUBLE-DOUBLE-FLOAT seems to be buggy.  Use a new
  version that works but probably conses more than is necessary and is
  probably slower than necessary.  This is needed to print out
o Add DECODE-DOUBLE-DOUBLE-FLOAT while we're at it.
o Add SCALE-DOUBLE-DOUBLE-FLOAT.  This is also needed for printing.
o Disable %DOUBLE-DOUBLE-FLOAT.  There's already an implementation in
  float-tran.  (We really should move the float-tran version to here.)

o Tell printer to use #\w when printing double-double-floats.

o The deftransform for ABS is working, so use that instead of the

o Update FLOAT-CONTAGION to support mixing rationals with

o Recognize double-double-floats for printing.  Use "w" as the
  exponent marker for double-double floats.
o Very minor change to FLONUM-TO-DIGITS to support

o Tell the reader that #\w and #\W are exponent markers for
  double-double-float numbers by giving them the secondary attribute
o Tell the reader to creat double-double-floats when reading such

Revision - (view) (annotate) - [select for diffs]
Fri Jun 9 16:04:57 2006 UTC (7 years, 10 months ago) by rtoy
Branch: double-double-branch
CVS Tags: double-double-init-%make-sparc, double-double-init-checkpoint-1, double-double-init-ppc, double-double-init-sparc, double-double-init-sparc-2, double-double-init-x86, double-double-reader-base
Branch point for: double-double-reader-branch
Changes since 1.45: +49 -5 lines
Diff to previous 1.45 , to next main 1.64
Add basic support for kernel:double-double-float type.  The primitive
type is there, and basic arithmetic operations work as well as PRINT.
But many things do not work: No reader, formatted output, many mixed
type arithmetic operations, special functions are just double-float
values, coerced to double-double-float.

o Add new error

o Dump double-double-float objects (barely tested)

o Tell compiler about the new primitive type double-double-float.

o Make double-double-float-p a known function.

o Update FLOAT-FORMAT-NAME to include double-double-float

o Tell compiler about double-double-float type predicate.

o Add necessary vops to move double-double-float args, store and load
  double-double-floats to/from the double-double-stack,
  double-double-reg moves, box and unbox double-double-floats, move
  double-double-floats to and from args
o Add necessary vops to create a double-double-float and to extract
  the high and low parts out of a double-double-float.

o Define double-double-float-digits

o Define double-double-float type vop
o Adjust number hierarchy to include double-double-float

o Define the necessary storage class and storage base for the
  double-double-reg and double-double-stack.

o Tell GC about double-double-float objects.

o Tell purify about double-double-float objects.

o Add the new double-double-float class.

o Add the necessary symbols to the various packages.  (This is
  important to get right otherwise there's confusion on what symbol
  really represents double-double-float stuff.)

o Implement some of the necessary functions to support

o Hash double-double-floats by xor'ing the hashes of each double-float
  part.  (Is that good enough?)

o Implement the special functions by calling the double-float versions
  and coercing the result to a double-double-float.  This is needed to
  get type-derivation working, but the precise value isn't that
  important right now.  We'll have to implement them later.

o Make make-double-double-float, double-double-hi, and
  double-double-lo known functions.

o Register the :double-double float feature.

o Add FOP for reading double-double-float values from fasls.  (Barely
  tested, if at all.)

o Implement basic arithmetic operations for double-double-floats.
  This needs quite a bit of work to clean up, but most things work.

o Tell the type system about double-double-float type.

o Add very rudimentary printing for double-double-float.  Basically
  copied from code written by Richard Fateman, with permission.

o Tell coerce how to coerce things to a double-double-float.

o Tell type system about the new float format double-double-float and
  how numeric contagion works with double-double-float.

o Tell dumper how to dump double-double-float values to a fasl.

o Add appropriate deftransforms to handle conversion of things to
  double-double-float and from from double-double-float to other float
o The basic implmentation of double-double-float arithmetic is also
o Add deftransforms to tell the compiler how to do basic arithmetic
  and comparisions on double-double-float numbers.

o Fix a bug in interval-range-info when :low is 0dd0 and :high is 0.
  We weren't returning the right value, which confuses interval-div,
  which caused an infinite loop because we couldn't split the
  numerator into positive and negative parts.
o Tell other parts about double-double-float.

Revision 1.45 - (view) (annotate) - [select for diffs]
Mon May 15 23:56:11 2006 UTC (7 years, 11 months ago) by rtoy
Branch: MAIN
CVS Tags: double-double-base, snapshot-2006-06
Branch point for: double-double-branch
Changes since 1.44: +7 -1 lines
Diff to previous 1.44
Don't produce a continuable error in INTEXP, if we're raising 1 to
some power.  (Maxima does this sometimes, and it's annoying to have
CMUCL stop for this.)

Revision 1.44 - (view) (annotate) - [select for diffs]
Wed May 3 19:39:56 2006 UTC (7 years, 11 months ago) by rtoy
Branch: MAIN
Changes since 1.43: +12 -1 lines
Diff to previous 1.43
It seems we need kernel::%sqrt to be defined for sparc.  It's used,
sometimes, during constant folding in the compiler.  (What else is

Revision 1.43 - (view) (annotate) - [select for diffs]
Thu Oct 20 12:32:08 2005 UTC (8 years, 6 months ago) by rtoy
Branch: MAIN
CVS Tags: snapshot-2005-11, snapshot-2005-12, snapshot-2006-01, snapshot-2006-02, snapshot-2006-03, snapshot-2006-04, snapshot-2006-05
Changes since 1.42: +37 -2 lines
Diff to previous 1.42
Fix some issues with two-arg log function.  (log 17 10f0), (log 17f0
10), and (log 17 10) returned different single-float results.  I think
this is allowed by ANSI CL, but I think it's unfortunate.

Therefore, try to apply float contagion to the arguments before
computing the log function.  Also, if both args are single-floats or
rationals, we coerce them to double-floats before computing the
result.  This makes (log 17 10) = (log 17.0 10).

There are other cases still to be considered.

Revision 1.42 - (view) (annotate) - [select for diffs]
Thu Aug 25 21:21:32 2005 UTC (8 years, 7 months ago) by rtoy
Branch: MAIN
CVS Tags: release-19c, release-19c-base, release-19c-pre1, snapshot-2005-10
Branch point for: release-19c-branch
Changes since 1.41: +11 -9 lines
Diff to previous 1.41
ASIN and ACOS were getting errors when given NaN's.  Check for that
case and dispatch to the real-valued C functions in that case.  This
fixes some errors in the asin and acos tests from ieeefp-tests (at

Revision 1.41 - (view) (annotate) - [select for diffs]
Tue Oct 19 15:07:30 2004 UTC (9 years, 6 months ago) by rtoy
Branch: MAIN
CVS Tags: ppc_gencgc_snap_2005-05-14, release-19b-base, release-19b-pre1, release-19b-pre2, snapshot-2004-11, snapshot-2004-12, snapshot-2005-01, snapshot-2005-02, snapshot-2005-03, snapshot-2005-04, snapshot-2005-05, snapshot-2005-06, snapshot-2005-07, snapshot-2005-08, snapshot-2005-09
Branch point for: ppc_gencgc_branch, release-19b-branch
Changes since 1.40: +77 -68 lines
Diff to previous 1.40
CMUCL was computing the values of asin, acos, and atanh on the branch
cuts on the real line incorrectly.  This shows up when calling these
functions with real-valued args, not complex.  The problem was the
computed values were not continuous with the quadrants specified by

Issue noted by Bruno Haible, cmucl-imp, 2004-10-11.

See also some tests on cmucl-imp, 2004-10-19.

Revision 1.40 - (view) (annotate) - [select for diffs]
Wed Jun 9 14:48:15 2004 UTC (9 years, 10 months ago) by rtoy
Branch: MAIN
CVS Tags: prm-before-macosx-merge-tag, snapshot-2004-07, snapshot-2004-08, snapshot-2004-09, snapshot-2004-10
Changes since 1.39: +11 -1 lines
Diff to previous 1.39
EXPT sometimes returned NaN when the power was 0 instead of 1.  Make
it return 1 (of the right type) in these cases.  We still produce a FP
trap, if enabled, though.  Is that right?

Revision 1.39 - (view) (annotate) - [select for diffs]
Fri Jun 4 13:25:07 2004 UTC (9 years, 10 months ago) by rtoy
Branch: MAIN
CVS Tags: snapshot-2004-06
Changes since 1.38: +11 -11 lines
Diff to previous 1.38
Merge in 19a-branch fix for the atanh bug.

Revision 1.38 - (view) (annotate) - [select for diffs]
Wed May 12 02:52:42 2004 UTC (9 years, 11 months ago) by rtoy
Branch: MAIN
CVS Tags: amd64-merge-start
Changes since 1.37: +36 -7 lines
Diff to previous 1.37
Fix some issues with the complex functions with signed zeroes.  See
comment for full details, but the issue is that Lisp says mixing a
real and a complex requires converting the real to complex before
doing the operation.  But Kahan's algorithms assume that this doesn't
happen, like z-1 should not be computed as z-(1+0*i).

One place where this was wrong was for acos(2 +/- 0i).  Kahan says
acos(2+0i) is +0 - i*acosh(2) and acos(2-0i) is +0 + i*acosh(2).  We
had this backwards for the above reason.

I think this was caused by the erroneous deftransforms for real op
complex which were removed sometime ago, causing these function to
compute the wrong thing.

Revision 1.37 - (view) (annotate) - [select for diffs]
Wed Jan 29 18:51:48 2003 UTC (11 years, 2 months ago) by toy
Branch: MAIN
CVS Tags: cold-pcl-base, dynamic-extent-base, lisp-executable-base, mod-arith-base, release-18e, release-18e-base, release-18e-pre1, release-18e-pre2, release-19a-base, release-19a-pre1, remove_negative_zero_not_zero, snapshot-2003-10, snapshot-2003-11, snapshot-2003-12, snapshot-2004-04, snapshot-2004-05, sparc_gencgc, sparc_gencgc_merge
Branch point for: cold-pcl, dynamic-extent, lisp-executable, mod-arith-branch, release-18e-branch, release-19a-branch, sparc_gencgc_branch
Changes since 1.36: +14 -9 lines
Diff to previous 1.36
Chrisophe Rhodes noted that (log 19/3) was losing precision.  Fix that
by calling log2 instead of log to compute the result.

Revision 1.36 - (view) (annotate) - [select for diffs]
Fri Jan 10 17:19:22 2003 UTC (11 years, 3 months ago) by toy
Branch: MAIN
Changes since 1.35: +3 -3 lines
Diff to previous 1.35
Fix typo in computing log of rational where the numerator and
denominator are different lengths.  Should be log, not log2.

Revision 1.35 - (view) (annotate) - [select for diffs]
Wed Jan 8 23:28:47 2003 UTC (11 years, 3 months ago) by toy
Branch: MAIN
Changes since 1.34: +20 -6 lines
Diff to previous 1.34
Was losing precision for (log x) when x is a rational near 1.  Handle
this better by using %log1p when needed.

Problem noted by Christophe Rhodes.

Revision 1.34 - (view) (annotate) - [select for diffs]
Tue Dec 31 14:28:08 2002 UTC (11 years, 3 months ago) by toy
Branch: MAIN
Changes since 1.33: +39 -7 lines
Diff to previous 1.33
Allow computation of log's of big integers that might not fit in a
single-float or double-float.  Thus (log (expt 2 32768) 2) will return
32768.0 instead of causing an error.

Revision 1.33 - (view) (annotate) - [select for diffs]
Thu Sep 5 16:13:46 2002 UTC (11 years, 7 months ago) by toy
Branch: MAIN
Branch point for: UNICODE-BRANCH
Changes since 1.32: +3 -2 lines
Diff to previous 1.32
Give a better error message for atan when given an arg that isn't
REAL in the two arg case.

Revision 1.32 - (view) (annotate) - [select for diffs]
Mon Apr 16 16:13:56 2001 UTC (13 years ago) by toy
Branch: MAIN
Changes since 1.31: +165 -227 lines
Diff to previous 1.31
o Fix the declaration bug in complex-log-scaled
o Remove the old special function routines
o Add logb-finite to help optimize the use of logb
o Remove some unneeded declarations since the compiler is smarter now
  than when this was originally written.
o Add inhibit-warnings to coerce-to-complex-type since their
o The cores of some routines are compiled with speed 3 and space 0 to
  get some maybe-inline routines inlined.

Revision 1.31 - (view) (annotate) - [select for diffs]
Sun Mar 4 20:12:37 2001 UTC (13 years, 1 month ago) by pw
Branch: MAIN
Changes since 1.30: +3 -3 lines
Diff to previous 1.30
Change most PROCLAIMs to DECLAIMs.

Revision 1.30 - (view) (annotate) - [select for diffs]
Fri Nov 19 14:55:53 1999 UTC (14 years, 5 months ago) by dtc
Branch: MAIN
Changes since 1.29: +2 -2 lines
Diff to previous 1.29
Use only one of :sparc-v7, :sparc-v8, or :sparc-v9 when building to
get the desired features. From Raymond Toy.

Revision 1.29 - (view) (annotate) - [select for diffs]
Wed Jun 23 14:05:17 1999 UTC (14 years, 10 months ago) by dtc
Branch: MAIN
Changes since 1.28: +2 -2 lines
Diff to previous 1.28
Use the fsqrt VOP on the SPARC V7 and up.

Revision 1.28 - (view) (annotate) - [select for diffs]
Wed Apr 15 01:29:57 1998 UTC (16 years ago) by dtc
Branch: MAIN
Changes since 1.27: +2 -3 lines
Diff to previous 1.27
Kahan says (sqrt -0.0) returns -0.0.

Revision 1.27 - (view) (annotate) - [select for diffs]
Tue Feb 24 18:18:17 1998 UTC (16 years, 2 months ago) by dtc
Branch: MAIN
Changes since 1.26: +6 -3 lines
Diff to previous 1.26
Now have an inline verion of %log1p for the x86 port so don't need
to call the C library version.

Revision 1.26 - (view) (annotate) - [select for diffs]
Thu Feb 19 03:49:49 1998 UTC (16 years, 2 months ago) by dtc
Branch: MAIN
Changes since 1.25: +4 -4 lines
Diff to previous 1.25
Fix float-trapping-nan-p which was returning T for quiet NaN and Nil
of trapping NaN.

Revision 1.25 - (view) (annotate) - [select for diffs]
Mon Dec 15 06:46:54 1997 UTC (16 years, 4 months ago) by dtc
Branch: MAIN
Changes since 1.24: +2 -10 lines
Diff to previous 1.24
Return #C(0.0 0.0) rather than -0.0 for (sqrt -0.0).

Revision 1.24 - (view) (annotate) - [select for diffs]
Sat Nov 1 22:58:14 1997 UTC (16 years, 5 months ago) by dtc
Branch: MAIN
Changes since 1.23: +3 -3 lines
Diff to previous 1.23
Improved support for (complex single-float) and (complex double-float)
types. Adds storage classes to the backend for these so they can be
stored in registers or on the stack without consing; new primitive
types etc. Also adds (simple-array (complex {single,double}-float))
array types to avoid consing and speed vectors operations.  All
these changes are conditional on the :complex-float feature. More work
is needed to exploit these changes: improving the type dispatch in the
various function; maybe compiler transforms or more VOPs to handle
common functions inline.

Revision 1.23 - (view) (annotate) - [select for diffs]
Mon Sep 8 00:17:42 1997 UTC (16 years, 7 months ago) by dtc
Branch: MAIN
Changes since 1.22: +2 -2 lines
Diff to previous 1.22
Check the accrued exceptions (sticky-bits) within
with-float-traps-masked; more reliable than the exceptions-byte on
many ports.

Revision 1.22 - (view) (annotate) - [select for diffs]
Sat Aug 30 18:29:21 1997 UTC (16 years, 7 months ago) by dtc
Branch: MAIN
Changes since 1.21: +144 -37 lines
Diff to previous 1.21
New implementation of real-expt for the expt function; fixes bugs and
improves the handling of special case.

Revision 1.21 - (view) (annotate) - [select for diffs]
Sat Aug 30 18:21:36 1997 UTC (16 years, 7 months ago) by dtc
Branch: MAIN
Changes since 1.20: +46 -71 lines
Diff to previous 1.20
New macro WITH-FLOAT-TRAPS-MASKED to execute a body of code with some
floating point exceptions disabled. It avoids the overhead of
{set,get}-floating-point-modes, saving some consing and generally
giving smaller code. Exploit this new macro where
{set,get}-floating-point-modes has been used.

Revision 1.20 - (view) (annotate) - [select for diffs]
Tue Aug 26 18:00:24 1997 UTC (16 years, 8 months ago) by dtc
Branch: MAIN
Changes since 1.19: +2 -2 lines
Diff to previous 1.19
In complex-tanh change tan -> %tan to avoid a compiler warning on the
x86 port.

Revision 1.19 - (view) (annotate) - [select for diffs]
Mon Feb 10 23:24:21 1997 UTC (17 years, 2 months ago) by dtc
Branch: MAIN
Branch point for: RELENG_18
Changes since 1.18: +17 -17 lines
Diff to previous 1.18
Inline scalb and better declare its 'n' argument so the compiler can
generate inline code for this operation. Few other little cleanups.

Revision 1.18 - (view) (annotate) - [select for diffs]
Wed Feb 5 16:15:51 1997 UTC (17 years, 2 months ago) by pw
Branch: MAIN
Changes since 1.17: +18 -31 lines
Diff to previous 1.17
initial post 1.3.7 merge

Revision 1.17 - (view) (annotate) - [select for diffs]
Sat Jan 18 14:30:40 1997 UTC (17 years, 3 months ago) by ram
Branch: MAIN
Changes since 1.16: +699 -64 lines
Diff to previous 1.16
Werkowskis source kit 1.03.7

Revision 1.16 - (view) (annotate) - [select for diffs]
Mon Jul 8 19:17:28 1996 UTC (17 years, 9 months ago) by ram
Branch: MAIN
Changes since 1.15: +6 -7 lines
Diff to previous 1.15
Merge fix from Douglas Crosher to make acosh and atanh return the right thing.

Revision 1.15 - (view) (annotate) - [select for diffs]
Mon Oct 31 04:11:27 1994 UTC (19 years, 5 months ago) by ram
Branch: MAIN
Changes since 1.14: +1 -3 lines
Diff to previous 1.14
Fix headed boilerplate.

Revision 1.14 - (view) (annotate) - [select for diffs]
Sat Nov 6 04:15:47 1993 UTC (20 years, 5 months ago) by wlott
Branch: MAIN
Changes since 1.13: +30 -7 lines
Diff to previous 1.13
Removed %exp1m, %log1p, and %cbrt because nobody used them, and HPUX
doens't have them.  Added #+hpux defuns for %asinh, %acosh, and %atanh
because HPUX doesn't have them either, but we want to use them.

Revision 1.13 - (view) (annotate) - [select for diffs]
Tue May 25 22:09:17 1993 UTC (20 years, 11 months ago) by wlott
Branch: MAIN
Changes since 1.12: +21 -35 lines
Diff to previous 1.12
Now that +0.0 and -0.0 are no longer eql, fixed atan to deal with them

Revision 1.12 - (view) (annotate) - [select for diffs]
Sat May 8 04:49:36 1993 UTC (20 years, 11 months ago) by wlott
Branch: MAIN
Changes since 1.11: +36 -18 lines
Diff to previous 1.11
Fixed atan to handle zeros better.  It still isn't right because the
compiler thinks that +0.0d0 and -0.0d0 are similar as a constant.

Revision 1.11 - (view) (annotate) - [select for diffs]
Mon Mar 1 15:24:54 1993 UTC (21 years, 1 month ago) by ram
Branch: MAIN
Changes since 1.10: +1 -20 lines
Diff to previous 1.10
Move ISQRT to numbers.lisp

Revision 1.10 - (view) (annotate) - [select for diffs]
Fri Feb 14 23:45:06 1992 UTC (22 years, 2 months ago) by wlott
Branch: MAIN
Changes since 1.9: +2 -2 lines
Diff to previous 1.9
Merged new-alien changes onto trunk.

Revision 1.9 - (view) (annotate) - [select for diffs]
Fri Oct 25 20:02:07 1991 UTC (22 years, 6 months ago) by ram
Branch: MAIN
Changes since 1.8: +2 -4 lines
Diff to previous 1.8
Fixed EXPT to deal with SINGLE-FLOAT x SINGLE-FLOAT arg type combination.

Revision 1.8 - (view) (annotate) - [select for diffs]
Wed Sep 4 14:26:37 1991 UTC (22 years, 7 months ago) by ram
Branch: MAIN
Changes since 1.7: +4 -4 lines
Diff to previous 1.7
Fixed EXPT to handle double-float x ratio combination.

Revision 1.7 - (view) (annotate) - [select for diffs]
Fri Feb 8 13:33:39 1991 UTC (23 years, 2 months ago) by ram
Branch: MAIN
Changes since 1.6: +9 -5 lines
Diff to previous 1.6
New file header with RCS header FILE-COMMENT.

Revision 1.6 - (view) (annotate) - [select for diffs]
Thu Jan 3 13:16:27 1991 UTC (23 years, 3 months ago) by ram
Branch: MAIN
Changes since 1.5: +53 -37 lines
Diff to previous 1.5
Fixed EXPT to correctly return complex results for negative numbers
raised to fractional powers.

Revision 1.5 - (view) (annotate) - [select for diffs]
Wed Oct 24 16:42:48 1990 UTC (23 years, 6 months ago) by ram
Branch: MAIN
Changes since 1.4: +5 -7 lines
Diff to previous 1.4
Made the C callout stubs for the math library routines be inline, since
the C call is pretty compact.

Revision 1.4 - (view) (annotate) - [select for diffs]
Thu Oct 18 02:56:15 1990 UTC (23 years, 6 months ago) by ram
Branch: MAIN
Changes since 1.3: +20 -20 lines
Diff to previous 1.3
Made all the C stubs be exported and maybe-inline.  Put the generic
functions under (space 0) so that the stubs will be inline expanded.
Changed some uses of INTEGER-DECODE-FLOAT to FLOAT-SIGN, since only
the sign was being used.
Note that EXPT is broken, since (expt -2.0 0.5) should be a complex,
not 0.

Revision 1.3 - (view) (annotate) - [select for diffs]
Tue Jul 31 17:22:14 1990 UTC (23 years, 8 months ago) by wlott
Branch: MAIN
Changes since 1.2: +117 -47 lines
Diff to previous 1.2
Wrote the rest of the trigonometric functions and fixed the complex case
of several others.

Revision 1.2 - (view) (annotate) - [select for diffs]
Sat Jul 21 15:33:08 1990 UTC (23 years, 9 months ago) by wlott
Branch: MAIN
Changes since 1.1: +24 -4 lines
Diff to previous 1.1
Moved phase, cis, and abs here from numbers.  Commented out defconstant
of e, because other code uses e as a local.  I guess single letter
constants are kind of stupid.

Revision 1.1 - (view) (annotate) - [select for diffs]
Fri Jul 20 23:52:13 1990 UTC (23 years, 9 months ago) by wlott
Branch: MAIN
Initial revision

This form allows you to request diffs between any two revisions of this file. For each of the two "sides" of the diff, select a symbolic revision name using the selection box, or choose 'Use Text Field' and enter a numeric revision.

  Diffs between and
  Type of Diff should be a

Sort log by:

  ViewVC Help
Powered by ViewVC 1.1.5