[r6rs-discuss] Confusion over |p

From: William D Clinger <will>
Date: Fri, 29 Jun 2007 20:48:03 -0400

Alan Watson wrote:

> The problem is not so much with x|p as with the rules for adding an
> implicit |p when none is given. They are currently insane. It might be
> possible to fix them, though.

Are you complaining about the rule that says the absence
of |p (for an inexact decimal notation) means the same
as the presence of |53 ? Or the rule that says a
denormalized double precision number really ought to
be printed with an explicit mantissa width?

> > In my opinion, standard practice should be to read x|p
> > with no loss of precision or accuracy when p <= 53, and
> > to represent x|p as accurately as possible if p exceeds
> > the highest precision provided by a implementation.
>
> If I understand correctly, that would make it a NOP on implementations
> that use IEEE doubles for all inexact reals.

Sorry, I meant that p <= 53 would mean x|p is read with
no loss of accuracy from our agreed-upon meaning of x|p,
not that it would be read with no loss of accuracy from
x. For example, 1.1|1 would read as 1.0, not as 1.1|53.

> How then do I write a number that ends up being interpreted as the value
> of 1.1 truncated to 24 bits?

If by "truncated" you mean "rounded", then why wouldn't
you write it as 1.1|24 ?

> If I know that inexacts are IEEE doubles, I
> can simply write the decimal approximation that rounds to the correct
> value. However, this decimal approximation might not work for other
> formats, like IEEE double extended. It also does very little to convey
> my intent.

Unless I have made another gross blunder, x|24 would have
exactly the same numerical value in all implementations
that (1) use IEEE floating point with single precision or
greater and (2) follow my recommendations. So I don't see
what you're getting at.

Will
Received on Fri Jun 29 2007 - 20:48:03 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:01 UTC