diff --git a/miscmaths.cc b/miscmaths.cc
index 72d7f139f8aa781a81fba2862898d68f80ab239f..3b1c0d3f7d4e232c1b584011be8bc14788ea8011 100644
--- a/miscmaths.cc
+++ b/miscmaths.cc
@@ -279,13 +279,19 @@ namespace MISCMATHS {
   
   int write_ascii_matrix(const Matrix& mat, ofstream& fs, int precision)
   {
+    if (precision>0)  { 
+      fs.setf(ios::scientific | ios::showpos); 
+      fs.precision(precision); 
+    } 
+#ifdef PPC64	
+    int n=0;
+#endif
     for (int i=1; i<=mat.Nrows(); i++) {
       for (int j=1; j<=mat.Ncols(); j++) {
-	if (precision>0)  { 
-	  fs.setf(ios::scientific | ios::showpos); 
-	  fs.precision(precision+7);  
-	  fs.precision(precision); } 
 	fs << mat(i,j) << "  ";
+#ifdef PPC64	
+	if ((n++ % 50) == 0) fs.flush();
+#endif
       }
       fs << endl;
     }
@@ -352,10 +358,16 @@ namespace MISCMATHS {
     ny = mat.Ncols();
 
     double val;
+#ifdef PPC64	
+    int n=0;
+#endif
     for (unsigned int y=1; y<=ny; y++) {
       for (unsigned int x=1; x<=nx; x++) {
 	val = mat(x,y);
 	fs.write((char*)&val,sizeof(val));
+#ifdef PPC64	
+	if ((n++ % 50) == 0) fs.flush();
+#endif
       }
     }