mirror of
https://github.com/ziglang/zig.git
synced 2026-02-17 14:59:14 +00:00
Alignment fix and allow rudimentary f128 float printing
This commit is contained in:
parent
951512f5ae
commit
887c97742f
@ -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)) {
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user