55
66const std = @import ("std" );
77const math = std .math ;
8- const qnan128 = @bitCast (f128 , @as (u128 , 0x7fff800000000000 ) << 64 );
8+ const qnan128 = @as (f128 , @bitCast ( @ as (u128 , 0x7fff800000000000 ) << 64 ) );
99
1010const __addtf3 = @import ("addtf3.zig" ).__addtf3 ;
1111const __addxf3 = @import ("addxf3.zig" ).__addxf3 ;
@@ -14,9 +14,9 @@ const __subtf3 = @import("subtf3.zig").__subtf3;
1414fn test__addtf3 (a : f128 , b : f128 , expected_hi : u64 , expected_lo : u64 ) ! void {
1515 const x = __addtf3 (a , b );
1616
17- const rep = @bitCast (u128 , x );
18- const hi = @intCast (u64 , rep >> 64 );
19- const lo = @truncate (u64 , rep );
17+ const rep = @as (u128 , @bitCast ( x ) );
18+ const hi = @as (u64 , @intCast ( rep >> 64 ) );
19+ const lo = @as (u64 , @truncate ( rep ) );
2020
2121 if (hi == expected_hi and lo == expected_lo ) {
2222 return ;
@@ -37,7 +37,7 @@ test "addtf3" {
3737 try test__addtf3 (qnan128 , 0x1.23456789abcdefp+5 , 0x7fff800000000000 , 0x0 );
3838
3939 // NaN + any = NaN
40- try test__addtf3 (@bitCast (f128 , ( @as (u128 , 0x7fff000000000000 ) << 64 ) | @as (u128 , 0x800030000000 )), 0x1.23456789abcdefp+5 , 0x7fff800000000000 , 0x0 );
40+ try test__addtf3 (@as (f128 , @bitCast (( @as (u128 , 0x7fff000000000000 ) << 64 ) | @as (u128 , 0x800030000000 ) )), 0x1.23456789abcdefp+5 , 0x7fff800000000000 , 0x0 );
4141
4242 // inf + inf = inf
4343 try test__addtf3 (math .inf (f128 ), math .inf (f128 ), 0x7fff000000000000 , 0x0 );
@@ -53,9 +53,9 @@ test "addtf3" {
5353fn test__subtf3 (a : f128 , b : f128 , expected_hi : u64 , expected_lo : u64 ) ! void {
5454 const x = __subtf3 (a , b );
5555
56- const rep = @bitCast (u128 , x );
57- const hi = @intCast (u64 , rep >> 64 );
58- const lo = @truncate (u64 , rep );
56+ const rep = @as (u128 , @bitCast ( x ) );
57+ const hi = @as (u64 , @intCast ( rep >> 64 ) );
58+ const lo = @as (u64 , @truncate ( rep ) );
5959
6060 if (hi == expected_hi and lo == expected_lo ) {
6161 return ;
@@ -77,7 +77,7 @@ test "subtf3" {
7777 try test__subtf3 (qnan128 , 0x1.23456789abcdefp+5 , 0x7fff800000000000 , 0x0 );
7878
7979 // NaN + any = NaN
80- try test__subtf3 (@bitCast (f128 , ( @as (u128 , 0x7fff000000000000 ) << 64 ) | @as (u128 , 0x800030000000 )), 0x1.23456789abcdefp+5 , 0x7fff800000000000 , 0x0 );
80+ try test__subtf3 (@as (f128 , @bitCast (( @as (u128 , 0x7fff000000000000 ) << 64 ) | @as (u128 , 0x800030000000 ) )), 0x1.23456789abcdefp+5 , 0x7fff800000000000 , 0x0 );
8181
8282 // inf - any = inf
8383 try test__subtf3 (math .inf (f128 ), 0x1.23456789abcdefp+5 , 0x7fff000000000000 , 0x0 );
@@ -87,50 +87,50 @@ test "subtf3" {
8787 try test__subtf3 (0x1.ee9d7c52354a6936ab8d7654321fp-1 , 0x1.234567829a3bcdef5678ade36734p+5 , 0xc0041b8af1915166 , 0xa44a7bca780a166c );
8888}
8989
90- const qnan80 = @bitCast (f80 , @bitCast (u80 , math .nan (f80 )) | (1 << (math .floatFractionalBits (f80 ) - 1 )));
90+ const qnan80 = @as (f80 , @bitCast (@as ( u80 , @bitCast ( math .nan (f80 ))) | (1 << (math .floatFractionalBits (f80 ) - 1 ) )));
9191
9292fn test__addxf3 (a : f80 , b : f80 , expected : u80 ) ! void {
9393 const x = __addxf3 (a , b );
94- const rep = @bitCast (u80 , x );
94+ const rep = @as (u80 , @bitCast ( x ) );
9595
9696 if (rep == expected )
9797 return ;
9898
99- if (math .isNan (@bitCast (f80 , expected )) and math .isNan (x ))
99+ if (math .isNan (@as (f80 , @bitCast ( expected ) )) and math .isNan (x ))
100100 return ; // We don't currently test NaN payload propagation
101101
102102 return error .TestFailed ;
103103}
104104
105105test "addxf3" {
106106 // NaN + any = NaN
107- try test__addxf3 (qnan80 , 0x1.23456789abcdefp+5 , @bitCast (u80 , qnan80 ));
108- try test__addxf3 (@bitCast (f80 , @as (u80 , 0x7fff_8000_8000_3000_0000 )), 0x1.23456789abcdefp+5 , @bitCast (u80 , qnan80 ));
107+ try test__addxf3 (qnan80 , 0x1.23456789abcdefp+5 , @as (u80 , @bitCast ( qnan80 ) ));
108+ try test__addxf3 (@as (f80 , @bitCast ( @ as (u80 , 0x7fff_8000_8000_3000_0000 ))) , 0x1.23456789abcdefp+5 , @as (u80 , @bitCast ( qnan80 ) ));
109109
110110 // any + NaN = NaN
111- try test__addxf3 (0x1.23456789abcdefp+5 , qnan80 , @bitCast (u80 , qnan80 ));
112- try test__addxf3 (0x1.23456789abcdefp+5 , @bitCast (f80 , @as (u80 , 0x7fff_8000_8000_3000_0000 )), @bitCast (u80 , qnan80 ));
111+ try test__addxf3 (0x1.23456789abcdefp+5 , qnan80 , @as (u80 , @bitCast ( qnan80 ) ));
112+ try test__addxf3 (0x1.23456789abcdefp+5 , @as (f80 , @bitCast ( @ as (u80 , 0x7fff_8000_8000_3000_0000 ))) , @as (u80 , @bitCast ( qnan80 ) ));
113113
114114 // NaN + inf = NaN
115- try test__addxf3 (qnan80 , math .inf (f80 ), @bitCast (u80 , qnan80 ));
115+ try test__addxf3 (qnan80 , math .inf (f80 ), @as (u80 , @bitCast ( qnan80 ) ));
116116
117117 // inf + NaN = NaN
118- try test__addxf3 (math .inf (f80 ), qnan80 , @bitCast (u80 , qnan80 ));
118+ try test__addxf3 (math .inf (f80 ), qnan80 , @as (u80 , @bitCast ( qnan80 ) ));
119119
120120 // inf + inf = inf
121- try test__addxf3 (math .inf (f80 ), math .inf (f80 ), @bitCast (u80 , math .inf (f80 )));
121+ try test__addxf3 (math .inf (f80 ), math .inf (f80 ), @as (u80 , @bitCast ( math .inf (f80 ) )));
122122
123123 // inf + -inf = NaN
124- try test__addxf3 (math .inf (f80 ), - math .inf (f80 ), @bitCast (u80 , qnan80 ));
124+ try test__addxf3 (math .inf (f80 ), - math .inf (f80 ), @as (u80 , @bitCast ( qnan80 ) ));
125125
126126 // -inf + inf = NaN
127- try test__addxf3 (- math .inf (f80 ), math .inf (f80 ), @bitCast (u80 , qnan80 ));
127+ try test__addxf3 (- math .inf (f80 ), math .inf (f80 ), @as (u80 , @bitCast ( qnan80 ) ));
128128
129129 // inf + any = inf
130- try test__addxf3 (math .inf (f80 ), 0x1.2335653452436234723489432abcdefp+5 , @bitCast (u80 , math .inf (f80 )));
130+ try test__addxf3 (math .inf (f80 ), 0x1.2335653452436234723489432abcdefp+5 , @as (u80 , @bitCast ( math .inf (f80 ) )));
131131
132132 // any + inf = inf
133- try test__addxf3 (0x1.2335653452436234723489432abcdefp+5 , math .inf (f80 ), @bitCast (u80 , math .inf (f80 )));
133+ try test__addxf3 (0x1.2335653452436234723489432abcdefp+5 , math .inf (f80 ), @as (u80 , @bitCast ( math .inf (f80 ) )));
134134
135135 // any + any
136136 try test__addxf3 (0x1.23456789abcdp+5 , 0x1.dcba987654321p+5 , 0x4005_BFFFFFFFFFFFC400 );
0 commit comments