Skip to content

Commit 41bc492

Browse files
author
Daniel Kroening
committed
printf formatter supports %e and %E
1 parent 2f0ba52 commit 41bc492

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/ansi-c/printf_formatter.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,18 @@ void printf_formattert::process_format(std::ostream &out)
159159
out << ch;
160160
break;
161161

162+
case 'e':
163+
case 'E':
164+
format_constant.style=format_spect::stylet::SCIENTIFIC;
165+
if(next_operand==operands.end())
166+
break;
167+
out << format_constant(
168+
make_type(*(next_operand++), double_type()));
169+
break;
170+
162171
case 'f':
163172
case 'F':
173+
format_constant.style=format_spect::stylet::DECIMAL;
164174
if(next_operand==operands.end())
165175
break;
166176
out << format_constant(
@@ -169,6 +179,7 @@ void printf_formattert::process_format(std::ostream &out)
169179

170180
case 'g':
171181
case 'G':
182+
format_constant.style=format_spect::stylet::AUTOMATIC;
172183
if(format_constant.precision==0)
173184
format_constant.precision=1;
174185
if(next_operand==operands.end())

0 commit comments

Comments
 (0)