View Source Plox.NumberScale (Plox v0.1.0)

An arbitrary precision number scale

This struct implements the Plox.Scale protocol.

Although internally we use Decimal for arbitrary precision and accurate math, this scale expects floats as input and produces floats as output, so there's still some room for floating point imprecision.

Summary

Types

@type t() :: %Plox.NumberScale{backwards?: term(), first: term(), last: term()}

Functions

@spec new(first :: number(), last :: number()) :: t()

Creates a new Plox.NumberScale struct

Accepts 2 numbers as first and last as well as the number of ticks that should comprise the scale. The in-between values for these ticks are dynamically calculated based on first, last, and ticks.

ticks must be at least 2.