The mature implementation of OCL that QVTo extends uses Java's Double,
so you get the same result as you would for 1.0 - 0.8 in Java.
At some level this is a problem in any language; you need to ignore
differences that lie within epsilon, the difference between adjacent values.
The new implementation of OCL uses Java's BigDecimal so you will get
much much greater precision, but still not perfect since 0.8 has a 1/5
factor that has no exact binary representation. This new version of OCL
certainly won't be in QVTo for Indigo and it's doubtful that it will be
in for Juno. I would expect that it will be Juno+1.
On 27/05/2011 17:00, Mehrdad Saadatmand wrote:
> In a QVT transformation, I have a variable which gets its value as:
> My problem is that when I do calculations on such variables I get
> inaccurate results. For example I have 1.0 and 0.8 and when I
> subtract, I get 0.199999999996 instead of 0.2 !
> How is it possible to fix this problem?