zsh-users
 help / color / mirror / code / Atom feed
From: Borsenkow Andrej <Andrej.Borsenkow@mow.siemens.ru>
To: "'Phil Pennock'" <Phil.Pennock@globnix.org>
Cc: "'Bruno Bonfils'" <asyd@debian-fr.org>,
	"'ZSH Users'" <zsh-users@sunsite.dk>
Subject: RE: question about float variables
Date: Wed, 10 Oct 2001 14:10:23 +0400	[thread overview]
Message-ID: <003401c15173$c65e9220$21c9ca95@mow.siemens.ru> (raw)
In-Reply-To: <20011010114224.A12923@globnix.org>

> 
> > Integer divided by integer is integer.
> 
> Not so useful if you're manipulating parameters and you don't know
what
> their value is in advance.
>

Sigh ... zsh was meant to be used for arithmetic computations. Obvious
workarounds are

- multiply by 1.0: $((var1*1.0/var2))
- use temps
- use float() function: $((float(var1)/var2))

What is wrong with above?

BTW how is it different from C? 

#include <stdio.h>
main() {
float f;

f = 3/2;
printf ("f = %f\n", f);
}
bor@itsrm2% cc foo.c
bor@itsrm2% ./a.out
f = 1.000000

> I've not seen a way in zsh to modify this to be 'sensible' for humans,

If you can suggest how to 'sensibly' incorporate it into zsh grammar ...

> 
> Personally, I'd use the OS's printf(1) if it exists,


It is included into 4.1 branch. I do not know what people think about
adding it into 4.0.3.

-andrej


  reply	other threads:[~2001-10-12  4:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-09 23:33 Bruno Bonfils
2001-10-10  8:58 ` Borsenkow Andrej
2001-10-10  9:42   ` Phil Pennock
2001-10-10 10:10     ` Borsenkow Andrej [this message]
2001-10-10 10:28       ` Phil Pennock
2001-10-10 12:47   ` Bruno Bonfils

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='003401c15173$c65e9220$21c9ca95@mow.siemens.ru' \
    --to=andrej.borsenkow@mow.siemens.ru \
    --cc=Phil.Pennock@globnix.org \
    --cc=asyd@debian-fr.org \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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 NNTP newsgroup(s).