Skip to main content
Module

x/fun/ord.ts>sign

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Go to Latest
function sign
import { sign } from "https://deno.land/x/fun@v2.0.0-alpha.6/ord.ts";

Returns an Ordering from any number according to its relationship with 0.

Examples

Example 1

import { sign } from "./ord.ts";

const result1 = sign(-9586); // -1
const result2 = sign(-0.005); // -1
const result3 = sign(1000); // 1
const result4 = sign(Number.NEGATIVE_INFINITY); // -1
const result5 = sign(0); // 0

Parameters

n: number