home *** CD-ROM | disk | FTP | other *** search
- This is a complete diff -c for making a version of gnuemacs18.52
- with lisp flonums.
-
- ***** start of diff (on Thu Apr 20 11:52:50 EST 1989) *****
-
- *** src/FLONUM.orig Thu Apr 20 11:51:11 1989
- --- src/FLONUM Wed Apr 19 11:57:18 1989
- ***************
- *** 0 ****
- --- 1,263 ----
- + ###############################################################################
- + ## ##
- + ## File: FLONUMS ##
- + ## Author: Wolfgang S. Rupprecht <wolfgang@wsrcc.com> ##
- + ## Created: Tue Oct 27 15:58:53 EST 1987 ##
- + ## Contents: Documentation File for GnuEmacs with floats ##
- + ## ##
- + ## Copyright (c) 1987 Wolfgang Rupprecht. ##
- + ## All rights reserved. ##
- + ## ##
- + ## $Log$ ##
- + ###############################################################################
- +
- + INTRO
- +
- + I have added a true floating point data type (flonum in lisp jargon)
- + to the lisp interpreter of GnuEmacs. This allows one to do emacs-lisp
- + calculations using floating point numbers as well as integers. In
- + addition, GnuEmacs now has hooks to call all of the common
- + trigonometric functions from lisp. One may now, for example, use the
- + *scratch* buffer as a real scientific calculator (programable even!!).
- + It is not that hard to write a super spreadsheet calculator in elisp,
- + using this package.
- +
- + NEW FEATURES
- +
- + The basic features features provided are:
- +
- + * a lisp float data type, that uses the C type "double" for it's
- + basic storage
- + * upgrading of the built-in math subroutines to allow manipulation
- + of floats
- + * conversion routines to convert to and from floats and ints
- + * predicates for testing if a number is a float, float-or-int,
- + or float-or-int-or-marker
- + * trig math routines. (sin, cos, tan, exponentials, logs, bessels, etc.)
- + * upgrading of int-to-string, string-to-int, and the basic printing
- + and reading routines to allow float reading/printing.
- + * changes to garbage-collect to also collect old floats.
- +
- + The lisp reader will interpret strings of one of the following three
- + forms as a float:
- +
- + <number>.<number>
- + <number>e<number>
- + <number>.<number>e<number>
- +
- + The mantissa and the exponent may both have a single + or - sign
- + prefixed. All other strings are treated as symbols. This is
- + intentional, and meant to prevent numbers and dotted pairs of
- + ints from looking too much like one another.
- +
- + legal numbers:
- + (0 . 1) a doted pair of integers 0 and 1
- + (0.1) a list of one float with value 1/10
- +
- + 0.0 the floating pt. zero
- + 1.0 the floating point one
- + 1e0 also floating pt. one
- + 0e0 also floating pt. zero
- +
- + (0. 1) a list of symbol "0\." and integer 0
- + (0 .1) a list of integer 0 and symbol "\.1"
- + 0. symbol "0\."
- + .1 symbol "\.1"
- +
- + The built in math functions promote the type of the calculation from
- + integer to float at the first encounter with a float.
- +
- + (+ 1 2 3 4 5 6.0 7 8 9)
- +
- + The above expression will be done in integer math for the addition of
- + 1, 2, 3, 4 and 5. The rest of the calculation is done in floating
- + point math with the result being a float. This allows an integer
- + calculation to still return an integer. To force a floating point
- + calculation, convert the first argument to a float.
- +
- + Ints can be converted to floats by using the function "float".
- + Floats can be converted to ints by one of several functions,
- + depending on the type of rounding desired.
- +
- + round returns the closest integer
- + ceiling returns the largest integer that is not larger
- + than the arg (round towards -infinity)
- + floor returns the smallest integer that is not smaller
- + than the arg (round towards +infinity)
- + truncate returns the integer corresponding to the mantissa
- + of the float. (round towards zero)
- +
- + On most machines that gnuemacs runs on, lisp integers are only 24 bits
- + long. One must be careful when convering large floats to integers that
- + one doesn't exceed the storage capacity of integers. Integers (of 24
- + bit size) can only have a range of slightly over +/- 8 million. The
- + same caution applies when performing mathematical operations on
- + integers. If you need to work with large numbers, it's safest to use
- + floats.
- +
- + The math trig functions sin/cos/tan all take their arguments in
- + radians. Values can be converted to the desired radix with the
- + functions degrees-to-radians and radians-to-degrees.
- +
- + Some of the new functions (or functions with new args/return values):
- +
- + abs acosh asin asinh atan atanh ceiling cos cosh cube-root erf erfc
- + exp expm1 expt fceiling ffloor float floor fround ftruncate
- + garbage-collect int-to-string integer-or-float-or-marker-p
- + integer-or-floatp j0 j1 jn log log-gamma log10 log1p round sin sinh
- + sqrt tan tanh truncate y0 y1 yn
- +
- + The full documentations for these functions is on-line under C-h f
- + <function-name> and at the end of this document.
- +
- + The lisp variable float-output-format controls the printed
- + representation of floats. The available print formats are:
- +
- + <number>.<number> with a 'd' specifier
- + <number>.<number>e<number> with an 'e' specifier
- + (or data dependent switching
- + between the above two) with no letter specifier
- +
- + The field width may be contolled by an optional numeric field
- + preceeding the above format specifier.
- +
- +
- + MAKING FLOAT-EMACS:
- +
- + To make emacs with flonums (ie. lisp floats) define LISP_FLOAT_TYPE in
- + your conf.h file. The resultant emacs will be less than 6% larger.
- + This has been tested on a Vax-750 running BSD 4.3.
- +
- + text data bss dec hex
- + 369664 180224 0 549888 86400 emacs-18.49
- + 391168 187392 0 578560 8d400 float-emacs-18.49
- +
- + PORTING to other machines:
- +
- + If you aren't running with a BSD/vax style printf, you may no be able
- + to use the optional runtime selectable floating point print-width stuff.
- + (I'll probably fix this soon.)
- +
- + If you don't have some of the math-lib functions that emacs wants
- + linked in, don't worry. These are all entirely optional. Just #ifdef
- + the math routines out, stub them up, or find a copy of the 4.3 BSD
- + routines. (Check the 4.3 BSD math(3) man page for details on copying
- + the math-lib routines.)
- +
- + Appendix A: floating pt. docstrings
- +
- + abs
- + Function: Return the absolute value of ARG.
- + acosh
- + Function: Return the inverse hyperbolic cosine of ARG.
- + asin
- + Function: Return the inverse sine of ARG.
- + asinh
- + Function: Return the inverse hyperbolic sine of ARG.
- + atan
- + Function: Return the inverse tangent of ARG.
- + atanh
- + Function: Return the inverse hyperbolic tangent of ARG.
- + ceiling
- + Function: Return the smallest integer no less than ARG. (round toward +inf)
- + cos
- + Function: Return the cosine of ARG.
- + cosh
- + Function: Return the hyperbolic cosine of ARG.
- + cube-root
- + Function: Return the cube root of ARG.
- + erf
- + Function: Return the mathematical error function of ARG.
- + erfc
- + Function: Return the complementary error function of ARG.
- + exp
- + Function: Return the exponential base e of ARG.
- + expm1
- + Function: Return the exp(x)-1 of ARG.
- + expt
- + Function: Return the exponential x ** y.
- + fceiling
- + Function: Return the smallest integral floating pt. number no less than ARG.
- + (round towards +inf)
- + ffloor
- + Function: Return the largest floating pt number no greater than ARG.
- + (round towards -inf)
- + float
- + Function: Return the floating pt. number equal to ARG.
- + floatp
- + Function: T if OBJECT is a floating pt. number.
- + float-output-format
- + Variable: The format descriptor string (or nil) that lisp uses to print out
- + floats. Nil means use built-in defaults.
- + The descriptor string consists of an optional field-width spec,
- + followed by an optional output-style descriptor.
- +
- + Valid field-widths specs are:
- + The empty string for default precision.
- + 0-20 for exponential notation, or 1-20 for decimal point notation. A 0
- + field spec causes the printing of the decimal point to be supressed.
- + Using an out of bounds specs cause the closest valid spec to be used.
- +
- + Valid ouput-styles may be one of the following:
- + The letter 'e' for exponential notation "<number>.<number>e<number>"
- + The letter 'd' for decimal point notation "<number>.<number>".
- + The empty string, for the defaulted output style. This may print in
- + either format in a data-dependent manner, choosing whatever produces
- + the shortest string.
- +
- + floor
- + Function: Return the largest integer no greater than ARG. (round towards -inf)
- + fround
- + Function: Return the nearest integral floating pt. number to ARG.
- + ftruncate
- + Function: Truncate a floating point number, returns a float.
- + (Truncates towards zero.) Will fail for floats > max integer.
- + garbage-collect
- + Function: Reclaim storage for Lisp objects no longer needed.
- + Returns info on amount of space in use:
- + ((USED-CONSES . FREE-CONSES) (USED-SYMS . FREE-SYMS)
- + (USED-MARKERS . FREE-MARKERS) (USED-FLOATS . FREE-FLOATS)
- + USED-STRING-CHARS USED-VECTOR-SLOTS)
- + Garbage collection happens automatically if you cons more than
- + gc-cons-threshold bytes of Lisp data since previous garbage collection.
- + int-to-string
- + Function: Convert INT to a string by printing it in decimal, with minus sign if negative.
- + integer-or-float-or-marker-p
- + Function: T if OBJECT is a floating pointt, normal number, or marker.
- + integer-or-floatp
- + Function: T if OBJECT is a floating pt. or normal number.
- + j0
- + Function: Return the bessel function j0 of ARG.
- + j1
- + Function: Return the bessel function j1 of ARG.
- + jn
- + Function: Return the bessel function jN of ARG.
- + log
- + Function: Return the natural logarithm of ARG.
- + log-gamma
- + Function: Return the log gamma of ARG.
- + log10
- + Function: Return the logarithm base 10 of ARG.
- + log1p
- + Function: Return the log(1+x) of ARG.
- + round
- + Function: Return the nearest integer to ARG.
- + sin
- + Function: Return the sine of ARG.
- + sinh
- + Function: Return the hyperbolic sine of ARG.
- + sqrt
- + Function: Return the square root of ARG.
- + tan
- + Function: Return the tangent of ARG.
- + tanh
- + Function: Return the hyperbolic tangent of ARG.
- + truncate
- + Function: Truncate a floating point number to an int.
- + (Truncates toward zero.)
- + y0
- + Function: Return the bessel function y0 of ARG.
- + y1
- + Function: Return the bessel function y1 of ARG.
- + yn
- + Function: Return the bessel function yN of ARG.
- *** src/alloc.c.orig Thu Feb 11 02:09:48 1988
- --- src/alloc.c Fri Sep 2 23:01:22 1988
- ***************
- *** 1,3 ****
- --- 1,15 ----
- + /******************************************************************************
- + * *
- + * File: alloc.c *
- + * Author: Wolfgang S. Rupprecht <wolfgang@wsrcc.com> *
- + * Created: Mon Nov 2 15:20:48 EST 1987 *
- + * Contents: GNU alloc.c with my float code *
- + * *
- + * Copyright (c) 1987 Wolfgang Rupprecht. *
- + * All rights reserved. *
- + * *
- + * $Log$ *
- + ******************************************************************************/
- /* Storage allocation and gc for GNU Emacs Lisp interpreter.
- Copyright (C) 1985, 1986 Free Software Foundation, Inc.
-
- ***************
- *** 147,152 ****
- --- 159,239 ----
- cons_free_list = ptr;
- }
-
- + #ifdef LISP_FLOAT_TYPE
- +
- + /* Allocation of float cells, just like conses */
- + /* We store float cells inside of float_blocks, allocating a new
- + float_block with malloc whenever necessary. Float cells reclaimed by
- + GC are put on a free list to be reallocated before allocating
- + any new float cells from the latest float_block.
- +
- + Each float_block is just under 1020 bytes long,
- + since malloc really allocates in units of powers of two
- + and uses 4 bytes for its own overhead. */
- +
- + #define FLOAT_BLOCK_SIZE \
- + ((1020 - sizeof (struct float_block *)) / sizeof (struct Lisp_Float))
- +
- + struct float_block
- + {
- + struct float_block *next;
- + struct Lisp_Float floats[FLOAT_BLOCK_SIZE];
- + };
- +
- + struct float_block *float_block;
- + int float_block_index;
- +
- + struct Lisp_Float *float_free_list;
- +
- + void
- + init_float ()
- + {
- + float_block = (struct float_block *) malloc (sizeof (struct float_block));
- + float_block->next = 0;
- + bzero (float_block->floats, sizeof float_block->floats);
- + float_block_index = 0;
- + float_free_list = 0;
- + }
- +
- + /* Explicitly free a float cell. */
- + free_float (ptr)
- + struct Lisp_Float *ptr;
- + {
- + XFASTINT (ptr->type) = (int) float_free_list;
- + float_free_list = ptr;
- + }
- +
- + Lisp_Object
- + make_float (float_value)
- + double float_value;
- + {
- + register Lisp_Object val;
- +
- + if (float_free_list)
- + {
- + XSET (val, Lisp_Float, float_free_list);
- + float_free_list = (struct Lisp_Float *) XFASTINT (float_free_list->type);
- + }
- + else
- + {
- + if (float_block_index == FLOAT_BLOCK_SIZE)
- + {
- + register struct float_block *new = (struct float_block *) malloc (sizeof (struct float_block));
- + if (!new) memory_full ();
- + new->next = float_block;
- + float_block = new;
- + float_block_index = 0;
- + }
- + XSET (val, Lisp_Float, &float_block->floats[float_block_index++]);
- + }
- + XFLOAT (val)->data = float_value;
- + XFLOAT (val)->type = 0; /* bug chasing -wsr */
- + consing_since_gc += sizeof (struct Lisp_Float);
- + return val;
- + }
- + #endif LISP_FLOAT_TYPE
- +
- +
- DEFUN ("cons", Fcons, Scons, 2, 2, 0,
- "Create a new cons, give it CAR and CDR as components, and return it.")
- (car, cdr)
- ***************
- *** 596,602 ****
- --- 683,707 ----
- return new;
- }
-
- + #ifdef LISP_FLOAT_TYPE
- Lisp_Object
- + pure_float (num)
- + double num;
- + {
- + register Lisp_Object new;
- +
- + if (pureptr + sizeof (struct Lisp_Float) > PURESIZE)
- + error ("Pure Lisp storage exhausted");
- + XSET (new, Lisp_Float, PUREBEG + pureptr);
- + pureptr += sizeof (struct Lisp_Float);
- + XFLOAT (new)->data = num;
- + XFLOAT (new)->type = 0; /* bug chasing -wsr */
- + return new;
- + }
- +
- + #endif LISP_FLOAT_TYPE
- +
- + Lisp_Object
- make_pure_vector (len)
- int len;
- {
- ***************
- *** 641,646 ****
- --- 746,756 ----
- case Lisp_Cons:
- return pure_cons (XCONS (obj)->car, XCONS (obj)->cdr);
-
- + #ifdef LISP_FLOAT_TYPE
- + case Lisp_Float:
- + return pure_float (XFLOAT (obj)->data);
- + #endif LISP_FLOAT_TYPE
- +
- case Lisp_String:
- return make_pure_string (XSTRING (obj)->data, XSTRING (obj)->size);
-
- ***************
- *** 727,737 ****
- --- 837,852 ----
-
- int total_conses, total_markers, total_symbols, total_string_size, total_vector_size;
- int total_free_conses, total_free_markers, total_free_symbols;
- + #ifdef LISP_FLOAT_TYPE
- + int total_free_floats, total_floats;
- + #endif LISP_FLOAT_TYPE
-
- static void mark_object (), mark_buffer ();
- static void clear_marks (), gc_sweep ();
- static void compact_strings ();
-
- + #ifndef LISP_FLOAT_TYPE
- +
- DEFUN ("garbage-collect", Fgarbage_collect, Sgarbage_collect, 0, 0, "",
- "Reclaim storage for Lisp objects no longer needed.\n\
- Returns info on amount of space in use:\n\
- ***************
- *** 738,745 ****
- ((USED-CONSES . FREE-CONSES) (USED-SYMS . FREE-SYMS)\n\
- (USED-MARKERS . FREE-MARKERS) USED-STRING-CHARS USED-VECTOR-SLOTS)\n\
- Garbage collection happens automatically if you cons more than\n\
- ! gc-cons-threshold bytes of Lisp data since previous garbage collection.")
- ()
- {
- register struct gcpro *tail;
- register struct specbinding *bind;
- --- 853,873 ----
- ((USED-CONSES . FREE-CONSES) (USED-SYMS . FREE-SYMS)\n\
- (USED-MARKERS . FREE-MARKERS) USED-STRING-CHARS USED-VECTOR-SLOTS)\n\
- Garbage collection happens automatically if you cons more than\n\
- ! gc-cons-threshold bytes of Lisp data since previous garbage collection."
- ! )
- ()
- + #else LISP_FLOAT_TYPE
- +
- + DEFUN ("garbage-collect", Fgarbage_collect, Sgarbage_collect, 0, 0, "", "Reclaim storage for Lisp objects no longer needed.\n\
- + Returns info on amount of space in use:\n\
- + ((USED-CONSES . FREE-CONSES) (USED-SYMS . FREE-SYMS)\n\
- + (USED-MARKERS . FREE-MARKERS) (USED-FLOATS . FREE-FLOATS) \n\
- + USED-STRING-CHARS USED-VECTOR-SLOTS)\n\
- + Garbage collection happens automatically if you cons more than\n\
- + gc-cons-threshold bytes of Lisp data since previous garbage collection."
- + )
- + ()
- + #endif LISP_FLOAT_TYPE
- {
- register struct gcpro *tail;
- register struct specbinding *bind;
- ***************
- *** 859,867 ****
- --- 987,1004 ----
- make_number (total_free_symbols)),
- Fcons (Fcons (make_number (total_markers),
- make_number (total_free_markers)),
- + #ifdef LISP_FLOAT_TYPE
- + Fcons (Fcons (make_number (total_floats),
- + make_number (total_free_floats)),
- + Fcons (make_number (total_string_size),
- + Fcons (make_number (total_vector_size),
- + Qnil))))));
- + #else not LISP_FLOAT_TYPE
- Fcons (make_number (total_string_size),
- Fcons (make_number (total_vector_size),
- Qnil)))));
- + #endif LISP_FLOAT_TYPE
- +
- }
-
- #if 0
- ***************
- *** 1053,1058 ****
- --- 1190,1201 ----
- goto loop;
- }
-
- + #ifdef LISP_FLOAT_TYPE
- + case Lisp_Float:
- + XMARK (XFLOAT (obj)->type);
- + break;
- + #endif LISP_FLOAT_TYPE
- +
- case Lisp_Buffer:
- if (!XMARKBIT (XBUFFER (obj)->name))
- mark_buffer (obj);
- ***************
- *** 1137,1143 ****
- --- 1280,1316 ----
- total_conses = num_used;
- total_free_conses = num_free;
- }
- + #ifdef LISP_FLOAT_TYPE
- + /* Put all unmarked floats on free list */
- + {
- + register struct float_block *fblk;
- + register int lim = float_block_index;
- + register int num_free = 0, num_used = 0;
-
- + float_free_list = 0;
- +
- + for (fblk = float_block; fblk; fblk = fblk->next)
- + {
- + register int i;
- + for (i = 0; i < lim; i++)
- + if (!XMARKBIT (fblk->floats[i].type))
- + {
- + XFASTINT (fblk->floats[i].type) = (int) float_free_list;
- + num_free++;
- + float_free_list = &fblk->floats[i];
- + }
- + else
- + {
- + num_used++;
- + XUNMARK (fblk->floats[i].type);
- + }
- + lim = FLOAT_BLOCK_SIZE;
- + }
- + total_floats = num_used;
- + total_free_floats = num_free;
- + }
- + #endif LISP_FLOAT_TYPE
- +
- /* Put all unmarked symbols on free list */
- {
- register struct symbol_block *sblk;
- ***************
- *** 1412,1417 ****
- --- 1585,1593 ----
- all_vectors = 0;
- init_strings ();
- init_cons ();
- + #ifdef LISP_FLOAT_TYPE
- + init_float ();
- + #endif LISP_FLOAT_TYPE
- init_symbol ();
- init_marker ();
- gcprolist = 0;
- *** src/callint.c.orig Tue Jun 28 19:57:24 1988
- --- src/callint.c Fri Sep 2 23:01:26 1988
- ***************
- *** 353,359 ****
- --- 353,364 ----
- case 'n': /* Read number from minibuffer. */
- do
- args[i] = Fread_minibuffer (build_string (prompt), Qnil);
- + #ifdef LISP_FLOAT_TYPE
- + while ((XTYPE (args[i]) != Lisp_Int) &&
- + (XTYPE (args[i]) != Lisp_Float));
- + #else
- while (XTYPE (args[i]) != Lisp_Int);
- + #endif
- visargs[i] = last_minibuf_string;
- break;
-
- *** src/config.h-dist.orig Thu Apr 21 03:18:33 1988
- --- src/config.h-dist Fri Sep 2 23:01:27 1988
- ***************
- *** 18,24 ****
- --- 18,29 ----
- file named COPYING. Among other things, the copyright notice
- and this notice must be preserved on all copies. */
-
- + /* This is a hack feature added by me.
- + * It probably won't break anything too badly, but it may not do
- + * much for you either. -Wolfgang Rupprecht 10/25/87
- + */
-
- + /* #define LISP_FLOAT_TYPE /* define this for floating pt. numbers */
-
- /* Include here a s- file that describes the system type you are using.
- See the file ../etc/MACHINES for a list of systems and
- ***************
- *** 100,110 ****
- Note that s-vms.h and m-sun2.h may override this default. */
-
- #ifndef PURESIZE
- ! #ifdef HAVE_X_WINDOWS
- ! #define PURESIZE 122000
- ! #else
- ! #define PURESIZE 118000
- ! #endif
- #endif
-
- /* Define HIGHPRI as a negative number
- --- 105,119 ----
- Note that s-vms.h and m-sun2.h may override this default. */
-
- #ifndef PURESIZE
- ! # ifdef HAVE_X_WINDOWS
- ! # define PURESIZE 122000
- ! # else
- ! # ifdef LISP_FLOAT_TYPE /* oink oink */
- ! # define PURESIZE 122000
- ! # else
- ! # define PURESIZE 118000
- ! # endif
- ! # endif
- #endif
-
- /* Define HIGHPRI as a negative number
- *** src/crt0.c.orig Wed Aug 31 02:48:46 1988
- --- src/crt0.c Thu Apr 20 10:57:02 1989
- ***************
- *** 369,374 ****
- --- 369,379 ----
-
- _start ()
- {
- + #ifdef LISP_FLOAT_TYPE
- + # ifdef sun3
- + finitfp_();
- + # endif
- + #endif
- /* On 68000, _start pushes a6 onto stack */
- start1 ();
- }
- *** src/data.c.orig Fri Aug 26 20:36:23 1988
- --- src/data.c Fri Sep 2 23:01:39 1988
- ***************
- *** 1,3 ****
- --- 1,15 ----
- + /******************************************************************************
- + * *
- + * File: data.c *
- + * Author: Wolfgang S. Rupprecht <wolfgang@wsrcc.com> *
- + * Created: Mon Nov 2 15:22:23 EST 1987 *
- + * Contents: GNU data.c with my float code *
- + * *
- + * Copyright (c) 1987 Wolfgang Rupprecht. *
- + * All rights reserved. *
- + * *
- + * $Log$ *
- + ******************************************************************************/
- /* Primitive operations on Lisp data types for GNU Emacs Lisp interpreter.
- Copyright (C) 1985, 1986 Free Software Foundation, Inc.
-
- ***************
- *** 28,33 ****
- --- 40,49 ----
- #include "buffer.h"
- #endif
-
- + #ifdef LISP_FLOAT_TYPE
- + #include <math.h>
- + #endif LISP_FLOAT_TYPE
- +
- Lisp_Object Qnil, Qt, Qquote, Qlambda, Qsubr, Qunbound;
- Lisp_Object Qerror_conditions, Qerror_message, Qtop_level;
- Lisp_Object Qerror, Qquit, Qwrong_type_argument, Qargs_out_of_range;
- ***************
- *** 41,47 ****
- --- 57,68 ----
- Lisp_Object Qchar_or_string_p, Qmarkerp, Qinteger_or_marker_p, Qvectorp;
- Lisp_Object Qboundp, Qfboundp;
- Lisp_Object Qcdr;
- + #ifdef LISP_FLOAT_TYPE
- + Lisp_Object Qfloatp, Qinteger_or_floatp, Qinteger_or_float_or_marker_p;
- + #endif LISP_FLOAT_TYPE
-
- +
- +
- Lisp_Object
- wrong_type_argument (predicate, value)
- register Lisp_Object predicate, value;
- ***************
- *** 177,182 ****
- --- 198,238 ----
- return Qnil;
- }
-
- + #ifdef LISP_FLOAT_TYPE
- + DEFUN ("floatp", Ffloatp, Sfloatp, 1, 1, 0,
- + "T if OBJECT is a floating pt. number.")
- + (obj)
- + Lisp_Object obj;
- + {
- + if (XTYPE (obj) == Lisp_Float)
- + return Qt;
- + return Qnil;
- + }
- +
- + DEFUN ("integer-or-floatp", Finteger_or_floatp, Sinteger_or_floatp,
- + 1, 1, 0, "T if OBJECT is a floating pt. or normal number.")
- + (obj)
- + Lisp_Object obj;
- + {
- + if ((XTYPE (obj) == Lisp_Float) || (XTYPE (obj) == Lisp_Int))
- + return Qt;
- + return Qnil;
- + }
- +
- + DEFUN ("integer-or-float-or-marker-p", Finteger_or_float_or_marker_p,
- + Sinteger_or_float_or_marker_p, 1, 1, 0,
- + "T if OBJECT is a floating pointt, normal number, or marker.")
- + (obj)
- + Lisp_Object obj;
- + {
- + if ((XTYPE (obj) == Lisp_Float) ||
- + (XTYPE (obj) == Lisp_Int) ||
- + (XTYPE (obj) == Lisp_Marker))
- + return Qt;
- + return Qnil;
- + }
- + #endif LISP_FLOAT_TYPE
- +
- DEFUN ("natnump", Fnatnump, Snatnump, 1, 1, 0, "T if OBJECT is a nonnegative number.")
- (obj)
- Lisp_Object obj;
- ***************
- *** 961,968 ****
- --- 1017,1041 ----
- (num1, num2)
- register Lisp_Object num1, num2;
- {
- + #ifdef LISP_FLOAT_TYPE
- + CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (num1, 0);
- + CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (num2, 0);
- +
- + if ((XTYPE(num1) == Lisp_Float) || (XTYPE(num2) == Lisp_Float))
- + {
- + double f1, f2;
- +
- + f1 = (XTYPE(num1) == Lisp_Float) ? XFLOAT(num1)->data : XINT(num1);
- + f2 = (XTYPE(num2) == Lisp_Float) ? XFLOAT(num2)->data : XINT(num2);
- + if (f1 == f2)
- + return Qt;
- + return Qnil;
- + }
- +
- + #else
- CHECK_NUMBER_COERCE_MARKER (num1, 0);
- CHECK_NUMBER_COERCE_MARKER (num2, 0);
- + #endif LISP_FLOAT_TYPE
-
- if (XINT (num1) == XINT (num2))
- return Qt;
- ***************
- *** 974,981 ****
- --- 1047,1070 ----
- (num1, num2)
- register Lisp_Object num1, num2;
- {
- + #ifdef LISP_FLOAT_TYPE
- + CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (num1, 0);
- + CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (num2, 0);
- +
- + if ((XTYPE(num1) == Lisp_Float) || (XTYPE(num2) == Lisp_Float))
- + {
- + double f1, f2;
- +
- + f1 = (XTYPE(num1) == Lisp_Float) ? XFLOAT(num1)->data : XINT(num1);
- + f2 = (XTYPE(num2) == Lisp_Float) ? XFLOAT(num2)->data : XINT(num2);
- + if (f1 < f2)
- + return Qt;
- + return Qnil;
- + }
- + #else
- CHECK_NUMBER_COERCE_MARKER (num1, 0);
- CHECK_NUMBER_COERCE_MARKER (num2, 0);
- + #endif LISP_FLOAT_TYPE
-
- if (XINT (num1) < XINT (num2))
- return Qt;
- ***************
- *** 987,994 ****
- --- 1076,1099 ----
- (num1, num2)
- register Lisp_Object num1, num2;
- {
- + #ifdef LISP_FLOAT_TYPE
- + CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (num1, 0);
- + CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (num2, 0);
- +
- + if ((XTYPE(num1) == Lisp_Float) || (XTYPE(num2) == Lisp_Float))
- + {
- + double f1, f2;
- +
- + f1 = (XTYPE(num1) == Lisp_Float) ? XFLOAT(num1)->data : XINT(num1);
- + f2 = (XTYPE(num2) == Lisp_Float) ? XFLOAT(num2)->data : XINT(num2);
- + if (f1 > f2)
- + return Qt;
- + return Qnil;
- + }
- + #else
- CHECK_NUMBER_COERCE_MARKER (num1, 0);
- CHECK_NUMBER_COERCE_MARKER (num2, 0);
- + #endif LISP_FLOAT_TYPE
-
- if (XINT (num1) > XINT (num2))
- return Qt;
- ***************
- *** 1000,1007 ****
- --- 1105,1128 ----
- (num1, num2)
- register Lisp_Object num1, num2;
- {
- + #ifdef LISP_FLOAT_TYPE
- + CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (num1, 0);
- + CHECK_NUMBER