I wrote some functions that prints out pi as f64, f80, and f128, but there seems to be no support for the higher-precision types at the moment:
const std = @import("std");
pub fn printPi64() void {
std.debug.print("pi = {d}\n", .{@as(f64, std.math.pi)});
}
pub fn printPi80() void {
std.debug.print("pi = {d}\n", .{@as(f80, std.math.pi)});
}
pub fn printPi128() void {
std.debug.print("pi = {d}\n", .{@as(f128, std.math.pi)});
}
/home/cleong/.zvm/master/lib/std/fmt.zig:1243:22: error: expected type 'f64', found 'f80'
The replacing {d}
with {e}
allows the code to compile but the result is truncated to f64.