mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-16 17:24:23 +00:00
193 lines
7.9 KiB
Text
193 lines
7.9 KiB
Text
|
||
(provide (quote float))
|
||
|
||
(defconst exp-base 2 "\
|
||
Base of exponent in this floating point representation.")
|
||
|
||
(defconst mantissa-bits 24 "\
|
||
Number of significant bits in this floating point representation.")
|
||
|
||
(defconst decimal-digits 6 "\
|
||
Number of decimal digits expected to be accurate.")
|
||
|
||
(defconst expt-digits 2 "\
|
||
Maximum permitted digits in a scientific notation exponent.")
|
||
|
||
(defconst maxbit (1- mantissa-bits) "\
|
||
Number of highest bit")
|
||
|
||
(defconst mantissa-maxval (1- (ash 1 maxbit)) "\
|
||
Maximum permissable value of mantissa")
|
||
|
||
(defconst mantissa-minval (1- (ash 1 maxbit)) "\
|
||
Minimum permissable value of mantissa")
|
||
|
||
(defconst mantissa-half-minval (ash (ash 1 maxbit) -1))
|
||
|
||
(defconst floating-point-regexp "^[ ]*\\(-?\\)\\([0-9]*\\)\\(\\.\\([0-9]*\\)\\|\\)\\(\\(\\([Ee]\\)\\(-?\\)\\([0-9][0-9]*\\)\\)\\|\\)[ ]*$" "\
|
||
Regular expression to match floating point numbers. Extract matches:
|
||
1 - minus sign
|
||
2 - integer part
|
||
4 - fractional part
|
||
8 - minus sign for power of ten
|
||
9 - power of ten
|
||
")
|
||
|
||
(defconst high-bit-mask (ash 1 maxbit) "\
|
||
Masks all bits except the high-order (sign) bit.")
|
||
|
||
(defconst second-bit-mask (ash 1 (1- maxbit)) "\
|
||
Masks all bits except the highest-order magnitude bit")
|
||
|
||
(setq _f0 (quote (0 . 1)))
|
||
|
||
(setq _f1/2 (quote (4194304 . -23)))
|
||
|
||
(setq _f1 (quote (4194304 . -22)))
|
||
|
||
(setq _f10 (quote (5242880 . -19)))
|
||
|
||
(setq powers-of-10 (make-vector (1+ decimal-digits) _f1))
|
||
|
||
(aset powers-of-10 1 _f10)
|
||
|
||
(aset powers-of-10 2 (quote (6553600 . -16)))
|
||
|
||
(aset powers-of-10 3 (quote (8192000 . -13)))
|
||
|
||
(aset powers-of-10 4 (quote (5120000 . -9)))
|
||
|
||
(aset powers-of-10 5 (quote (6400000 . -6)))
|
||
|
||
(aset powers-of-10 6 (quote (8000000 . -3)))
|
||
|
||
(setq all-decimal-digs-minval (aref powers-of-10 (1- decimal-digits)) highest-power-of-10 (aref powers-of-10 decimal-digits))
|
||
|
||
(defun fashl (fnum) (byte-code "Á@Â\"ASB‡" [fnum ash 1] 3))
|
||
|
||
(defun fashr (fnum) (byte-code "Á@Â\"ATB‡" [fnum ash -1] 3))
|
||
|
||
(defun normalize (fnum) (byte-code "@ÄVƒ |