9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: rog@vitanuova.com
To: 9fans@cse.psu.edu
Subject: Re: [9fans] german keymap
Date: Wed, 21 Apr 2004 18:43:37 +0100	[thread overview]
Message-ID: <bea21b07b011bfc60488d8c959307252@vitanuova.com> (raw)
In-Reply-To: <997f919d90dd12f4cf577ea7ea3bbd5a@collyer.net>

[-- Attachment #1: Type: text/plain, Size: 2129 bytes --]

> One can convert between decimal and other bases (radices) using bc, by
> setting the input or output base:
[...]
> For more general radix conversion, I use db:

to add my own 2 cents, i tend to use a little command-line
calculator i wrote ages ago to do this sort of thing.

i still prefer it to the above tools because it's not interactive
(= less stuff to type to get the results).

it's a reverse polish calculator, which works quite well
on the command line, as there's almost no punctuation
to get in the way of the shell's syntax (no brackets, and the
stuff to be executed is just a list of operands/operators, which
maps well to rc's lists). it's also handy for building up an expression
incrementally.

it's very similar to the inferno version, documented at
http://www.vitanuova.com/inferno/man/1/fc.html

all calculations are done in floating point, and it's a convenient
command-line way of getting access to the floating point
library, not to mention converting between bases.

e.g.
% fc 0x400
1024
% fc -x 1024
0x400
% fc 0400
256
% fc -x 0400
0x100
% fc 22 7 /
3.142857143
% x=(1 2 3 4 5 6)
% fc $x sum
21
% fc -B 96451234
0b00000101101111111011101010100010
  10987654321098765432109876543210
   3         2         1
% fc 0b00000101101111111011101010100010 sqrt
9820.958914
% fc -help
Usage: fc -[dcxotbB] <postfix expression>
Option specifies output format:
		-d decimal
		-c rune
		-x hex
		-o octal
		-t time
		-b binary
		-B annotated binary
Operands are decimal(default), hex(0x), octal(0), binary(0b),
             rune(@), time(hh:mm.ss)
Operators are: (number of arguments in brackets)
swap[2] dup[1] rep[n] ![1] %[2] p[1] *,×,x[2] **,xx,^,pow[2] 
+[2] -[2] /[2] _[1] <<,«,shl[2] >>,»,shr[2] and,⋀[2] ⋁,or[2] 
xor[2] not[1] sum[n] acos[1] asin[1] atan[1] atan2[2] ceil[1] 
cos[1] cosh[1] deg[1] exp[1] fabs[1] floor[1] fmod[2] ldexp[2] 
log,ln[1] log10[1] log2[1] rad[1] sin[1] sinh[1] √,sqrt[1] 
tan[1] tanh[1] trunc[2] 
Constants are:
	π=3.14159
	pi=3.14159
	e=2.71828
% 

i've attached it. someone might find it useful.

[-- Attachment #2: fc.c.gz --]
[-- Type: application/octet-stream, Size: 4157 bytes --]

  parent reply	other threads:[~2004-04-21 17:43 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-11 19:14 Scusi
2004-04-11 19:28 ` boyd, rounin
2004-04-11 20:00   ` Scusi
2004-04-11 20:03     ` boyd, rounin
2004-04-11 22:10 ` Geoff Collyer
2004-04-11 22:39   ` Russ Cox
2004-04-11 22:55     ` Geoff Collyer
2004-04-12  0:01       ` Russ Cox
2004-04-12  0:06         ` Geoff Collyer
2004-04-12  0:22           ` Charles Forsyth
2004-04-12  2:42           ` boyd, rounin
2004-04-12  2:57             ` countryjoe
2004-04-12  4:02               ` boyd, rounin
2004-04-12  2:40         ` boyd, rounin
2004-04-12  2:35       ` boyd, rounin
2004-04-12  2:33     ` boyd, rounin
2004-04-21 17:43   ` rog [this message]
2004-04-21 17:44     ` boyd, rounin
2004-04-21 17:56       ` rog
2004-04-21 18:03         ` boyd, rounin
2004-04-21 18:41           ` rog
2004-04-21 18:42             ` Rob Pike
2004-04-21 19:16               ` rog
2004-04-21 18:43             ` boyd, rounin
2004-04-21 18:47             ` boyd, rounin
2004-04-21 18:57               ` Rob Pike
2004-04-21 18:58                 ` boyd, rounin
2004-04-21 19:20                   ` rog
2004-04-21 19:58                     ` boyd, rounin
2004-04-21 20:26                       ` rog
2004-04-21 21:26     ` [9fans] an idea rog
2004-04-26  7:57       ` Fco.J.Ballesteros
2004-04-26  8:04         ` Charles Forsyth
2004-04-26  8:10           ` Fco.J.Ballesteros
2004-04-26  8:13             ` Charles Forsyth
2004-04-26 16:41         ` rog
2004-04-26 16:43           ` Charles Forsyth
2004-04-26 16:57             ` rog
2004-04-26 16:48           ` Fco.J.Ballesteros
2004-04-27  1:44         ` Scott Schwartz
2004-04-27  6:43           ` Fco.J.Ballesteros
2004-04-26 15:12       ` Russ Cox
2004-04-26 15:49         ` ron minnich
2004-04-26 16:42           ` rog
2004-04-26 16:59           ` Russ Cox
2004-04-26 17:05             ` Charles Forsyth
2004-04-26 18:04               ` Philippe Anel
2004-04-26 18:16                 ` rog
2004-04-26 18:36                   ` Philippe Anel
2004-04-26 20:27                     ` rog
2004-04-27  7:44                       ` Philippe Anel
2004-04-27  8:13                     ` Fco.J.Ballesteros
2004-04-26 18:20                 ` rog
2004-04-26 18:09         ` rog
2004-04-26 18:44           ` [9fans] local 9p multiplexing Russ Cox
2004-04-26 18:54           ` [9fans] remote " Russ Cox
2004-04-26 19:44             ` rog
2004-04-28 17:37             ` [9fans] Vmware-4 and Plan 9 Ishwar Rattan
2004-04-28 17:58               ` Hugo Santos
2004-04-28 18:01               ` vic zandy
2004-04-26 18:55           ` [9fans] an idea Charles Forsyth
2004-04-26 20:12             ` rog
2004-04-26 20:40               ` Charles Forsyth
2004-04-26 23:26                 ` rog
2004-04-26 19:51           ` ron minnich
2004-04-26 20:49             ` Charles Forsyth
2004-04-22  1:57     ` [9fans] german keymap Michael Jeffrey

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=bea21b07b011bfc60488d8c959307252@vitanuova.com \
    --to=rog@vitanuova.com \
    --cc=9fans@cse.psu.edu \
    /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.
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).