1.0.3 • Published 9 years ago

sumi-math v1.0.3

Weekly downloads
3
License
-
Repository
github
Last release
9 years ago

sumi-math

A lightweight mathematics library as a replacement for the internal Math object.

Target environments

  • IE 6+
  • Latest Stable: Firefox, Chrome, Safari, Opera
  • Node.js & other non-browser environments or browser extensions

Quick start

Four quick start options are available:

Example use

Including in a browser:

<script type='text/javascript' src='/path/to/sumi-math-1.0.3.min.js'></script>
<script type='text/javascript'>
var x = Arith.parseFloat('xxx-123.3%xxx', true);  // x = -1.233
</script>

As a module that works with AMD(e.g., RequireJS):

define(['/path/to/sumi-math-1.0.3.min.js'], function(Arith) {
	var x = Arith.round(55.549, -2);   //  x = 55.55
});

Including in a CommonJS environment(e.g., Node.js):

var sumiMath = require('/path/to/sumi-math');
var x = sumiMath.toPercent(-0.123, 2);   // x = -12.30%

Build from source

First, you need to have Node.js and Grunt installed.

$ git clone git@github.com:rainersu/math.git
$ npm install -g grunt-cli
$ cd math
$ npm install
$ grunt

It provides compiled JS (sumi-math.*), as well as compiled and minified JS (sumi-math.min.*). JS source maps (sumi-math.*.map) are available for use with certain browsers' developer tools.

Running demos for testing

$ grunt test

Build & running documentation locally

$ grunt help

Sorry, the documentation is currently offered only in the Chinese language. Do you have time to help me with some Chinese - English translations?

How to contact me

Copyright and license

Copyright 2015 Rainer Su (苏昱).

Code and documentation is free to use under the MIT license.