Giter VIP home page Giter VIP logo

bignum's Introduction

BigNum - Arbitrarily precise math and numbers.

BigNum is a library to create and calculate numbers of arbitrary size and precision.

Why? Doesn't Go have big already?

This is mostly a learning experiment for me and is not currently ready to be used for anything mission critical. The goal was to try and make my implementation of strtod more accurate as the exponent gets further from 0. I plan to port this to C and potentially other langauges in the future.

Simple(-ish)

As this is a learning experiment for me, I tried to keep things (relatively) simple. Each operation is also not optimized and their implementations are mainly based on grade school math. Almost all operations also create new objects for the results instead of performing the operation in place, which could consume more memory but is easier to implement for now.

Each digit of BigInt is a base-256 number represented by a single byte. In the future, this could potentially be extrapolated to use base-4294967296 (32-bits per digit) or base-18446744073709551616 (64-bits per digit). For now it is easier to compare multiple bytes against native 32/64-bit numbers for testing.

What is complete and what is there to do

(✅ Completed, ❌ To do)

BigInt

  • + Addition
  • - Subtraction
  • * Multiplication
  • / Division
  • >>/<< Bit shifting
  • ==/</> Comparison
  • ❌ Exponents
  • ❌ Roots
  • ❌ Logorithms

BigFloat (TBD)

  • + Addition
  • - Subtraction
  • * Multiplication
  • / Division
  • >>/<< Bit shifting
  • ==/</> Comparison
  • ❌ Exponents
  • ❌ Roots
  • ❌ Logorithms

bignum's People

Contributors

crazyinfin8 avatar

Watchers

 avatar

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.