[flang-commits] [flang] [llvm] [flang][flang-rt] Implement F202X leading-zero control edit descriptors LZ, LZS, and LZP for formatted output (F, E, D, and G editing) (PR #183500)
via flang-commits
flang-commits at lists.llvm.org
Thu Mar 12 10:30:48 PDT 2026
- Previous message: [flang-commits] [flang] [llvm] [flang][flang-rt] Implement F202X leading-zero control edit descriptors LZ, LZS, and LZP for formatted output (F, E, D, and G editing) (PR #183500)
- Next message: [flang-commits] [flang] [llvm] [flang][flang-rt] Implement F202X leading-zero control edit descriptors LZ, LZS, and LZP for formatted output (F, E, D, and G editing) (PR #183500)
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
================
@@ -419,10 +419,28 @@ RT_API_ATTRS bool RealOutputEditing<KIND>::EditEorDOutput(
if (totalLength > width || !exponent) {
return EmitRepeated(io_, '*', width);
}
- if (totalLength < width && digitsBeforePoint == 0 &&
- zeroesBeforePoint == 0) {
- zeroesBeforePoint = 1;
- ++totalLength;
+ if (digitsBeforePoint == 0 && zeroesBeforePoint == 0 && scale <= 0) {
+ // Optional leading zero position (F202X leading zero control).
+ // When scale > 0 (kP with k > 0), digits are moved before the decimal
+ // point, so the leading zero position is not optional -- skip this.
+ // Value has no digits before the decimal point: "0.xxxE+yy" vs ".xxxE+yy"
+ switch (edit.modes.leadingZero) {
+ case MutableModes::LeadingZeroMode::Print:
----------------
laoshd wrote:
Ok. I re-implemented it with editingFlags replacing enum, and made it match this request. Would you review it again please.
https://github.com/llvm/llvm-project/pull/183500
- Previous message: [flang-commits] [flang] [llvm] [flang][flang-rt] Implement F202X leading-zero control edit descriptors LZ, LZS, and LZP for formatted output (F, E, D, and G editing) (PR #183500)
- Next message: [flang-commits] [flang] [llvm] [flang][flang-rt] Implement F202X leading-zero control edit descriptors LZ, LZS, and LZP for formatted output (F, E, D, and G editing) (PR #183500)
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the flang-commits
mailing list