zsh-workers
 help / color / mirror / code / Atom feed
* Re: forcing output type
       [not found] ` <20010923164705.A15106@fysh.org>
@ 2001-09-23 16:18   ` Clint Adams
  2001-09-23 17:16     ` Zefram
  0 siblings, 1 reply; 3+ messages in thread
From: Clint Adams @ 2001-09-23 16:18 UTC (permalink / raw)
  To: zsh-workers

[moved to -workers]

> The expression "2/3" is a truncating integer division; its value is
> exactly 0.  Just as in C, if you want to do a floating-point division
> you have to provide floating-point operands.

Would anyone object to something like $(( [#.] 2/3 )) to
avoid integer truncation?


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: forcing output type
  2001-09-23 16:18   ` forcing output type Clint Adams
@ 2001-09-23 17:16     ` Zefram
  2001-09-27 15:33       ` Clint Adams
  0 siblings, 1 reply; 3+ messages in thread
From: Zefram @ 2001-09-23 17:16 UTC (permalink / raw)
  To: Clint Adams; +Cc: zsh-workers

Clint Adams wrote:
>Would anyone object to something like $(( [#.] 2/3 )) to
>avoid integer truncation?

It's not a very clean way to do it -- it's changing the input language
for an expression, and doesn't inherently apply to the entire $(())
(unlike the existing "[#n]" output-base flag).  It would be better to
localise it; say, "floatops{2/3}" as a subexpression.

But I wonder why you want to do this at all.  What application do you
have in mind?

-zefram


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: forcing output type
  2001-09-23 17:16     ` Zefram
@ 2001-09-27 15:33       ` Clint Adams
  0 siblings, 0 replies; 3+ messages in thread
From: Clint Adams @ 2001-09-27 15:33 UTC (permalink / raw)
  To: Zefram; +Cc: zsh-workers

> But I wonder why you want to do this at all.  What application do you
> have in mind?

I have encountered some people that have functions that pipe the arguments
to 'bc -l', and it seems as though the dependency on bc could be dropped
rather easily.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-09-27 15:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20010923114054.A16301@dman.com>
     [not found] ` <20010923164705.A15106@fysh.org>
2001-09-23 16:18   ` forcing output type Clint Adams
2001-09-23 17:16     ` Zefram
2001-09-27 15:33       ` Clint Adams

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).