I create a simple program with a double type value initialized,
var a = double.NaN;
I build the project with Visual Studio 2019, .net framework 4.5 and disassemble it into a .il file using ILDASM.exe Version 4.0.30319.0
IL_0001: ldc.r8 -nan(ind)
but there is an error when I try to assemble it using ILASM.exe Version 4.8.3752.0
test.il(65) : error : syntax error at token '-' in: IL_0001: ldc.r8 -nan(ind)
This happened to Double.PositiveInfinity and Double.NegativeInfinity too. Anyone can help?
I found the error reason from here
and the simple solution is just to replace the:
ldc.r8 -nan(ind) -> ldc.r8 (00 00 00 00 00 00 F8 FF)
ldc.r8 inf -> ldc.r8 (00 00 00 00 00 00 F0 7F)
ldc.r8 -inf -> ldc.r8 (00 00 00 00 00 00 F0 FF)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With