Jump to content

Test integerness: Difference between revisions

m
Line 1,681:
=={{header|Nim}}==
a taxonomy of Nim number types:
 
SomeInteger: integer types, signed or unsigned, 8,16,32,or 64 bits
 
SomeFloat: floating point, 32 or 64 bits
 
SomeNumber: SomeInteger or SomeFloat
 
Rational: rational type; a numerator and denominator, of any (identical) SomeInteger type
 
Complex: complex type; real and imaginary of any (identical) SomeFloat type
 
<lang nim>import complex, rationals, math, fenv, sugar
func is_integer[T:Complex | Rational | SomeNumber](x: T, tolerance: float64 = 0.0): bool =
Cookies help us deliver our services. By using our services, you agree to our use of cookies.