Skip to content

Commit fe3a4a0

Browse files
mstdokumacijinzhongjia
authored andcommitted
lint
1 parent 741551c commit fe3a4a0

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/msgpack.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1819,7 +1819,7 @@ pub fn PackWithLimits(
18191819

18201820
/// write float
18211821
fn writeFloat(self: Self, val: f64) !void {
1822-
// A value should only be encoded as f32 if it can be
1822+
// A value should only be encoded as f32 if it can be
18231823
// represented exactly without loss of precision.
18241824
const val_f32: f32 = @floatCast(val);
18251825
if (val == @as(f64, val_f32)) {

src/test.zig

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,21 +1140,21 @@ test "large integer float precision (issue fix)" {
11401140
// Test large integer that cannot fit in f32 mantissa (24 bits)
11411141
// 1774904202196 requires 41 bits, so it will lose precision if encoded as f32
11421142
const large_int: f64 = 1774904202196.0;
1143-
1143+
11441144
try p.write(.{ .float = large_int });
1145-
1145+
11461146
// Verify it was encoded as f64 (marker 0xcb) not f32 (marker 0xca)
11471147
try expect(arr[0] == 0xcb); // Should use f64 format
1148-
1148+
11491149
// Read back and verify exact match (no truncation)
11501150
read_buffer = fixedBufferStream(&arr);
11511151
p = pack.init(&write_buffer, &read_buffer);
11521152
const val = try p.read(allocator);
11531153
defer val.free(allocator);
1154-
1154+
11551155
// Should preserve the exact value with f64 encoding
11561156
try expect(val.float == large_int);
1157-
1157+
11581158
// Additional test: verify f32 would lose precision
11591159
const large_f32: f32 = @floatCast(large_int);
11601160
const large_back_to_f64: f64 = @as(f64, large_f32);

0 commit comments

Comments
 (0)