[Dune-devel] [Dune-Commit] [Commit] dune-geometry - cb66db8: Add explicit conversion, needed when using high precision types like boost::multiprecision
Martin Nolte
nolte at mathematik.uni-freiburg.de
Fri Jun 13 20:01:59 CEST 2014
Hi Andreas,
so Christian is perfectly correct in assuming that the cast ctype( df / cxn ) is
not nessassary. However, the basic problem might persist with expression
templates as, e.g., (b > ctype( 1 ) ? a / b : a * b) may result in a compiler error.
But, as I said, we should discuss this on the developer meeting.
Best,
Martin
On 06/13/2014 02:05 PM, Andreas Buhr wrote:
> Hi Martin,
>
> On 06/13/2014 01:28 PM, Martin Nolte wrote:
>> Your compiler output
>> indicates that you have not tested the option
>>
>> ctype dfcxn = (cxn > Traits::tolerance() || cxn < -Traits::tolerance())
>> ? df / cxn : ctype(0);
>>
>> Does the compiler accept that?
>
> The compiler accepts both:
> ... ? df / cxn : ctype(0);
> and
> ... ? ctype(df / cxn) : 0;
>
> The reason is that, according to § 5.3 paragraph 3 in the C++ standard
> (draft):
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3337.pdf
>
> <cite>
> ... if the second and third operand have different types and either has
> (possibly cv-qualified) class type, or if both are glvalues of the same
> value category and the same type except for cv-qualification, an attempt
> is made to convert each of those operands to the type of the other.
> </cite>
>
> cheers,
> Andreas
>
>
>
>
> _______________________________________________
> Dune-devel mailing list
> Dune-devel at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune-devel
>
--
Dr. Martin Nolte <nolte at mathematik.uni-freiburg.de>
Universität Freiburg phone: +49-761-203-5630
Abteilung für angewandte Mathematik fax: +49-761-203-5632
Hermann-Herder-Straße 10
79104 Freiburg, Germany
More information about the Dune-devel
mailing list