my ziglings
0

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request 'Fixed description to decimal and scientific notation' (#312) from i311 into main

Reviewed-on: https://codeberg.org/ziglings/exercises/pulls/312

Chris Boesch (Oct 17, 2025, 6:08 PM +0200) b72bcd7e b25f9bb6

+8 -7
+4 -3
exercises/060_floats.zig
··· 45 45 // conversion of 0.453592 kg to the pound. 46 46 const shuttle_weight: f16 = 0.453592 * 4480e3; 47 47 48 - // By default, float values are formatted in scientific 49 - // notation. Try experimenting with '{d}' and '{d:.3}' to see 50 - // how decimal formatting works. 48 + // By default, float values are formatted in standard decimal 49 + // notation. Experiment with '{d}' and '{d:.3}' to see how 50 + // decimal formatting works, or try '{e}' and '{e:.3}' for 51 + // scientific notation. 51 52 print("Shuttle liftoff weight: {d:.0} metric tons\n", .{shuttle_weight / 1e3}); 52 53 } 53 54
+4 -4
patches/patches/060_floats.patch
··· 1 - --- exercises/060_floats.zig 2025-10-03 13:28:03.092371247 +0200 2 - +++ answers/060_floats.zig 2025-10-03 13:27:40.842926774 +0200 1 + --- exercises/060_floats.zig 2025-10-17 17:58:44.811502880 +0200 2 + +++ answers/060_floats.zig 2025-10-17 17:57:39.227157388 +0200 3 3 @@ -43,7 +43,7 @@ 4 4 // 5 5 // We'll convert this weight from pounds to metric units at a ··· 7 7 - const shuttle_weight: f16 = 0.453592 * 4480e3; 8 8 + const shuttle_weight: f32 = 0.453592 * 4.480e6; 9 9 10 - // By default, float values are formatted in scientific 11 - // notation. Try experimenting with '{d}' and '{d:.3}' to see 10 + // By default, float values are formatted in standard decimal 11 + // notation. Experiment with '{d}' and '{d:.3}' to see how