aboutsummaryrefslogtreecommitdiff
path: root/flang/unittests
diff options
context:
space:
mode:
authorPeter Klausler <35819229+klausler@users.noreply.github.com>2023-12-26 14:53:11 -0800
committerGitHub <noreply@github.com>2023-12-26 14:53:11 -0800
commit14e221aa68c17599c830f458b9727a84bb1df6a9 (patch)
tree374c2f4a090f50427ddb86f0de8d0cae5d21a855 /flang/unittests
parent532d4845ed0afced7cb1f8c7a4e3499b63cc3de3 (diff)
downloadllvm-14e221aa68c17599c830f458b9727a84bb1df6a9.zip
llvm-14e221aa68c17599c830f458b9727a84bb1df6a9.tar.gz
llvm-14e221aa68c17599c830f458b9727a84bb1df6a9.tar.bz2
[flang][runtime] Correct EXw.0 output editing (#75121)
A zero 'd' digit count in EX output editing has a meaning that's distinct from other numeric output editing descriptors, and I missed this in my initial implementation of the feature. d==0 means that the runtime should emit hexadecimal digits after the (hexa)decimal point until all of the rest of them would be zero.
Diffstat (limited to 'flang/unittests')
-rw-r--r--flang/unittests/Runtime/NumericalFormatTest.cpp52
1 files changed, 34 insertions, 18 deletions
diff --git a/flang/unittests/Runtime/NumericalFormatTest.cpp b/flang/unittests/Runtime/NumericalFormatTest.cpp
index b5b8eb0..69637d8 100644
--- a/flang/unittests/Runtime/NumericalFormatTest.cpp
+++ b/flang/unittests/Runtime/NumericalFormatTest.cpp
@@ -654,28 +654,44 @@ TEST(IOApiTests, FormatDoubleValues) {
{"(EX24.13,';')", " 0XF.FFFFFFFFFFFF8P+1020;"},
}},
{// EX rounding
- 0x3ff1000000000000uLL, // 1.0625
+ 0x3ff0100000000000uLL,
{
- {"(F7.4,';')", " 1.0625;"},
- {"(EX9.1,';')", " 0X8.8P-3;"},
- {"(EX9.0,';')", " 0X8.P-3;"},
- {"(RN,EX9.0,';')", " 0X8.P-3;"},
- {"(RU,EX9.0,';')", " 0X9.P-3;"},
- {"(RD,EX9.0,';')", " 0X8.P-3;"},
- {"(RZ,EX9.0,';')", " 0X8.P-3;"},
- {"(RC,EX9.0,';')", " 0X9.P-3;"},
+ {"(F11.8,';')", " 1.00390625;"},
+ {"(EX10.2,';')", " 0X8.08P-3;"},
+ {"(EX10.1,';')", " 0X8.0P-3;"},
+ {"(EX10.0,';')", " 0X8.08P-3;"},
+ {"(EX0.0,';')", "0X8.08P-3;"},
+ {"(EX0,';')", "0X8.08P-3;"},
+ {"(RN,EX10.1,';')", " 0X8.0P-3;"},
+ {"(RU,EX10.1,';')", " 0X8.1P-3;"},
+ {"(RD,EX10.1,';')", " 0X8.0P-3;"},
+ {"(RZ,EX10.1,';')", " 0X8.0P-3;"},
+ {"(RC,EX10.1,';')", " 0X8.1P-3;"},
+ {"(RN,EX10.0,';')", " 0X8.08P-3;"},
+ {"(RU,EX10.0,';')", " 0X8.08P-3;"},
+ {"(RD,EX10.0,';')", " 0X8.08P-3;"},
+ {"(RZ,EX10.0,';')", " 0X8.08P-3;"},
+ {"(RC,EX10.0,';')", " 0X8.08P-3;"},
}},
{// EX rounding
- 0xbff1000000000000uLL, // -1.0625
+ 0xbff0100000000000uLL,
{
- {"(F7.4,';')", "-1.0625;"},
- {"(EX9.1,';')", "-0X8.8P-3;"},
- {"(EX9.0,';')", " -0X8.P-3;"},
- {"(RN,EX9.0,';')", " -0X8.P-3;"},
- {"(RU,EX9.0,';')", " -0X8.P-3;"},
- {"(RD,EX9.0,';')", " -0X9.P-3;"},
- {"(RZ,EX9.0,';')", " -0X8.P-3;"},
- {"(RC,EX9.0,';')", " -0X9.P-3;"},
+ {"(F11.8,';')", "-1.00390625;"},
+ {"(EX10.2,';')", "-0X8.08P-3;"},
+ {"(EX10.1,';')", " -0X8.0P-3;"},
+ {"(EX10.0,';')", "-0X8.08P-3;"},
+ {"(EX0.0,';')", "-0X8.08P-3;"},
+ {"(EX0,';')", "-0X8.08P-3;"},
+ {"(RN,EX10.1,';')", " -0X8.0P-3;"},
+ {"(RU,EX10.1,';')", " -0X8.0P-3;"},
+ {"(RD,EX10.1,';')", " -0X8.1P-3;"},
+ {"(RZ,EX10.1,';')", " -0X8.0P-3;"},
+ {"(RC,EX10.1,';')", " -0X8.1P-3;"},
+ {"(RN,EX10.0,';')", "-0X8.08P-3;"},
+ {"(RU,EX10.0,';')", "-0X8.08P-3;"},
+ {"(RD,EX10.0,';')", "-0X8.08P-3;"},
+ {"(RZ,EX10.0,';')", "-0X8.08P-3;"},
+ {"(RC,EX10.0,';')", "-0X8.08P-3;"},
}},
};