JavaScript Math Methods
45 entries covering every static method and constant on the JavaScript Math object, from arithmetic helpers like Math.abs() and Math.pow() to trigonometric functions, logarithms, hyperbolic functions, rounding methods, and the eight built-in mathematical constants such as Math.PI and Math.E.
Quick fetch
Stable URL. CORS-enabled. No auth.
curl https://staticdata.dev/v1/js-math-methods.json
Or use as a typed import:
import { jsMathMethods } from "https://staticdata.dev/v1/js-math-methods.ts"
Formats
- JSON 7.5 KB
/v1/js-math-methods.json
min: 6.4 KB · /v1/js-math-methods.min.json
- CSV 4.7 KB
/v1/js-math-methods.csv
- TypeScript 7.7 KB
/v1/js-math-methods.ts
export const jsMathMethods
type MathMethod = (typeof jsMathMethods)[number]
Schema
Each record in the dataset has the following shape.
| Field | Type | Description | Example |
|---|---|---|---|
| name | string | Full name of the Math property or method | Math.abs() |
| signature | string | Call signature including parameter names | Math.abs(x) |
| description | string | Concise description of behavior and return value | Returns the absolute value of x. |
Preview
First 10 records.
| name | signature | description |
|---|---|---|
| Math.E | Math.E | Euler's number and the base of natural logarithms; approximately 2.718. |
| Math.LN2 | Math.LN2 | Natural logarithm of 2; approximately 0.693. |
| Math.LN10 | Math.LN10 | Natural logarithm of 10; approximately 2.303. |
| Math.LOG2E | Math.LOG2E | Base-2 logarithm of E; approximately 1.443. |
| Math.LOG10E | Math.LOG10E | Base-10 logarithm of E; approximately 0.434. |
| Math.PI | Math.PI | Ratio of the circumference of a circle to its diameter; approximately 3.14159. |
| Math.SQRT1_2 | Math.SQRT1_2 | Square root of 1/2 (equivalently, 1 over the square root of 2); approximately 0.707. |
| Math.SQRT2 | Math.SQRT2 | Square root of 2; approximately 1.414. |
| Math.abs() | Math.abs(x) | Returns the absolute value of x. Returns NaN if x is NaN; returns 0 for -0. |
| Math.acos() | Math.acos(x) | Returns the arccosine (in radians) of x, for x in the range [-1, 1]. Returns NaN if x is outside that range. |
Fetch examples
Drop-in snippets in five languages.
curl -sSL https://staticdata.dev/v1/js-math-methods.json | jq '.[0]' import type { MathMethod } from "https://staticdata.dev/v1/js-math-methods.ts";
const res = await fetch("https://staticdata.dev/v1/js-math-methods.min.json");
if (!res.ok) throw new Error(`Fetch failed: ${res.status}`);
const jsMathMethods: MathMethod[] = await res.json();
console.log(jsMathMethods[0]); import urllib.request, json
with urllib.request.urlopen("https://staticdata.dev/v1/js-math-methods.min.json") as r:
jsMathMethods = json.load(r)
print(jsMathMethods[0]) package main
import (
"encoding/json"
"fmt"
"net/http"
)
func main() {
resp, err := http.Get("https://staticdata.dev/v1/js-math-methods.min.json")
if err != nil { panic(err) }
defer resp.Body.Close()
var data []map[string]any
if err := json.NewDecoder(resp.Body).Decode(&data); err != nil {
panic(err)
}
fmt.Println(data[0])
} use serde_json::Value;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let body = ureq::get("https://staticdata.dev/v1/js-math-methods.min.json").call()?.into_string()?;
let data: Vec<Value> = serde_json::from_str(&body)?;
println!("{:?}", data.first());
Ok(())
} Sources and methodology
The dataset is curated from the MDN Web Docs Math reference, which documents the built-in Math object available in all JavaScript environments. The Math object is not a constructor; all properties and methods are accessed as static members (e.g., Math.sqrt(4)). The eight mathematical constants (Math.E, Math.LN2, Math.LN10, Math.LOG2E, Math.LOG10E, Math.PI, Math.SQRT1_2, Math.SQRT2) are included alongside all static methods.
Method signatures follow the same convention used by MDN: parameter names reflect intent (x for a single numeric input, y, x for the two-argument atan2, ...values for variadic methods). Descriptions include edge-case behavior (NaN propagation, ±Infinity results, domain restrictions) so consumers can use the data to generate accurate documentation or developer tooling.
The dataset includes two recent additions: Math.f16round() (ES2025), which mirrors Math.fround() but targets 16-bit half-precision floats, and Math.sumPrecise() (ES2026), which sums an iterable as if with exact arithmetic and rounds once. As of October 2026, Math.sumPrecise() is not yet available in every engine (it is missing from Node.js 26.0, for example). Implementations that target older environments should filter these entries by cross-referencing a compatibility table.
Versioning
URLs under /v1/ are stable: field names and types will not change in a way
that breaks consumers. Values can be corrected or records added when the upstream source
changes; schema-incompatible updates ship under a new version path. See the
js-math-methods changelog for this dataset's history.
More Code datasets
- ansi-colors
- ascii
- cron-presets
- css-at-rules
- css-functions
- css-named-colors
- css-properties
- css-pseudo-classes
- css-pseudo-elements
- css-units
- data-units
- exit-codes
- file-signatures
- hash-algorithms
- js-array-methods
- js-object-methods
- js-string-methods
- json-schema-keywords
- jwt-claims
- mathematical-constants
- measurement-units
- node-builtin-modules
- owasp-top-10
- periodic-table
- physical-constants
- posix-signals
- programming-languages
- regex-flags
- regex-patterns
- roman-numerals
- si-base-units
- si-derived-units
- si-prefixes
- spdx-licenses
- strftime-tokens
- tailwind-colors
- time-units
- unicode-blocks
- unicode-general-categories
- unicode-planes
- unix-file-permissions
- xterm-256-colors