Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Floating-point arithmetic evaluation on Linux/x86 (traditional FPU)

Vincent Lefevre wrote:
> But it is not true that zsh always uses double precision. It seems to
> use the C double type, but this doesn't correspond to double precision
> by default under Linux/x86 (when the traditional FPU is used, i.e. no
> SSE2).
> Either zsh should switch to double precision (assuming that modules
> and so on won't change the precision back to the extended precision),
> or the zsh documentation should be changed.

There's no hope of me taking on another architectural investigation, so
unless someone can look at this, then as long as it's simply a question
of restating what the shell does it's easy.

Index: Doc/Zsh/arith.yo
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/arith.yo,v
retrieving revision 1.11
diff -u -r1.11 arith.yo
--- Doc/Zsh/arith.yo	15 Jun 2007 10:02:24 -0000	1.11
+++ Doc/Zsh/arith.yo	12 Nov 2007 16:40:38 -0000
@@ -12,7 +12,8 @@
 is available, otherwise precision is 4 bytes.  This can be tested, for
 example, by giving the command `tt(print - $(( 12345678901 )))'; if the
 number appears unchanged, the precision is at least 8 bytes.  Floating
-point arithmetic is always double precision.
+point arithmetic always uses the `double' type with whatever corresponding
+precision is provided by the compiler and the library.
 The tt(let) builtin command takes arithmetic expressions as arguments; each
 is evaluated separately.  Since many of the arithmetic operators, as well

Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070

Messages sorted by: Reverse Date, Date, Thread, Author