(40 lines)
1 '\" t2 .\" Copyright (c) 2025 Bruce Hill3 .\" All rights reserved.4 .\"5 .TH Num.near 3 2025-11-29 "Tomo man-pages"6 .SH NAME7 Num.near \- check if two numbers are near each other8 .SH LIBRARY9 Tomo Standard Library10 .SH SYNOPSIS11 .nf12 .BI Num.near\ :\ func(x:\ Num,\ y:\ Num,\ ratio:\ Num\ =\ 1e-9,\ min_epsilon:\ Num\ =\ 1e-9\ ->\ Bool)13 .fi14 .SH DESCRIPTION15 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.18 .SH ARGUMENTS20 .TS21 allbox;22 lb lb lbx lb23 l l l l.24 Name Type Description Default25 x Num The first number. -26 y Num The second number. -27 ratio Num The relative tolerance. Default is \fB1e-9\fR. 1e-928 min_epsilon Num The absolute tolerance. Default is \fB1e-9\fR. 1e-929 .TE30 .SH RETURN31 `yes` if `x` and `y` are approximately equal within the specified tolerances, `no` otherwise.33 .SH EXAMPLES34 .EX35 assert (1.0).near(1.000000001) == yes36 assert (100.0).near(110, ratio=0.1) == yes37 assert (5.0).near(5.1, min_epsilon=0.1) == yes38 .EE39 .SH SEE ALSO40 .BR Tomo-Num (3)