|
Last change
on this file since 2058e5c was 2058e5c, checked in by istevanoska <ilinastevanoska@…>, 6 months ago |
|
Working / before login
|
-
Property mode
set to
100644
|
|
File size:
408 bytes
|
| Line | |
|---|
| 1 | /*
|
|---|
| 2 | Fraction.js v5.0.0 10/1/2024
|
|---|
| 3 | https://raw.org/article/rational-numbers-in-javascript/
|
|---|
| 4 |
|
|---|
| 5 | Copyright (c) 2024, Robert Eisele (https://raw.org/)
|
|---|
| 6 | Licensed under the MIT license.
|
|---|
| 7 | */
|
|---|
| 8 | const Fraction = require('fraction.js');
|
|---|
| 9 |
|
|---|
| 10 | function closestTapeMeasure(frac) {
|
|---|
| 11 |
|
|---|
| 12 | // A tape measure is usually divided in parts of 1/16
|
|---|
| 13 |
|
|---|
| 14 | return Fraction(frac).roundTo("1/16");
|
|---|
| 15 | }
|
|---|
| 16 | console.log(closestTapeMeasure("1/3")); // 5/16
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.