|
From: | Michael Lambert |
Subject: | Re: [Gm2] complex types |
Date: | Mon, 15 Dec 2008 11:57:52 -0500 |
Hi Gaius, On 15 Dec 2008, at 08:35, Gaius Mulley wrote:
I've followed PIM2, PIM3, PIM4 (for sqrt, exp, ln, sin, cos, tan, arctan and entier). However do you think it better to default to use the LONGREAL versions and allow users to specify lower precision variants if desired? So in the case of tan we might have PROCEDURE tan (x: LONGREAL) : LONGREAL ; PROCEDURE tanr (x: REAL) : REAL ; PROCEDURE tans (x: SHORTREAL) : SHORTREAL ; given that LONGREAL, REAL, SHORTREAL are assignment compatible. However they are not expression compatible so this change will probably break legacy code..
I would be inclined to stay with REAL functions and leave it to the programmer to apply explicit coercion when necessary. Even with most modern systems using IEEE 754 floating point, the only guarantee is that
TSIZE(SHORTREAL) <= TSIZE(REAL) <= TSIZE(LONGREAL)with emphasis on '='. For example, on the Alpha these are 32/64/64 bits and I wouldn't be surprised if some platforms still implement 32/32/64. Even for systems with 32/64/128, I don't know that the 128- bit floating point is done in hardware--performance could be important.
Michael
[Prev in Thread] | Current Thread | [Next in Thread] |