From fb7a95b3c458457c12c47f6dabaeb37cb3bf85b2 Mon Sep 17 00:00:00 2001 From: MovingtoMars Date: Thu, 28 Jan 2016 19:43:08 +1300 Subject: [PATCH] cleanup float printing --- std/std.zig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/std/std.zig b/std/std.zig index 7b873cea52..06fa35a722 100644 --- a/std/std.zig +++ b/std/std.zig @@ -246,15 +246,15 @@ pub fn buf_print_u64(out_buf: []u8, x: u64) -> isize { pub fn buf_print_f64(out_buf: []u8, x: f64) -> isize { if (x == f64_get_pos_inf()) { const buf2 = "+Inf"; - @memcpy(&out_buf[0], &buf2[0], 4); + @memcpy(&out_buf[0], &buf2[0], buf2.len); return 4; } else if (x == f64_get_neg_inf()) { const buf2 = "-Inf"; - @memcpy(&out_buf[0], &buf2[0], 4); + @memcpy(&out_buf[0], &buf2[0], buf2.len); return 4; } else if (f64_is_nan(x)) { const buf2 = "NaN"; - @memcpy(&out_buf[0], &buf2[0], 3); + @memcpy(&out_buf[0], &buf2[0], buf2.len); return 3; }