Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

infix-rationals

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

infix-rationals

Infix support for rationals

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

Installation

npm install infix-rationals infix rationals

This package ties together the rational number implementation in rationals and the infix arithmetic implementation in infix.

Functionality

Given ir = require('infix-rationals') and r = require('rationals'):

  • ir.numberProvider: This object works as a number provider for infix.

  • ir.evaluate: Use to evaluate arithmetic expressions with rational numbers, for example

     console.log(ir.evaluate("10/(2+3)").display());
     // `2` has now been logged
    
  • ir.compile: Use to compile arithmetic expressions, for example

     var f = ir.compile("10/($0+3)");
     f(r(1));
     f(r(1,2));
     f(r(3));
    
  • ir.memCompile: Use as compile above. This version caches the compiled version of all given expressions, it is memoizing.

This gives an overview of what is available. For further details, please see the documentation of both the infix and rationals packages.

Keywords

calculator

FAQs

Package last updated on 23 Mar 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts