Math.exp.js 457 B

12345678910111213141516171819
  1. load("test-common.js");
  2. try {
  3. assert(Math.exp.length === 1);
  4. assert(Math.exp(0) === 1);
  5. assert(isClose(Math.exp(-2), 0.135335));
  6. assert(isClose(Math.exp(-1), 0.367879));
  7. assert(isClose(Math.exp(1), 2.718281));
  8. assert(isClose(Math.exp(2), 7.389056));
  9. assert(isNaN(Math.exp()));
  10. assert(isNaN(Math.exp(undefined)));
  11. assert(isNaN(Math.exp("foo")));
  12. console.log("PASS");
  13. } catch (e) {
  14. console.log("FAIL: " + e);
  15. }