Re: [dev] suckless bignum library

From: FRIGN <dev_AT_frign.de>
Date: Thu, 10 Dec 2015 18:57:54 +0100

On Thu, 10 Dec 2015 09:41:21 -0800
Evan Gates <evan.gates_AT_gmail.com> wrote:

Hey Evan,

> The problem with that is bc can't use a normal bignum library and be
> POSIX compliant as all the internal math is required to be in base 10.
> "Internal computations shall be conducted as if in decimal, regardless
> of the input and output bases, to the specified number of decimal
> digits."[0] That's why implementations of bc tend to have their own
> arbitrary precision stuff built in.

What does the base have to do with the results?
 
> That being said a suckless bignum library can still be very useful,
> and sbase tends to stray from POSIX in a few places. This may be one
> such place that makes sense to ignore POSIX. For bc we need simple
> arithmetic, sqrt, integer exponents, sine, cosine, arctangent, natural
> log, exponential function, Bessel function of integer order, and a way
> to work with the bc concept of scale.[0] Depending on your performance
> desires many those can either be implemented in the library or in bc
> using a simpler library.
> One last off topic question, should sbase have a bc that calculates,
> or just translates to dc (which is not a POSIX tool, but probably
> useful to have in sbase).

To be honest, I'd go for implementing dc(1) and using the normal bc(1)
based on dc(1). RPN is also easier to implement.

Cheers

FRIGN

-- 
FRIGN <dev_AT_frign.de>
Received on Thu Dec 10 2015 - 18:57:54 CET

This archive was generated by hypermail 2.3.0 : Thu Dec 10 2015 - 19:00:16 CET