From 2307dc8f26b202a6eef263f2e2d7e6d2ec04a641 Mon Sep 17 00:00:00 2001 From: Pierre Muller Date: Tue, 7 Jun 2022 12:56:57 +0200 Subject: [PATCH] Try to fix real constant problems for llvm compiler --- compiler/wasm32/agllvmmc.pas | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/compiler/wasm32/agllvmmc.pas b/compiler/wasm32/agllvmmc.pas index eaecd94e7a..5258dcf59d 100644 --- a/compiler/wasm32/agllvmmc.pas +++ b/compiler/wasm32/agllvmmc.pas @@ -225,9 +225,16 @@ implementation begin result:=result+'nan'; if fraction<>(int64(1) shl (fraction_bits-1)) then - result:=result+':0x'+HexStr(fraction,fraction_hexdigits); + result:=result+'(0x'+HexStr(fraction,fraction_hexdigits)+')'; end; end + else if (exponent=0) then + begin + if (fraction=0) then + result:=result+'0x0.0p'+tostr(-exponent_bias) + else + result:=result+'0x0.'+HexStr(fraction shl (fraction_hexdigits*4-fraction_bits),fraction_hexdigits)+'p'+tostr(-exponent_bias+1) + end else result:=result+'0x1.'+HexStr(fraction shl (fraction_hexdigits*4-fraction_bits),fraction_hexdigits)+'p'+tostr(exponent-exponent_bias); end;