mirror of
https://codeberg.org/ziglings/exercises.git
synced 2026-06-08 07:50:00 +00:00
adjusted comment to zig 0.16
This commit is contained in:
@@ -29,8 +29,15 @@
|
||||
//
|
||||
// var foo: f16 = 5; // NO ERROR
|
||||
//
|
||||
// var foo: u16 = 5; // A literal of a different type
|
||||
// var bar: f16 = foo; // ERROR
|
||||
// A runtime value can coerce to a different type,
|
||||
// as long as the value is losslessly representable:
|
||||
//
|
||||
// var foo: u16 = 5;
|
||||
// var bar: f16 = foo; // NO ERROR (5 fits in f16)
|
||||
//
|
||||
// var foo: u16 = 49876;
|
||||
// var bar: f16 = foo; // ERROR (49876 not representable in f16)
|
||||
//
|
||||
//
|
||||
// Please fix the two float problems with this program and
|
||||
// display the result as a whole number.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- exercises/060_floats.zig 2026-04-03 14:40:17.582344768 +0200
|
||||
+++ answers/060_floats.zig 2026-04-03 14:49:26.997886326 +0200
|
||||
@@ -43,7 +43,7 @@
|
||||
--- exercises/060_floats.zig 2026-05-02 19:22:46.225370223 +0200
|
||||
+++ answers/060_floats.zig 2026-05-02 19:22:47.523142218 +0200
|
||||
@@ -50,7 +50,7 @@
|
||||
//
|
||||
// We'll convert this weight from pounds to metric units at a
|
||||
// conversion of 0.453592 kg to the pound.
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
// By default, float values are formatted in standard decimal
|
||||
// notation. Experiment with '{d}' and '{d:.3}' to see how
|
||||
@@ -51,7 +51,7 @@
|
||||
@@ -58,7 +58,7 @@
|
||||
// scientific notation.
|
||||
// NOTE: The weight of the shuttle is a huge number, a scientific notation
|
||||
// may be more appropriate.
|
||||
|
||||
Reference in New Issue
Block a user