GithubHelp home page GithubHelp logo

rudxain / eso-math.rs Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 0.0 527 KB

(WIP) Esoteric Mathematic Library for Rust

radix lucas-numbers functions factorial polygonal-number bitwise factors factorization mersenne fibonacci bigint van-eck 3nplus1 number-theory recreational-mathematics

eso-math.rs's Introduction

EsoMath

Warning

I'll RIIR! You can find the JS in this branch

Most math libs are focused on arithmetic and algebra, and practical applications like cryptography. This lib is targeted at Pure Math, Number Theory, and recreational math.

eso-math.rs's People

Contributors

rudxain avatar

Stargazers

Benjamin Aster avatar Siddhesh Zantye avatar Mauro Bertani avatar

Watchers

Athan avatar  avatar

eso-math.rs's Issues

Focus on minimalism

I'm removing a lot of features, to make development easier, and to reduce redundancy (because other libraries already include those features)

Fix `toFraction` and make use of it

The function should return the smallest fraction that when converted to Number yields exactly the same value as the original input, but some inputs cause it to loop too many times and return a bogus fraction. After fixing the bug, I plan on using it in Math.gcd to preserve precision of computations, and Math.factorize to get negative exponents

Add missing step in `divisors`

There's missing multiplication and insertion at the end of the function. This step is required to include all even divisors and powers of 2

Add `modInv` and `egcd`

Add Modular Multiplicative Inverse, and Extended Euclidean Algorithm. modInv is useful to avoid wrong return values in Math.modPow

Fix `modpow` memory use

The IntN version has potential for avoidable out of memory errors when e < 2, while the Math version doesn't preserve precision when the exponent isn't an integer (there's no "modular multiplicative inverse" to correct this)

Add test files

Even if the tests will be ran manually, there must be a test file to increase code coverage. This is a serious library, no bugs should be allowed

Fix `isFinite` minor bug

There's wrong output when strings are large. This is a minor bug because the original/built-in also has it, so this has the lowest priority now

Use decorators

Decorators are functions that wrap other functions, essentially acting as functions that construct other functions. These are useful to apply common/shared behavior to many fns

Fix `IntN.parse` radix param precision loss

This has the lowest priority because radix is usually small (and should be), any absurdly large (2^53) BigInt or String value given to it is considered a misuse or an accident by the user or developer and I have no responsibility for that

Localize all vars

Prevents external code from changing the behavior of the library by modifying property values of global objects that some functions depend on. This means using aliases to objects, and copying primitive values

Test Workflow

This is a nice idea for automated testing, and would help to reach 100% code coverage. It's also a win-win situation for everyone using this lib and myself, since I won't need to install it on my system. lol I'm so lazy.

I'll activate the workflow after migrating everything to ESM format

Smarter min/max

It should return Number type only if it's a safe number, otherwise BigInt type, and only do that if there's multiple valid choices available

What should be the future of this library?

(More info at #2 )
I'm concerned about the future of this library because I want to take it seriously, but I feel like I don't know if the direction I'm going is a good goal.

This library started like my "Useless-Math" repo, just a bunch of functions lying around, and there was no clear direction to take. Then I realized what direction I wanted to take, I wanted this to be a polyfill. But polyfills are usually meant to be used in websites, and this library is definitely not a good idea to use in a website, but I already stated that in the README disclaimer. So now I'm wondering in what should this be focused on?

Name is not unique

The name NTML is already in use by an NPM package and by Microsoft. I should rename (again)

Add Dot Product?

This seems like a basic function to have, but I don't know if it should be added to this library

Add PowerSet?

I don't know if this should be implemented only on Set.prototype, or if I should also add it to Array.prototype, or maybe not add it at all. Is this actually useful in JS?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.