mirror of
https://github.com/ziglang/zig.git
synced 2024-12-03 18:38:45 +00:00
5619ce2406
Conflicts: * doc/langref.html.in * lib/std/enums.zig * lib/std/fmt.zig * lib/std/hash/auto_hash.zig * lib/std/math.zig * lib/std/mem.zig * lib/std/meta.zig * test/behavior/alignof.zig * test/behavior/bitcast.zig * test/behavior/bugs/1421.zig * test/behavior/cast.zig * test/behavior/ptrcast.zig * test/behavior/type_info.zig * test/behavior/vector.zig Master branch added `try` to a bunch of testing function calls, and some lines also had changed how to refer to the native architecture and other `@import("builtin")` stuff.
35 lines
758 B
Zig
35 lines
758 B
Zig
const expect = @import("std").testing.expect;
|
|
|
|
test "@mulAdd" {
|
|
comptime try testMulAdd();
|
|
try testMulAdd();
|
|
}
|
|
|
|
fn testMulAdd() !void {
|
|
{
|
|
var a: f16 = 5.5;
|
|
var b: f16 = 2.5;
|
|
var c: f16 = 6.25;
|
|
try expect(@mulAdd(f16, a, b, c) == 20);
|
|
}
|
|
{
|
|
var a: f32 = 5.5;
|
|
var b: f32 = 2.5;
|
|
var c: f32 = 6.25;
|
|
try expect(@mulAdd(f32, a, b, c) == 20);
|
|
}
|
|
{
|
|
var a: f64 = 5.5;
|
|
var b: f64 = 2.5;
|
|
var c: f64 = 6.25;
|
|
try expect(@mulAdd(f64, a, b, c) == 20);
|
|
}
|
|
// Awaits implementation in libm.zig
|
|
//{
|
|
// var a: f16 = 5.5;
|
|
// var b: f128 = 2.5;
|
|
// var c: f128 = 6.25;
|
|
//try expect(@mulAdd(f128, a, b, c) == 20);
|
|
//}
|
|
}
|