unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* A question on the range of floats in Emacs
@ 2007-07-17  2:02 Jay Belanger
  2007-07-17 14:49 ` Johan Bockgård
  0 siblings, 1 reply; 5+ messages in thread
From: Jay Belanger @ 2007-07-17  2:02 UTC (permalink / raw)
  To: emacs-devel; +Cc: jay.p.belanger


The Elisp manual says that the range of integers depends on the
machine, but the information is available within Emacs
(most-positive-fixnum, etc.), and what's more there is a minimum range.
The range of floating points also depends on the machine.  I'm
wondering:
  Is the precise range easily available from within Emacs?
  Is there a minimum range?

Thanks,
Jay

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: A question on the range of floats in Emacs
  2007-07-17  2:02 A question on the range of floats in Emacs Jay Belanger
@ 2007-07-17 14:49 ` Johan Bockgård
  2007-07-17 20:41   ` Jay Belanger
  0 siblings, 1 reply; 5+ messages in thread
From: Johan Bockgård @ 2007-07-17 14:49 UTC (permalink / raw)
  To: emacs-devel

Jay Belanger <jay.p.belanger@gmail.com> writes:

> The Elisp manual says that the range of integers depends on the
> machine, but the information is available within Emacs
> (most-positive-fixnum, etc.), and what's more there is a minimum range.
> The range of floating points also depends on the machine.  I'm
> wondering:
>   Is the precise range easily available from within Emacs?
>   Is there a minimum range?

The cl package can determine a number of floating point parameters.
See

  (info "(cl)Implementation Parameters")

-- 
Johan Bockgård

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: A question on the range of floats in Emacs
  2007-07-17 14:49 ` Johan Bockgård
@ 2007-07-17 20:41   ` Jay Belanger
  2007-07-18  3:19     ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Jay Belanger @ 2007-07-17 20:41 UTC (permalink / raw)
  To: emacs-devel; +Cc: jay.p.belanger


bojohan+news@dd.chalmers.se (Johan Bockgård) writes:
...
> The cl package can determine a number of floating point parameters.
> See
>
>   (info "(cl)Implementation Parameters")

Wonderful; thanks.
I guess this information isn't easily accessible, so it is 
computed.  I played around with the largest and smallest floats, and I
was wondering about precision.  Near the smallest float, the precision
can be small; on my computer, 5e-324, 5.1e-324 and 4.9e-324 all evaluate to
5e-324; 3.47e-323 evaluates to 3.5e-324, etc.  Is there a range (say
from smallest-exponent + N to largest-exponent - N) in which the
precision is fixed?  (It appears that way here; is it true in general?)

Jay

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: A question on the range of floats in Emacs
  2007-07-17 20:41   ` Jay Belanger
@ 2007-07-18  3:19     ` Eli Zaretskii
  2007-07-18 14:57       ` Jay Belanger
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2007-07-18  3:19 UTC (permalink / raw)
  To: jay.p.belanger; +Cc: emacs-devel

> From: Jay Belanger <jay.p.belanger@gmail.com>
> Date: Tue, 17 Jul 2007 15:41:12 -0500
> Cc: jay.p.belanger@gmail.com
> 
> I played around with the largest and smallest floats, and I
> was wondering about precision.  Near the smallest float, the precision
> can be small; on my computer, 5e-324, 5.1e-324 and 4.9e-324 all evaluate to
> 5e-324; 3.47e-323 evaluates to 3.5e-324, etc.  Is there a range (say
> from smallest-exponent + N to largest-exponent - N) in which the
> precision is fixed?  (It appears that way here; is it true in general?)

The numbers where you see the loss of precision are denormalized
(i.e. some of the mantissa bits are zero).  The range you are looking
for (where there's no loss of precision) is between
least-positive-normalized-float and most-positive-float.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: A question on the range of floats in Emacs
  2007-07-18  3:19     ` Eli Zaretskii
@ 2007-07-18 14:57       ` Jay Belanger
  0 siblings, 0 replies; 5+ messages in thread
From: Jay Belanger @ 2007-07-18 14:57 UTC (permalink / raw)
  To: emacs-devel; +Cc: jay.p.belanger

Eli Zaretskii <eliz@gnu.org> writes:
...
> The numbers where you see the loss of precision are denormalized
> (i.e. some of the mantissa bits are zero).  The range you are looking
> for (where there's no loss of precision) is between
> least-positive-normalized-float and most-positive-float.

Thanks!

Jay

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-07-18 14:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-17  2:02 A question on the range of floats in Emacs Jay Belanger
2007-07-17 14:49 ` Johan Bockgård
2007-07-17 20:41   ` Jay Belanger
2007-07-18  3:19     ` Eli Zaretskii
2007-07-18 14:57       ` Jay Belanger

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).