ffc team mailing list archive
-
ffc team
-
Mailing list archive
-
Message #01663
Re: Inverse bug?
2008/6/27 Kristian Oelgaard <k.b.oelgaard@xxxxxxxxxx>:
> Quoting "Garth N. Wells" <gnw20@xxxxxxxxx>:
>
>>
>>
>> Garth N. Wells wrote:
>> > I'm observing some strange behaviour when using the inverse of a scalar.
>> > Running FFC on
>> >
>> > P1 = FiniteElement("Lagrange", "triangle", 1)
>> > v = TestFunction(P1)
>> > temp = Constant("triangle")
>> > Tp = 10
>> > L = v*temp*(1*Tp)*dx
>> >
>> > is fine, but running
>> >
>> > P1 = FiniteElement("Lagrange", "triangle", 1)
>> > v = TestFunction(P1)
>> > temp = Constant("triangle")
>> > Tp = 10
>> > L = v*temp*(1/Tp)*dx
>> >
>>
>> It looks like 1/Tp is a problem, and 1.0/Tp is OK.
>
> It's because 1/10 = 0 and 1.0/10 or 1/10.0 = 0.1 in Python...
Yes. Note that this will change in python 3.0, with // meaning integer
division and / always meaning float division.
--
Martin
References