+// printAlignedFP - Simulate the printf "%A.Bf" format, where A is the
+// TotalWidth size, and B is the AfterDec size.
+//
+static void printAlignedFP(double Val, unsigned AfterDec, unsigned TotalWidth,
+ std::ostream &OS) {
+ assert(TotalWidth >= AfterDec+1 && "Bad FP Format!");
+ OS.width(TotalWidth-AfterDec-1);
+ char OldFill = OS.fill();
+ OS.fill(' ');
+ OS << (int)Val; // Integer part;
+ OS << ".";
+ OS.width(AfterDec);
+ OS.fill('0');
+ unsigned ResultFieldSize = 1;
+ while (AfterDec--) ResultFieldSize *= 10;
+ OS << (int)(Val*ResultFieldSize) % ResultFieldSize;
+ OS.fill(OldFill);
+}
+
+static void printVal(double Val, double Total, std::ostream &OS) {