From 837e6aba3bc22aaf0f56c642310366956e52dce4 Mon Sep 17 00:00:00 2001 From: Chris Boesch Date: Fri, 17 Oct 2025 17:59:57 +0200 Subject: [PATCH] Fixed description to decimal and scientific notation --- exercises/060_floats.zig | 7 ++++--- patches/patches/060_floats.patch | 8 ++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/exercises/060_floats.zig b/exercises/060_floats.zig index ed63bb1..90da930 100644 --- a/exercises/060_floats.zig +++ b/exercises/060_floats.zig @@ -45,9 +45,10 @@ pub fn main() void { // conversion of 0.453592 kg to the pound. const shuttle_weight: f16 = 0.453592 * 4480e3; - // By default, float values are formatted in scientific - // notation. Try experimenting with '{d}' and '{d:.3}' to see - // how decimal formatting works. + // By default, float values are formatted in standard decimal + // notation. Experiment with '{d}' and '{d:.3}' to see how + // decimal formatting works, or try '{e}' and '{e:.3}' for + // scientific notation. print("Shuttle liftoff weight: {d:.0} metric tons\n", .{shuttle_weight / 1e3}); } diff --git a/patches/patches/060_floats.patch b/patches/patches/060_floats.patch index 327d814..3f2d533 100644 --- a/patches/patches/060_floats.patch +++ b/patches/patches/060_floats.patch @@ -1,5 +1,5 @@ ---- exercises/060_floats.zig 2025-10-03 13:28:03.092371247 +0200 -+++ answers/060_floats.zig 2025-10-03 13:27:40.842926774 +0200 +--- exercises/060_floats.zig 2025-10-17 17:58:44.811502880 +0200 ++++ answers/060_floats.zig 2025-10-17 17:57:39.227157388 +0200 @@ -43,7 +43,7 @@ // // We'll convert this weight from pounds to metric units at a @@ -7,5 +7,5 @@ - const shuttle_weight: f16 = 0.453592 * 4480e3; + const shuttle_weight: f32 = 0.453592 * 4.480e6; - // By default, float values are formatted in scientific - // notation. Try experimenting with '{d}' and '{d:.3}' to see + // By default, float values are formatted in standard decimal + // notation. Experiment with '{d}' and '{d:.3}' to see how