File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Top Open diff view settings Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Top Open diff view settings Original file line number Diff line number Diff line change @@ -116,7 +116,7 @@ pub const Random = struct {
116116 pub fn floatNorm (r : * Random , comptime T : type ) T {
117117 const value = ziggurat .next_f64 (r , ziggurat .NormDist );
118118 switch (T ) {
119- f32 = > return f32 ( value ),
119+ f32 = > return @floatCast ( f32 , value ),
120120 f64 = > return value ,
121121 else = > @compileError ("unknown floating point type" ),
122122 }
@@ -128,7 +128,7 @@ pub const Random = struct {
128128 pub fn floatExp (r : * Random , comptime T : type ) T {
129129 const value = ziggurat .next_f64 (r , ziggurat .ExpDist );
130130 switch (T ) {
131- f32 = > return f32 ( value ),
131+ f32 = > return @floatCast ( f32 , value ),
132132 f64 = > return value ,
133133 else = > @compileError ("unknown floating point type" ),
134134 }
Original file line number Diff line number Diff line change @@ -84,12 +84,12 @@ fn ZigTableGen(
8484
8585 for (tables .x [2.. 256]) | * entry , i | {
8686 const last = tables .x [2 + i - 1 ];
87- * entry = f_inv (v / last + f (last ));
87+ entry .* = f_inv (v / last + f (last ));
8888 }
8989 tables .x [256 ] = 0 ;
9090
9191 for (tables .f [0.. ]) | * entry , i | {
92- * entry = f (tables .x [i ]);
92+ entry .* = f (tables .x [i ]);
9393 }
9494
9595 return tables ;
@@ -160,3 +160,7 @@ test "ziggurant exp dist sanity" {
160160 _ = prng .random .floatExp (f64 );
161161 }
162162}
163+
164+ test "ziggurat table gen" {
165+ const table = NormDist ;
166+ }
You can’t perform that action at this time.
0 commit comments