How to use the @mathigon/fermat.round function in @mathigon/fermat

To help you get started, we’ve selected a few @mathigon/fermat examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mathigon / textbooks / triangles-and-trigonometry / functions.js View on Github external
  const getLength = (x) => round(x/36, 1);
  const intersects = () => model.intersections(circles[0].val, circles[1].val);
github mathigon / textbooks / content / triangles-and-trigonometry / functions.js View on Github external
  const getLength = (x) => round(x/36, 1);
  const intersects = () => model.intersections(circles[0].val, circles[1].val);
github mathigon / textbooks / content / linear-functions / components / numberline.js View on Github external
function update() {
      const px = slider.position.x;
      const x = round(MIN + (px / width) * (MAX - MIN), 1);

      const y = round(F(x), 1);
      const py = (y - MIN) / (MAX - MIN) * width;

      $slider.text = x;
      $output.text = y;
      $output.css('left', py + 'px');
      $output.css('display', (y < MIN || y > MAX) ? 'none' : 'block');
      $connection.setAttr('d', `M ${px} 0 C ${px} 40, ${py} 20, ${py} 60`);
    }
github mathigon / textbooks / content / linear-functions / components / numberline.js View on Github external
function makeTickmarks(min, max, major, minor, generate) {
  for (let i = min; i <= max; i += minor) {
    i = round(i, 3);
    generate(i, nearlyEquals(i % major, 0));
  }
}
github mathigon / textbooks / triangles-and-trigonometry / functions.js View on Github external
  const sqrtDistance = p => round(Math.sqrt(square(p.x) + square(17 - p.y)), 3);
  $step.model.set('sqrtDistance', sqrtDistance);
github mathigon / textbooks / content / circles / functions.ts View on Github external
$step.model.set('rad', (r: number) => {
    const a = r / Math.PI;
    return a > 1.99 ? 2 : round(a, 2);
  });
github mathigon / textbooks / content / triangles-and-trigonometry / functions.js View on Github external
    $geopad.waitForPath(path => (round(path.val.r/36, 1) === 5 &&
        path.points[0] === base.points.filter(p => p !== circle1.points[0])[0])),
    (path) => {
github mathigon / textbooks / content / linear-functions / components / numberline.js View on Github external
function update() {
      const px = slider.position.x;
      const x = round(MIN + (px / width) * (MAX - MIN), 1);

      const y = round(F(x), 1);
      const py = (y - MIN) / (MAX - MIN) * width;

      $slider.text = x;
      $output.text = y;
      $output.css('left', py + 'px');
      $output.css('display', (y < MIN || y > MAX) ? 'none' : 'block');
      $connection.setAttr('d', `M ${px} 0 C ${px} 40, ${py} 20, ${py} 60`);
    }
github mathigon / textbooks / content / sequences / functions.ts View on Github external
$slider.on('move', (x) => {
    for (let i = 0; i < COUNT; ++i) {
      let t = i * Math.PI * 2 * x / $slider.steps;
      let r = Math.sqrt(i) / Math.sqrt(COUNT) * 196;
      $circles[i].setCenter({
        x: 200 + r * Math.cos(t),
        y: 200 + r * Math.sin(t)
      });
    }
    $value.text = `${round(x / 1000 * 360, 1)}° (${x / 1000} rotations)`;
  });