Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
RE: question about float variables
- X-seq: zsh-users 4361
- From: Borsenkow Andrej <Andrej.Borsenkow@xxxxxxxxxxxxxx>
- To: "'Bruno Bonfils'" <asyd@xxxxxxxxxxxxx>, "'ZSH Users'" <zsh-users@xxxxxxxxxx>
- Subject: RE: question about float variables
- Date: Wed, 10 Oct 2001 12:58:38 +0400
- Importance: Normal
- In-reply-to: <20011010013324.A9741@xxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
> float var1=0.0
> var1=$((3 / 2))
> echo $var1
>
> return 1.000000000e+00 not good ! :(
>
bor@itsrm2% float var1
bor@itsrm2% var1=$((3.0/2))
bor@itsrm2% print $var1
1.500000000e+00
Integer divided by integer is integer.
> and how to format the output of $var1 ?
> (i want a number like 95.3)
>
Should I just say RTFM?
typeset description:
-E
Use an internal double-precision floating point
representation. On output the variable will be converted to
scientific notation. If N is nonzero it defines the number
of significant figures to display; the default is ten.
-F
Use an internal double-precision floating point
representation. On output the variable will be converted to
fixed-point decimal notation. If N is nonzero it defines the
number of digits to display after the decimal point; the
default is ten.
-andrej
Messages sorted by:
Reverse Date,
Date,
Thread,
Author