'\" t .\" Copyright (c) 2025 Bruce Hill .\" All rights reserved. .\" .TH Num.near 3 2025-09-21 "Tomo man-pages" .SH NAME Num.near \- check if two numbers are near each other .SH LIBRARY Tomo Standard Library .SH SYNOPSIS .nf .BI Num.near\ :\ func(x:\ Num,\ y:\ Num,\ ratio:\ Num\ =\ 1e-9,\ min_epsilon:\ Num\ =\ 1e-9\ ->\ Bool) .fi .SH DESCRIPTION Checks if two numbers are approximately equal within specified tolerances. If two numbers are within an absolute difference or the ratio between the two is small enough, they are considered near each other. .SH ARGUMENTS .TS allbox; lb lb lbx lb l l l l. Name Type Description Default x Num The first number. - y Num The second number. - ratio Num The relative tolerance. Default is `1e-9`. 1e-9 min_epsilon Num The absolute tolerance. Default is `1e-9`. 1e-9 .TE .SH RETURN `yes` if `x` and `y` are approximately equal within the specified tolerances, `no` otherwise. .SH EXAMPLES .EX assert (1.0).near(1.000000001) == yes assert (100.0).near(110, ratio=0.1) == yes assert (5.0).near(5.1, min_epsilon=0.1) == yes .EE