Implement f16 functionality

This commit is contained in:
gingerBill
2021-04-01 10:06:00 +01:00
parent a00d7cc705
commit 54e6c50769
16 changed files with 499 additions and 76 deletions
+4
View File
@@ -948,6 +948,7 @@ fmt_float :: proc(fi: ^Info, v: f64, bit_size: int, verb: rune) {
u: u64;
switch bit_size {
case 16: u = u64(transmute(u16)f16(v));
case 32: u = u64(transmute(u32)f32(v));
case 64: u = transmute(u64)v;
case: panic("Unhandled float size");
@@ -2023,12 +2024,15 @@ fmt_arg :: proc(fi: ^Info, arg: any, verb: rune) {
case any: fmt_arg(fi, a, verb);
case rune: fmt_rune(fi, a, verb);
case f16: fmt_float(fi, f64(a), 16, verb);
case f32: fmt_float(fi, f64(a), 32, verb);
case f64: fmt_float(fi, a, 64, verb);
case f16le: fmt_float(fi, f64(a), 16, verb);
case f32le: fmt_float(fi, f64(a), 32, verb);
case f64le: fmt_float(fi, f64(a), 64, verb);
case f16be: fmt_float(fi, f64(a), 16, verb);
case f32be: fmt_float(fi, f64(a), 32, verb);
case f64be: fmt_float(fi, f64(a), 64, verb);