module Bottle::Internal::Comparison

Extended Modules

Defined in:

util/testing.cr

Instance Method Summary

Instance Method Detail

def allclose(a : BaseArray(U), b : BaseArray(U), rtol = 1e-5, atol = 1e-8) forall U #

Asserts that two equally shaped Tensors are equal within a provided tolerance. Useful for floating point comparison where direct equality might not work

t = Tensor.new([2, 2, 3]) { |i| i * 1.0 }
tf = t + 0.00000000001
allclose(t, tf) # => true

[View source]