
Security News
GitHub Actions Adds cache-mode to Limit Cache Poisoning Risk
GitHub Actions now supports cache-mode, a least-privilege control on the Actions cache aimed at the cache poisoning technique behind recent compromises.
utils for safe arithmetics around floating point numbers
SafeMaths provides utility function to carry out arithmetic operations such as multiplication, addition and subtraction
// addition
console.log(0.1 + 0.2) // 0.30000000000000004
console.log(safeAdd(0.1,0.2)) // 0.3 ✅
// subtraction
console.log(0.3 - 0.1) // 0.19999999999999998
console.log(safeSubtract(0.3,0.1)) // 0.2 ✅
// multiplication
console.log(0.1 * 0.4) // 0.04000000000000001
console.log(safeSubtract(0.1,0.4)) // 0.04 ✅
If any issue or bugs found while using SafeMaths do open an issue and report it there.
$ yarn add safe-maths
$ npm install safe-maths
Takes two numbers and 'safely' adds them.
Example
import { safeAdd } from "safe-maths";
console.log(0.1 + 0.7) // 0.7999999999999999
console.log(safeAdd(0.1,0.7)) // 0.8 ✅
Example
import { safeSubtract } from "safe-maths";
console.log(0.7 - 0.2) // 0.49999999999999994
console.log(safeAdd(0.7,0.2)) // 0.5 ✅
Takes two numbers and 'safely' multiplies them.
Example
import { safeMultiply } from "safe-maths";
console.log(0.1 * 0.7) // 0.06999999999999999
console.log(safeMultiply(0.1,0.7)) // 0.07 ✅
Returns the number of decimal places of a number. i.e 1 if 1dp, 2 if 2dp and so on.
Example
import { decimalCount } from "safe-maths";
console.log(decimalCount(0.1)) // 1
console.log(decimalCount(0.01)) // 2
console.log(decimalCount(0.001)) // 3
console.log(decimalCount(0.0001)) // 4
FAQs
Safe arithmetics around floating point numbers
The npm package safe-mts receives a total of 8 weekly downloads. As such, safe-mts popularity was classified as not popular.
We found that safe-mts demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.

Security News
GitHub Actions now supports cache-mode, a least-privilege control on the Actions cache aimed at the cache poisoning technique behind recent compromises.

Company News
Allow myself to introduce... myself.

Research
/Security News
A Twitch browser extension on Chrome and Firefox forwards users’ live OAuth session tokens through proxies controlled by a Russian bot service.