text.cc (8667:62372a8d4ef2) text.cc (8946:fb6c89334b86)
1/*
2 * Copyright (c) 2004-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 152 unchanged lines hidden (view full) ---

161 return false;
162}
163
164string
165ValueToString(Result value, int precision)
166{
167 stringstream val;
168
1/*
2 * Copyright (c) 2004-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 152 unchanged lines hidden (view full) ---

161 return false;
162}
163
164string
165ValueToString(Result value, int precision)
166{
167 stringstream val;
168
169 if (!isnan(value)) {
169 if (!std::isnan(value)) {
170 if (precision != -1)
171 val.precision(precision);
172 else if (value == rint(value))
173 val.precision(0);
174
175 val.unsetf(ios::showpoint);
176 val.setf(ios::fixed);
177 val << value;

--- 28 unchanged lines hidden (view full) ---

206 cdf += pdf;
207 }
208}
209
210void
211ScalarPrint::operator()(ostream &stream) const
212{
213 if ((flags.isSet(nozero) && value == 0.0) ||
170 if (precision != -1)
171 val.precision(precision);
172 else if (value == rint(value))
173 val.precision(0);
174
175 val.unsetf(ios::showpoint);
176 val.setf(ios::fixed);
177 val << value;

--- 28 unchanged lines hidden (view full) ---

206 cdf += pdf;
207 }
208}
209
210void
211ScalarPrint::operator()(ostream &stream) const
212{
213 if ((flags.isSet(nozero) && value == 0.0) ||
214 (flags.isSet(nonan) && isnan(value)))
214 (flags.isSet(nonan) && std::isnan(value)))
215 return;
216
217 stringstream pdfstr, cdfstr;
218
215 return;
216
217 stringstream pdfstr, cdfstr;
218
219 if (!isnan(pdf))
219 if (!std::isnan(pdf))
220 ccprintf(pdfstr, "%.2f%%", pdf * 100.0);
221
220 ccprintf(pdfstr, "%.2f%%", pdf * 100.0);
221
222 if (!isnan(cdf))
222 if (!std::isnan(cdf))
223 ccprintf(cdfstr, "%.2f%%", cdf * 100.0);
224
225 ccprintf(stream, "%-40s %12s %10s %10s", name,
226 ValueToString(value, precision), pdfstr, cdfstr);
227
228 if (descriptions) {
229 if (!desc.empty())
230 ccprintf(stream, " # %s", desc);

--- 472 unchanged lines hidden ---
223 ccprintf(cdfstr, "%.2f%%", cdf * 100.0);
224
225 ccprintf(stream, "%-40s %12s %10s %10s", name,
226 ValueToString(value, precision), pdfstr, cdfstr);
227
228 if (descriptions) {
229 if (!desc.empty())
230 ccprintf(stream, " # %s", desc);

--- 472 unchanged lines hidden ---