MCPcopy Create free account
hub / github.com/Effect-TS/effect / roundTiesAwayFromZero

Function roundTiesAwayFromZero

packages/effect/src/Duration.ts:38–39  ·  view source on GitHub ↗
(input: number)

Source from the content-addressed store, hash-verified

36const bigint1e9 = BigInt(1_000_000_000)
37
38const roundTiesAwayFromZero = (input: number): bigint =>
39 BigInt(input < 0 ? Math.ceil(input - 0.5) : Math.floor(input + 0.5))
40
41const roundMillisToNanos = (millis: number): bigint => roundTiesAwayFromZero(millis * 1_000_000)
42

Callers 3

roundMillisToNanosFunction · 0.85
fromInputUnsafeFunction · 0.85
[Hash.symbol]Function · 0.85

Calls 1

BigIntInterface · 0.70

Tested by

no test coverage detected