W3Cschool
恭喜您成為首批注冊用戶
獲得88經驗值獎勵
Math 對象是擁有一些命名屬性的單一對象,其中一些屬性值是函數(shù)。
Math 對象的 [[Prototype]] 內部屬性值是標準內置 Object 原型對象 (15.2.4)。Math 對象的 [[Class]] 內部屬性值是 "Math"。
Math 對象沒有 [[Construct]] 內部屬性 ; Math 對象不能作為構造器被 new 運算符調用。
Math 對象沒有 [[Call]] 內部屬性;Math 對象不能作為函數(shù)被調用。
本規(guī)范中,短語“x 的數(shù)字值”的技術含義定義在 8.5。
自然對數(shù)的底數(shù) e 的數(shù)字值,約為 2.7182818284590452354。
此屬性有特性 { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false } 。
10 的自然對數(shù)的數(shù)字值,約為 2.302585092994046。
此屬性有特性 { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false } 。
2 的自然對數(shù)的數(shù)字值,約為 0.6931471805599453。
此屬性有特性 { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false } 。
自然對數(shù)的底數(shù) e 的以 2 為底數(shù)的對數(shù)的數(shù)字值;約為 1.4426950408889634。
此屬性有特性 { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false } 。
Math.LOG2E 的值約為 Math.LN2 值的倒數(shù)。
自然對數(shù)的底數(shù) e 的以 10 為底數(shù)的對數(shù)的數(shù)字值;約為 0.4342944819032518。
此屬性有特性 { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false } 。
Math.LOG10E 的值約為 Math.LN10 值的倒數(shù)。
圓的周長與直徑之比π的數(shù)字值,約為 3.1415926535897932。
此屬性有特性 { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false } 。
? 的平方根的數(shù)字值,約為 0.7071067811865476。
此屬性有特性 { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false } 。
Math.SQRT1_2 的值約為 Math.SQRT2 值的倒數(shù)。
2 的平方根的數(shù)字值,約為 1.4142135623730951。
此屬性有特性 { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false } 。
對以下每個 Math 對象函數(shù)的每個參數(shù)(如果有多個,以左到右的順序)應用 ToNumber 抽象操作,然后對結果數(shù)字值執(zhí)行計算。
下面對函數(shù)的描述中,符號 NaN, ?0, +0, ?∞, +∞ 指 8.5 描述的數(shù)字值。
這里沒有精確規(guī)定函數(shù) acos, asin, atan, atan2, cos, exp, log, pow, sin, sqrt 的行為,除了需要特別說明對邊界情況某些參數(shù)值的結果之外。對其他參數(shù)值,這些函數(shù)旨在計算計算常見數(shù)學函數(shù)的結果,但選擇的近似算法中的某些范圍是被允許的。The general intent is that an implementer should be able to use the same mathematical library for ECMAScript on a given hardware platform that is available to C programmers on that platform.
Although the choice of algorithms is left to the implementation, it is recommended (but not specified by this standard) that implementations use the approximation algorithms for IEEE 754 arithmetic contained in fdlibm, the freely distributable mathematical library from Sun Microsystems (http://www.netlib.org/fdlibm).
返回 x 的絕對值。
返回 x 的反余弦的依賴實現(xiàn)的近似值。結果以弧度形式表示,范圍是 +0 到 +π。
返回 x 的反正弦的依賴實現(xiàn)的近似值。結果以弧度形式表示,范圍是?π/2 到 +π/2。
返回 x 的反正切的依賴實現(xiàn)的近似值。結果以弧度形式表示,范圍是?π/2 到 +π/2。
返回 -- 參數(shù) y 和 x 的商 y/x-- 的反正切的依賴實現(xiàn)的近似值,y 和 x 的符號用于確定返回值的象限。注:命名為 y 的參數(shù)為第一個,命名為 x 的參數(shù)為第二個,這是有意,是反正切函數(shù)倆參數(shù)的慣例。結果以弧度形式表示,范圍是?π到 +π。
返回不小于 x 的且為數(shù)學整數(shù)的最小 ( 接近?∞) 數(shù)字值。如果 x 已是整數(shù),則返回 x。
Math.ceil(x) 的值與 -Math.floor(-x) 的值相同。
返回 x 的余弦的依賴實現(xiàn)的近似值。參數(shù)被當做是弧度值。
返回 x 的指數(shù)的依賴實現(xiàn)的近似值(e 為 x 次方,e 為自然對數(shù)的底)。
返回不大于 x 的且為數(shù)學整數(shù)的最大 ( 接近 +∞) 數(shù)字值。如果 x 已是整數(shù),則返回 x。
Math.floor(x) 的值與 -Math.ceil(-x) 的值相同。
返回 x 的自然對數(shù)的依賴于實現(xiàn)的近似值 .
給定零或多個參數(shù),對每個參數(shù)調用 ToNumber 并返回調用結果里的最大值。
max 方法的 length 屬性是 2。
給定零或多個參數(shù),對每個參數(shù)調用 ToNumber 并返回調用結果里的最小值。
min 方法的 length 屬性是 2。
返回 x 的 y 次方的依賴于實現(xiàn)的近似值 .
返回一個大于或等于 0 但小于 1 的符號為正的數(shù)字值,選擇隨機或在該范圍內近似均勻分布的偽隨機,用一個依賴與實現(xiàn)的算法或策略。此函數(shù)不需要參數(shù)。
返回最接近 x 且為數(shù)學整數(shù)的數(shù)字值。如果兩個整數(shù)同等接近 x,則結果是接近 +∞的數(shù)字值 。如果 x 已是整數(shù),則返回 x。
Math.round(3.5) 返回 4, 但 Math.round(–3.5) 返回 –3.
當 x 為 ?0 或 x 小于 0 當大于大于等于 -0.5 時,Math.round(x) 返回 ?0, 但 Math.floor(x+0.5) 返回 +0,除了這種情況之外 Math.round(x) 的返回值與 Math.floor(x+0.5) 的返回值相同。
返回 x 的正弦的依賴實現(xiàn)的近似值。參數(shù)被當做是弧度值。
返回 x 的平方根的依賴實現(xiàn)的近似值。
返回 x 的正切的依賴實現(xiàn)的近似值。參數(shù)被當做是弧度值。
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: