summaryrefslogtreecommitdiff
path: root/exercises/060_floats.zig
diff options
context:
space:
mode:
authorChris Boesch <chrboesch@noreply.codeberg.org>2025-10-17 18:08:59 +0200
committerChris Boesch <chrboesch@noreply.codeberg.org>2025-10-17 18:08:59 +0200
commitb72bcd7e476f88f8ade4cd46586bac17181f929b (patch)
treeab8b026d2428d65c59905f92b2f155ba4d304f79 /exercises/060_floats.zig
parentb25f9bb66e274a7c77190d941bc41414fea09038 (diff)
parent837e6aba3bc22aaf0f56c642310366956e52dce4 (diff)
Merge pull request 'Fixed description to decimal and scientific notation' (#312) from i311 into main
Reviewed-on: https://codeberg.org/ziglings/exercises/pulls/312
Diffstat (limited to 'exercises/060_floats.zig')
-rw-r--r--exercises/060_floats.zig7
1 files changed, 4 insertions, 3 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});
}