Re: [9fans] hoc output format

2010-05-13 Thread roger peppe
On 13 May 2010 17:06, erik quanstrom wrote: > On Thu May 13 12:05:13 EDT 2010, rogpe...@gmail.com wrote: >> sorry, misunderstanding, i meant that (64-bit) floating point is >> ok for integer ops if you stick to 32 bit and don't do divisions. >> > > ah!  ok.  i was wondering about that. > > ideally

Re: [9fans] hoc output format

2010-05-13 Thread roger peppe
On 13 May 2010 16:54, Ethan Grammatikidis wrote: > what do you mean by "its output isn't suitable for use as input"? i'm just > curious, have never used it that way. hum... having asked that question i > tried some operations producing very lare numbers and they started to be > printed with backsl

Re: [9fans] hoc output format

2010-05-13 Thread erik quanstrom
On Thu May 13 12:05:13 EDT 2010, rogpe...@gmail.com wrote: > sorry, misunderstanding, i meant that (64-bit) floating point is > ok for integer ops if you stick to 32 bit and don't do divisions. > ah! ok. i was wondering about that. ideally one would have a mp library as go uses for constants.

Re: [9fans] hoc output format

2010-05-13 Thread Ethan Grammatikidis
On 13 May 2010, at 16:16, roger peppe wrote: On 13 May 2010 15:23, erik quanstrom wrote: i typically do programming calculations and floating point just isn't the right way to do that. it's ok if you stick to 32 bit and don't do divisions. personally for off-the-cuff command-line calculati

Re: [9fans] hoc output format

2010-05-13 Thread roger peppe
sorry, misunderstanding, i meant that (64-bit) floating point is ok for integer ops if you stick to 32 bit and don't do divisions. On 13 May 2010 16:31, erik quanstrom wrote: > On Thu May 13 11:28:29 EDT 2010, rogpe...@gmail.com wrote: >> On 13 May 2010 15:23, erik quanstrom wrote: >> > i typica

Re: [9fans] hoc output format

2010-05-13 Thread erik quanstrom
> I normally use acid for interactive use, but for scripts bc is great, > supports hex, > has C like syntax, can do floating point and it has a big precision. doesn't do bit shifting, masking and whatnot. if acid were to grace stderr with its prompt, it would be easy to use in a scripty sort of w

Re: [9fans] hoc output format

2010-05-13 Thread erik quanstrom
On Thu May 13 11:28:29 EDT 2010, rogpe...@gmail.com wrote: > On 13 May 2010 15:23, erik quanstrom wrote: > > i typically do programming calculations and floating point > > just isn't the right way to do that. > > it's ok if you stick to 32 bit and don't do divisions. what!? acid: (1<<36) / 10\Y

Re: [9fans] hoc output format

2010-05-13 Thread Rudolf Sykora
On 13 May 2010 16:23, erik quanstrom wrote: >> > echo 1 2 | hoc -e '{while(read(x) != 0)y += x' ^ $nl ^ ' print y, "\n"}' >> >> Maybe it makes a sense to add in hoc(1) expression delimiter like a ';'? > > i don't use hoc very often.  i tend to use acid.  (!) > this is because hoc won't do bit oper

Re: [9fans] hoc output format

2010-05-13 Thread roger peppe
On 13 May 2010 15:23, erik quanstrom wrote: > i typically do programming calculations and floating point > just isn't the right way to do that. it's ok if you stick to 32 bit and don't do divisions. personally for off-the-cuff command-line calculations i've been using my own "fc" for years and y

Re: [9fans] hoc output format

2010-05-13 Thread Gorka Guardiola
On Thu, May 13, 2010 at 4:23 PM, erik quanstrom wrote: >> > echo 1 2 | hoc -e '{while(read(x) != 0)y += x' ^ $nl ^ ' print y, "\n"}' >> >> Maybe it makes a sense to add in hoc(1) expression delimiter like a ';'? > > i don't use hoc very often.  i tend to use acid.  (!) > this is because hoc won't

Re: [9fans] hoc output format

2010-05-13 Thread Ethan Grammatikidis
On 13 May 2010, at 15:23, erik quanstrom wrote: echo 1 2 | hoc -e '{while(read(x) != 0)y += x' ^ $nl ^ ' print y, "\n"}' Maybe it makes a sense to add in hoc(1) expression delimiter like a ';'? i don't use hoc very often. i tend to use acid. (!) this is because hoc won't do bit operati

Re: [9fans] hoc output format

2010-05-13 Thread erik quanstrom
> > echo 1 2 | hoc -e '{while(read(x) != 0)y += x' ^ $nl ^ ' print y, "\n"}' > > Maybe it makes a sense to add in hoc(1) expression delimiter like a ';'? i don't use hoc very often. i tend to use acid. (!) this is because hoc won't do bit operations and doesn't accept hex. i typically do progr

Re: [9fans] hoc output format

2010-05-13 Thread Alexander Sychev
On Thu, 13 May 2010 17:24:47 +0400, erik quanstrom wrote: On Thu May 13 03:51:56 EDT 2010, santu...@gmail.com wrote: Yes, I'm agree, but with one exception - awk(1) separates a data from a code, hoc(1) doesn't do it. So hoc(1) can be used for plain calculation tasks, not for processing inpu

Re: [9fans] hoc output format

2010-05-13 Thread erik quanstrom
On Thu May 13 03:51:56 EDT 2010, santu...@gmail.com wrote: > Yes, I'm agree, but with one exception - awk(1) separates a data from a > code, hoc(1) doesn't do it. So hoc(1) can be used for plain calculation > tasks, not for processing input files with a data. both awk and hoc accept standard inpu

Re: [9fans] hoc output format

2010-05-13 Thread Alexander Sychev
Yes, I'm agree, but with one exception - awk(1) separates a data from a code, hoc(1) doesn't do it. So hoc(1) can be used for plain calculation tasks, not for processing input files with a data. On Wed, 12 May 2010 22:06:20 +0400, Akshat Kumar wrote: I've found that awk(1) is more useful (

Re: [9fans] hoc output format

2010-05-12 Thread Akshat Kumar
I've found that awk(1) is more useful (rather, more powerful) for doing programmed computations (number crunching, etc.), where hoc(1) is more of a convenience for basic calculations. Best, ak On Wed, May 12, 2010 at 3:41 AM, Alexander Sychev wrote: > Hello! > > IFAIK, hoc(1) hasn't got such po

Re: [9fans] hoc output format

2010-05-12 Thread Alexander Sychev
Hello! IFAIK, hoc(1) hasn't got such possibility. awk(1) can help: $ hoc -e PI | awk '{printf "%2.2f", $0}' 3.14 On Wed, 12 May 2010 14:24:57 +0400, Rudolf Sykora wrote: Hello everyone, is there any way to control the output format of hoc(1), i.e. e.g. the number of decimal places printe