[petsc-dev] Updated src/sys/examples/tutorials/ex5.c

Barry Smith bsmith at mcs.anl.gov
Thu Mar 24 13:27:10 CDT 2011


  Rich,

   The order you call the register routines should not matter. Only the order they are listed in the struct matters. Did you get something breaking if you didn't call the register routines in order?

   I know the ascii view prints "incorrect" values. This is a universal problem with working with quad precision. C provides no portable (or even nonportable) way of handling format statements for different precisions builds. 

   Unless Jed figures out a way to do it the current model is that with quad they are printed wrong and you need to manage their display yourself.

   Barry

I try to handle the problem with %G format that we manually map to different "standard" C formats, but quad doesn't have a "standard" C format that works.


On Mar 24, 2011, at 12:30 PM, Richard Katz wrote:

> Attached is a diff file updating 
> src/sys/examples/tutorials/ex5.c
> which is an example of PetscBag use.
> 
> I've changed the order of the parameter registrations to put the Real values first, as required with quad precision.
> 
> If you run the new version with quad precision, you'll see that when the bag is viewed to stdout, the Real numerical values are incorrectly displayed.
> 
> Cheers
> Rich
> 
> 
> <ex5.diff>




More information about the petsc-dev mailing list