Skip to content
Snippets Groups Projects
Commit b698c8b3 authored by Mike Pennisi's avatar Mike Pennisi Committed by Leonardo Balter
Browse files

Add tests for Math constants

Closes gh-540

Because the specific value of each constant is specified as a
host-defined approximation, only the value type may be enforced by
Test262.
parent f7aa31b4
No related branches found
No related tags found
No related merge requests found
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Math.E is a numeric value
esid: sec-math.e
es6id: 20.2.1.1
info: >
The Number value for e, the base of the natural logarithms, which is
approximately 2.7182818284590452354.
The precision of this approximation is host-defined.
---*/
assert.sameValue(typeof Math.E, 'number');
assert.notSameValue(Math.E, NaN);
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Math.LN10 is a numeric value
esid: sec-math.ln10
es6id: 20.2.1.2
info: >
The Number value for the natural logarithm of 10, which is approximately
2.302585092994046.
The precision of this approximation is host-defined.
---*/
assert.sameValue(typeof Math.LN10, 'number');
assert.notSameValue(Math.LN10, NaN);
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Math.LN2 is a numeric value
esid: sec-math.ln2
es6id: 20.2.1.3
info: >
The Number value for the natural logarithm of 2, which is approximately
0.6931471805599453.
The precision of this approximation is host-defined.
---*/
assert.sameValue(typeof Math.LN2, 'number');
assert.notSameValue(Math.LN2, NaN);
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Math.LOG10E is a numeric value
esid: sec-math.log10e
es6id: 20.2.1.4
info: >
The Number value for the base-10 logarithm of e, the base of the natural
logarithms; this value is approximately 0.4342944819032518.
The precision of this approximation is host-defined.
---*/
assert.sameValue(typeof Math.LOG10E, 'number');
assert.notSameValue(Math.LOG10E, NaN);
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Math.LOG2E is a numeric value
esid: sec-math.log2e
es6id: 20.2.1.5
info: >
The Number value for the base-2 logarithm of e, the base of the natural
logarithms; this value is approximately 1.4426950408889634.
The precision of this approximation is host-defined.
---*/
assert.sameValue(typeof Math.LOG2E, 'number');
assert.notSameValue(Math.LOG2E, NaN);
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Math.PI is a numeric value
esid: sec-math.pi
es6id: 20.2.1.6
info: >
The Number value for pi, the ratio of the circumference of a circle to its
diameter, which is approximately 3.1415926535897932.
The precision of this approximation is host-defined.
---*/
assert.sameValue(typeof Math.PI, 'number');
assert.notSameValue(Math.PI, NaN);
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Math.SQRT1_2 is a numeric value
esid: sec-math.sqrt1_2
es6id: 20.2.1.7
info: >
The Number value for the square root of `1/2`, which is approximately
0.7071067811865476.
The precision of this approximation is host-defined.
---*/
assert.sameValue(typeof Math.SQRT1_2, 'number');
assert.notSameValue(Math.SQRT1_2, NaN);
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Math.SQRT2 is a numeric value
esid: sec-math.sqrt2
es6id: 20.2.1.8
info: >
The Number value for the square root of 2, which is approximately
1.4142135623730951.
The precision of this approximation is host-defined.
---*/
assert.sameValue(typeof Math.SQRT2, 'number');
assert.notSameValue(Math.SQRT2, NaN);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment