Merge pull request #13890 from tschaub/math

Use Math.cosh and Math.log2
This commit is contained in:
Tim Schaub
2022-07-27 18:09:15 -06:00
committed by GitHub
5 changed files with 4 additions and 107 deletions

View File

@@ -2,10 +2,8 @@ import expect from '../expect.js';
import {
ceil,
clamp,
cosh,
floor,
lerp,
log2,
modulo,
round,
solveLinearSystem,
@@ -37,54 +35,6 @@ describe('ol/math.js', () => {
});
});
describe('cosh', function () {
it('returns the correct value at -Infinity', function () {
expect(cosh(-Infinity)).to.eql(Infinity);
});
it('returns the correct value at -1', function () {
expect(cosh(-1)).to.roughlyEqual(1.5430806348152437, 1e-9);
});
it('returns the correct value at 0', function () {
expect(cosh(0)).to.eql(1);
});
it('returns the correct value at 1', function () {
expect(cosh(1)).to.roughlyEqual(1.5430806348152437, 1e-9);
});
it('returns the correct value at Infinity', function () {
expect(cosh(Infinity)).to.eql(Infinity);
});
});
describe('log2', function () {
it('returns the correct value at Infinity', function () {
expect(log2(Infinity)).to.eql(Infinity);
});
it('returns the correct value at 3', function () {
expect(log2(3)).to.roughlyEqual(1.584962500721156, 1e-9);
});
it('returns the correct value at 2', function () {
expect(log2(2)).to.eql(1);
});
it('returns the correct value at 1', function () {
expect(log2(1)).to.eql(0);
});
it('returns the correct value at 0', function () {
expect(log2(0)).to.eql(-Infinity);
});
it('returns the correct value at -1', function () {
expect(log2(-1).toString()).to.eql('NaN');
});
});
describe('solveLinearSystem', function () {
it('calculates correctly', function () {
const result = solveLinearSystem([