]> Lady’s Gitweb - Sutra/blob - xsd/operators.js
Add all X·S·D non‐auxillary functions
[Sutra] / xsd / operators.js
1 // ♓️🪡 सूत्र ∷ xsd/operators.js
2 // ====================================================================
3 //
4 // Copyright © 2023 Lady [@ Lady’s Computer].
5 //
6 // This Source Code Form is subject to the terms of the Mozilla Public
7 // License, v. 2.0. If a copy of the MPL was not distributed with this
8 // file, You can obtain one at <https://mozilla.org/MPL/2.0/>.
9
10 import { floor } from "../deps.js";
11
12 /**
13 * For the provided arguments m & n, the greatest integer less than or
14 * equal to m ∕ n.
15 *
16 * See <https://www.w3.org/TR/xmlschema11-2/#dt-div>.
17 */
18 export const div = (m, n) => floor(m / n);
19
20 /**
21 * For the provided arguments m & n, m − n × (m ·div· n).
22 *
23 * See <https://www.w3.org/TR/xmlschema11-2/#dt-mod>.
24 *
25 * ☡ This function may suffer from floating‐point rounding errors if
26 * the provided arguments are not integers.
27 */
28 export const mod = (m, n) => m - n * div(m, n);
This page took 0.089411 seconds and 5 git commands to generate.