Giter Club home page Giter Club logo

sml_biginteger's Introduction

SML_BigIntLibrary

Biginteger library for SML (Standard ML) for doing integer operations on arbitrarily large integers.

Operations supported

It allows following integer operations(in the parenthesis, the corresponding function names are given)

  • addition(add),
  • subtraction(sub),
  • multiplication(mul),
  • division(div4bigint),
  • mod(mod4bigint),
  • comparisons:
    • equal to?(eq)
    • not equal to?(neq)
    • less than?(lt)
    • less than or equal to?(leq)
    • greater than?(gt)
    • greater than or equal to?(geq)

Usage

  1. Copy biginteger.sml to the folder where lies the test sml file (call it test.sml).
  2. Include the following line at the beginning of test.sml: use "biginteger.sml";
  3. This library requires input in the form of string, instead of Integer (for the obvious reason that we want to do operations on integers of arbitrary length and int type of SML has a limit on its size). The string has to be converted to the biginteger type using str2bi function.
val a ="15" ;
val a_big = bigstruct.str2bi(a);
  1. Use any of the operations given in Operations supported like this:
val c_big = bigstruct.add(a_big,b_big);

where a_big and b_big are of biginteger type.

  1. Get back the string form from the biginteger form using bi2str function.
val c = bigstruct.bi2str(c_big);

Format of the input

All the functions take two biginteger as parameters. a $ b is equivalent to biginteger.operation(a,b) where operation is any of the operations given in Operations supported and $ is the symbol of operation. Note that a and b are of biginteger type. For example, to do a - b, do biginteger.sub(a,b)

Examples

All the examples are here.

sml_biginteger's People

Contributors

ankitshubham97 avatar

Watchers

 avatar  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.