sharkdp / numbat

A statically typed programming language for scientific computations with first class support for physical dimensions and units
https://numbat.dev
Apache License 2.0
1.01k stars 40 forks source link

Support more mathematical functions #144

Open sharkdp opened 10 months ago

sharkdp commented 10 months ago

Basic math

Float

Number theory

Combinatorics:

Bitwise?

Simple statistics

Statistics

Numerics:

Cryptography

sharkdp commented 10 months ago

gcd can now be implemented in Numbat itself:

fn gcd(a: Scalar, b: Scalar) -> Scalar =
  if b == 0
    then abs(a)
    else gcd(b, mod(a, b))

Similar for binomial_coefficient

sharkdp commented 10 months ago

see also: https://www.gnu.org/software/gsl/doc/html/intro.html

Benjamin-L commented 4 months ago

I'm interested in working on bit-wise operations

sharkdp commented 4 months ago

I'm interested in working on bit-wise operations

Sounds great. Note that we do not have proper integers at the moment. We basically just show floating point numbers as integers if they "look like one". I would definitely like to add support for different numeric types (floats, big/arbitrary-precision integers, potentially rationals, potentially complex numbers).

Just as a hint. We could still look into getting bit-wise operations working with what we have at the moment.

0-issue commented 3 months ago

@sharkdp Please support bitwise operations on standard rust integer types (instead of arbitrary precision ints). Currently there is no CLI tool that supports that in a clean way. The rationale is simple: people who deal with binary numbers (system programmers, etc) are generally interested in what machine computes (overflowed data) rather than what binary representation of arbitrary precision ints would look like. Your calculator is already the best among the ones I have tried for CLI, and this will be a great feature to have. Then we can play with bitwise binary operations from CLI!

Here's a list of signed and unsigned ints in Rust as you already know, though beginning with just the arch isize and usize should cover most of the ground.

Screenshot 2024-03-31 at 6 18 40 PM