<div dir="ltr">This thread suggests that I was at least not wrong in assuming that trailing 0s should be printed by printf (although I did not trace the code down to printf)<br><div><br></div><div><a href="https://stackoverflow.com/questions/277772/avoid-trailing-zeroes-in-printf">https://stackoverflow.com/questions/277772/avoid-trailing-zeroes-in-printf</a><br></div><div><br></div><div>Maybe Sanjay's machines printf cuts off trailing 0s.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, May 15, 2019 at 10:06 AM Smith, Barry F. <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
The 10-20% in seven digits are presumably printed accurately; it is presumably simply the case that the rest of the digits would be zero and hence are not printed. <br>
<br>
> On May 15, 2019, at 8:59 AM, Mark Adams via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>> wrote:<br>
> <br>
> You are seeing half precision (like 7 digits) in 10-20% of the entries and full in the rest.<br>
> <br>
> Someone will probably chime in who knows about this but I can see where a serial matrix is printed in ASCII Matlab in MatView_SeqAIJ_ASCII in src/mat/impls/aij/seq/aij.c. <br>
> <br>
> I think this line is operative and is should clearly work:<br>
> <br>
> ierr = PetscViewerASCIIPrintf(viewer,"%D %D %18.16e\n",i+1,a->j[j]+1,(double)a->a[j]);CHKERRQ(ierr);<br>
> <br>
> Could you run in serial (this code could very well be used for MPI Mats also) with Matlab/ASCII to verify that you have this problem. And you could modify this print statement and remake PETSc, if that's easy, to verify that this code is operative.<br>
> <br>
> I think %18.16e should print 16 digits even if they are 0s ...<br>
> <br>
> <br>
> On Tue, May 14, 2019 at 8:34 PM Sanjay Govindjee <<a href="mailto:s_g@berkeley.edu" target="_blank">s_g@berkeley.edu</a>> wrote:<br>
> I'm seeing half precision on at least 10 to 20% of the entries :(<br>
> Knowing I should see full precision, I will dig deeper.<br>
> <br>
> -sanjay<br>
> On 5/14/19 5:22 PM, Mark Adams wrote:<br>
>> I would hope you get full precision. How many digits are you seeing?<br>
>> <br>
>> On Tue, May 14, 2019 at 7:15 PM Sanjay Govindjee via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>> wrote:<br>
>> I am using the following bit of code to debug a matrix. What is the <br>
>> expected precision of the numbers that I will find in my ASCII file?<br>
>> As far as I can tell it is not the full double precision that I was <br>
>> expecting.<br>
>> <br>
>> call PetscViewerASCIIOpen(PETSC_COMM_WORLD, <br>
>> tangview,K_view, ierr)<br>
>> call PetscViewerSetFormat(K_view, <br>
>> PETSC_VIEWER_ASCII_MATLAB, ierr)<br>
>> call MatView (Kmat, K_view, ierr)<br>
>> <br>
>> -sanjay<br>
>> <br>
> <br>
<br>
</blockquote></div>