Alignment fix and allow rudimentary f128 float printing

This commit is contained in:
Marc Tiehuis 2018-06-30 20:15:02 +12:00
parent 951512f5ae
commit 887c97742f
2 changed files with 2 additions and 2 deletions

View File

@ -327,7 +327,7 @@ pub fn formatFloatScientific(
comptime Errors: type,
output: fn (@typeOf(context), []const u8) Errors!void,
) Errors!void {
var x = f64(value);
var x = @floatCast(f64, value);
// Errol doesn't handle these special cases.
if (math.signbit(x)) {

View File

@ -17,7 +17,7 @@ pub extern fn __floatunditf(a: u128) f128 {
const exp = (u128.bit_count - 1) - @clz(a);
const shift = mantissa_bits - @intCast(u7, exp);
var result: u128 = (a << shift) ^ implicit_bit;
var result: u128 align(16) = (a << shift) ^ implicit_bit;
result += (@intCast(u128, exp) + exponent_bias) << mantissa_bits;
return @bitCast(f128, result);