JSONSchex.Compiler.Predicates.MultipleOf (jsonschex v0.7.0)

Copy Markdown View Source

Validates numbers against the JSON Schema multipleOf rule. Handles arbitrary precision if Decimal is available. Falls back to native arithmetic with overflow protection if not.

Summary

Functions

Checks if instance is a multiple of divisor. Uses Decimal for high precision.

Functions

valid?(instance, divisor)

@spec valid?(number() | String.t() | Decimal.t(), number() | String.t() | Decimal.t()) ::
  boolean()

Checks if instance is a multiple of divisor. Uses Decimal for high precision.