Infinity: Difference between revisions
→{{header|Zig}}: Replace assertion with testing function, add missing types and checks (that were implemented since last change of Zig section), annotate versions.
m (→EasyLang) |
(→{{header|Zig}}: Replace assertion with testing function, add missing types and checks (that were implemented since last change of Zig section), annotate versions.) |
||
Line 1,650:
=={{header|Zig}}==
'''Works with:''' 0.12.0-dev.1502+b3462b7ce
<syntaxhighlight lang="zig">const std = @import("std");
const math = std.math;
test "infinity" {
const
const float_types = [_]type{ f16, f32, f64, f80, f128 };
inline for (float_types) |T| {
const infinite_value: T = comptime std.math.inf(T);
}
}</syntaxhighlight>
{{out}}
<pre>
$ zig test src/infinity_float.zig
All 1 tests passed.
</pre>
=={{header|zkl}}==
|