On Wed, Jun 1, 2011 at 14:51, Matthew Knepley <knepley at gmail.com> wrote:

>
>> Isn't it casting to PowInt which is int?
>
>
> Not exactly. If I define
>
>   #define PetscPowScalar(a, b) std::pow(a, (int) b)
>

Barry was not suggesting this.


>
> then this call
>
>   PetscPowScalar(2.0, 0.333)
>
> will not work correctly. If I do not, then
>
>   PetscPowScalar(2.0, 3)
>
> will fail when using --with-64-bit-indices. The only solution I saw was for
> the user
> to do the cast explicitly
>

We're not saying PetscPowScalar(base,(int)i) is necessarily bad, but we
think

#if defined(PETSC_USE_64BIT_INDICES)
typedef int PowInt;
#else
typedef PetscInt PowInt;
#endif

is a pretty ugly way to spell

typedef int PowInt; /* explanation why */

or even just calling PetscPowScalar(base,(int)i) instead of
PetscPowScalar(base,(PowInt)i).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20110601/c6e7a98c/attachment.html>

Reply via email to