[petsc-dev] [petsc-maint #74896] Re: What was the 64-bit problem with pow()?
Matthew Knepley
knepley at gmail.com
Wed Jun 1 09:07:56 CDT 2011
On Wed, Jun 1, 2011 at 9:06 AM, Jed Brown <jed at 59a2.org> wrote:
> 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).
>
I am fine with those. Why are we having a discussion then? Just change it.
Matt
--
What most experimenters take for granted before they begin their experiments
is infinitely more interesting than any results to which their experiments
lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20110601/3d7f2c35/attachment.html>
More information about the petsc-dev
mailing list