@basic-math/subtract
v0.1.0
Published
Type-safe subtraction operation with SafeNumber validation
Maintainers
Readme
@basic-math/subtract
Type-safe subtraction operation with SafeNumber validation.
Installation
npm install @basic-math/subtract @basic-math/coreUsage
import { subtract } from '@basic-math/subtract';
const result = subtract(10, 3); // 7
const decimal = subtract(5.5, 2.2); // 3.3
const negative = subtract(3, 5); // -2Features
- Type-safe subtraction using SafeNumber
- Runtime validation
- Handles positive, negative, and decimal numbers
- Zero dependencies (except @basic-math/core)
API
subtract(a: number, b: number): number
Subtracts the second number from the first with validation.
Parameters:
a- Number to subtract fromb- Number to subtract
Returns: Difference of a and b
Throws: TypeViolationError or NumericInvariantError if inputs are invalid
License
MIT
