# @evojs/math

> Nodejs math extension

Latest version **0.5.0** (published 2025-06-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install @evojs/math
pnpm add @evojs/math
yarn add @evojs/math
bun add @evojs/math
```

## Health

**Score 30/100 (F)** — status: maintenance-mode.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.5.0 |
| Published | 2025-06-11 |
| First published | 2020-10-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 8.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Shamil Sultanov |
| Maintainers | aristocr2t |
| Keywords | nodejs, evojs, math |

## Links

- npm: https://www.npmjs.com/package/@evojs/math
- Repository: https://github.com/evotool/js-math
- Homepage: https://github.com/evotool/js-math#readme
- Issues: https://github.com/evotool/js-math/issues
- npm.io page: https://npm.io/package/@evojs/math

## Alternatives

- [random-seedable](https://npm.io/package/random-seedable.md) — 27.9K weekly downloads
- [n2words](https://npm.io/package/n2words.md) — 22.2K weekly downloads
- [@stdlib/math-base-special-factorialln](https://npm.io/package/@stdlib/math-base-special-factorialln.md) — 5.7K weekly downloads
- [@stdlib/math-base-special-abs2](https://npm.io/package/@stdlib/math-base-special-abs2.md) — 1.7K weekly downloads
- [commons-math-interpolation](https://npm.io/package/commons-math-interpolation.md) — 1.4K weekly downloads

## Recent versions

- 0.5.0 (latest) — 2025-06-11
- 0.4.0 — 2022-11-10
- 0.3.0 — 2022-01-20
- 0.1.0 — 2020-12-29
- 0.0.0 — 2020-10-11

## README

# @evojs/math

Math extension for nodejs

![@evojs/math npm version](https://img.shields.io/npm/v/@evojs/math.svg) ![supported node version for @evojs/math](https://img.shields.io/node/v/@evojs/math.svg) ![total npm downloads for @evojs/math](https://img.shields.io/npm/dt/@evojs/math.svg) ![monthly npm downloads for @evojs/math](https://img.shields.io/npm/dm/@evojs/math.svg) ![npm licence for @evojs/math](https://img.shields.io/npm/l/@evojs/math.svg)

## Usage example

```typescript
import { floor, round, ceil, degrees, radias, random, spha, sphd, addp, subp } from '@evojs/math';

// floor

console.log(floor(Math.E)); // 2.718281828459045 -> 2
console.log(floor(Math.E, 2)); // 2.718281828459045 -> 2.71

// round

console.log(round(Math.PI)); // 3.141592653589793 -> 4
console.log(round(Math.PI, 2)); // 3.141592653589793 -> 3.14

// ceil

console.log(ceil(1.00001, 2)); // 1.00001 -> 1.01
console.log(ceil(1.00001)); // 1.00001 -> 2

// degrees

console.log(degrees(Math.PI)); // 3.141592653589793 -> ~180

// radians

console.log(radians(180)); // 180 -> ~3.141592653589793

// random

console.log(random()); // random real [0, 1)
console.log(random(100)); // random integers [0, 100)
console.log(random(10, 100)); // random integers [10, 100)

// sphere angle

const locationA = { latitude: 0, longitude: 90 };
const locationB = { latitude: 90, longitude: 0 };

console.log(spha(locationA, locationB)); // 90 degrees

// sphere distance

const EARTH_RADIUS = 6371; // km

const locationA = { latitude: 55.797416, longitude: 49.111374 };
const locationB = { latitude: 55.795997, longitude: 49.127173 };

console.log(sphd(EARTH_RADIUS, locationA, locationB)); // ~1km

// add percent
console.log(addp(200, 20)); // 200 -> 240

// subtract percent
console.log(subp(300, 15)); // 300 -> 255
```

## License

Licensed under MIT license

---
_Source: https://npm.io/package/@evojs/math · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
