[petsc-dev] Ugly feature of __float128

Barry Smith bsmith at mcs.anl.gov
Thu Oct 29 00:29:58 CDT 2015


> On Oct 28, 2015, at 11:38 PM, Jed Brown <jed at jedbrown.org> wrote:
> 
> Barry Smith <bsmith at mcs.anl.gov> writes:
> 
>>  After wasting hours debugging I just realized that gcc __float128
>>  REQUIRES that numerical constants be written with a q suffix or
>>  first they are treated as double and then converted to __float. 
> 
> Unsuffixed numeric literals are double.  It's the semantic of the
> language, not something they can change by adding a type.  Sorry.
> 
>>   I cannot understand why this is done this way. Who wants to convert a code to __float128 and have to then label all floating point numbers with a q which of course also means the code is not compilable with other compilers in double.
> 
> It's ugly, but you can put it in a macro:
> 
> #define NUM(a)   a ## q

  This is horrible, I can see why Fortran users hate C.





More information about the petsc-dev mailing list