zsh-workers
 help / color / mirror / code / Atom feed
From: Emanuel Berg <embe8573@student.uu.se>
To: zsh-workers@zsh.org
Subject: Re: why do ceil/floor give the decimal dot?
Date: Thu, 14 May 2015 11:12:51 +0200	[thread overview]
Message-ID: <87oalncyjw.fsf@debian.uxu> (raw)
In-Reply-To: <150513210405.ZM29616@torch.brasslantern.com>

Bart Schaefer <schaefer@brasslantern.com> writes:

> If what you want to argue is that floating point
> values that happen to be whole numbers should not
> print the trailing dot, that's another discussion.

You mean like this?

    $ printf "%d\n" $(( 7.5 + 0.5 ))
    8

No, I don't care what data type is used as long as

    1. ceil and floor return integers in the math
       sense (otherwise the function I just posted is
       is incorrect); and

    2. when the result is printed, it is printed as
       x (and not "x.") for an integer x, because
       otherwise I can't use that function in scripts
       and functions without removing the dot
       each time.

Or, do you think the "unbroken chain of floats"/"the
shell will deal with it"-approach instead should be
put to use, i.e. rolling with the punches, e.g.

    $ g () { return 6.0 }; g; b=$?; printf "%d\n" $b
    6

Is that what you are saying?

-- 
underground experts united
http://user.it.uu.se/~embe8573


  reply	other threads:[~2015-05-14  9:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-14  0:32 Emanuel Berg
2015-05-14  2:56 ` Bart Schaefer
2015-05-14  3:29   ` Emanuel Berg
2015-05-14  3:53     ` Lawrence Velázquez
2015-05-14  9:53       ` Peter Stephenson
2015-05-14 21:38         ` Emanuel Berg
2015-05-14 22:14           ` Lawrence Velázquez
2015-05-14 23:29             ` Emanuel Berg
2015-05-15  0:46             ` Oliver Kiddle
2015-05-15  1:07               ` Emanuel Berg
2015-05-15  1:27               ` Bart Schaefer
2015-05-18  8:16             ` Vincent Lefevre
2015-05-14  4:04     ` Bart Schaefer
2015-05-14  9:12       ` Emanuel Berg [this message]
2015-05-14 17:54         ` Bart Schaefer
2015-05-18  8:39           ` Vincent Lefevre
2015-05-18  9:41             ` Mikael Magnusson

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=87oalncyjw.fsf@debian.uxu \
    --to=embe8573@student.uu.se \
    --cc=zsh-workers@zsh.org \
    /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).