Re: [opensuse] Command line calculator?



On Friday 29 June 2007 14:09, G T Smith wrote:
Randall R Schulz wrote:
On Friday 29 June 2007 12:58, G T Smith wrote:
Adam Jimerson wrote:

<snip>

Dc (RPN) or bc (infix) are the way to go for non-trivial scripted
calculation. They do floating point, arbitrary precision and have
formatted printing. (BASH has this, too, perhaps even better, being
modelled after the C library printf() function.)


Randall Schulz

Really..

Yes, really.


Have had a quick look at bc from command line to check on something I
noticed some time ago, it returns the output of 7.3/2 as 3 for
example, a little rounding problem methinks.... as ideally a better
answer could be 4 if it was giving a rounded int rather than a
truncated int ... not a lot better than bash really... accepting
floating point is only useful if the appropriate value is returned...

Your look was too quick. The precision is arbitrary and programmable and
the default precision is 0 (integers).


As I said for anything beyond the really simple one would need to
work on it ...

Anything beyond the really simple requires work no matter what.


...

RPN .... my idea of torture by arithmetic... :-)

Parentheses are the real torture.


Randall Schulz
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx



Relevant Pages

  • Re: Precision
    ... Whether one does the subsequent calculations in internal ie integer format ... I have always used external format with Precision 4 since my ... floating point calcs which are done in binary have around 3% error albeit at ... positions it is IMPOSIBLE to have a result of 4 decimals with the 2 ...
    (comp.databases.pick)
  • Re: Linear Algebra Challenge
    ... Since I'm using floating point, so I'll never be able to calculate one ... floating point math set to 99 digits. ... As close as I'm willing to wait if I use arbitrary precision. ... This mode is fast; when you select arbitry ...
    (comp.sys.hp48)
  • Re: Floating point environment
    ... In all functions like fetestexcept, for instance, it is assumed that there is only one floating point environment ... one for double precision ... the 64 bit format and another for the 80 bit format. ... All versions of SSE use a status/control word separate from the main FPU, however, so they can indeed be considered a separate environment. ...
    (comp.std.c)
  • Re: Precision
    ... It's the same if we use Precision, floating point, or ... positions it is IMPOSIBLE to have a result of 4 decimals with the 2 ... May be something wrong in the floating ... remember what the associated actuarial calculations were. ...
    (comp.databases.pick)
  • Re: Precision
    ... The something wrong is that floating point binary was used. ... It's the same if we use Precision, floating point, or ... positions it is IMPOSIBLE to have a result of 4 decimals with the 2 ... We do not use Galleons or Triganic Pus so all accounting uses decimal ...
    (comp.databases.pick)