|
# Lines |
Dmitriy Nagirnyak
wrote
on 16-Jun-2008:
Hi,
I need to truncate Double to Int32 in OCL.
How can I do that in Eco3?
Thanks.
Dmitriy.
|
9 |
Scott Price
replied
on 16-Jun-2008:
Dmitriy Nagirnyak wrote:
(snip)
Can't you do:
DoubleAttribute.Truncate.ToInt32
or something similiar using the OCL Operations?
Kind regards,
|
21 |
Dmitriy Nagirnyak
replied
on 16-Jun-2008:
Hello Scott,
(snip) I do not see Truncate operation in the OCL editor.
I can see "round".
But not sure how it works: is it arithmetic or banker's rounding.
(snip) I could only see round operation.
|
20 |
Scott Price
replied
on 17-Jun-2008:
Dmitriy Nagirnyak wrote:
(snip)
Are you using Eco 3 or 4? I was pretty sure I could see that in the
list in 4, though it might not be accessible in OclPs handles or direct
service calls.
Some items are available for ExpressionHandle or similar evaluation,
|
41 |
Dmitriy Nagirnyak
replied
on 18-Jun-2008:
Hello Scott,
(snip) Eco 3.
(snip) Yes. But I'm just curious how/where we can see the reference of all the OCL
operations.
(snip) Thanks. I am familiar with it and implemented some of them in the past.
|
27 |
Scott Price
replied
on 18-Jun-2008:
Dmitriy Nagirnyak wrote:
(snip)
Ahh sorry, I'm talking about Eco 4.
(snip)
In Eco4, in the ExpressionHandle Expression Editor, when I do something
like:
class.allInstances.NumericAttribute
|
28 |
jesper hogstrom
replied
on 18-Jun-2008:
Hello Scott,
(snip) In EcoIV the static operations of .Net-types are available in OCL. Very handy.
The plugging in of new OCL operations has also been made more easy.
--Jesper
|
10 |
Scott Price
replied
on 18-Jun-2008:
jesper hogstrom wrote:
(snip)
Ahh that would be why. Very handy indeed, thank you Jesper for making
that clearer. :)
I hope that information is more helpful for you Dmitriy?
Kind regards,
|
18 |
Dmitriy Nagirnyak
replied
on 18-Jun-2008:
Hello Scott,
(snip) Yes Guys. Thanks.
Is it true that OCL operations extended from .NET types are in-memory only?
Cheers.
Dmitriy.
|
12 |
Scott Price
replied
on 19-Jun-2008:
Dmitriy Nagirnyak wrote:
(snip)
I would think so. :)
I'm pretty sure I've tried accessing the .Year property of a DateTime
attribute in OclPsHandle expression and been told it was not accessible
(shame, would have been very handy).
|
24 |
Dmitriy Nagirnyak
replied
on 19-Jun-2008:
Hello Scott,
(snip) The worst part of it is that OclPs is not extensible similar way as Ocl is :(
[Urghhh]
(snip) Scott, thanks for your effort, but it is not urgent for me and I'll be able
to try it by myself anyway.
|
19 |
Jonas Hogstrom [CapableObjects]
replied
on 24-Jun-2008:
Dmitriy Nagirnyak wrote:
(snip)
download the file from:
http://www.capableobjects.com/apps/InstantKB13/Download50003.aspx
it should allow you to list all ocl-operations (atleast in Eco4, it
might be possible to tweak it to work in EcoIII to).
|
25 |
Dmitriy Nagirnyak
replied
on 24-Jun-2008:
Hello Jonas,
(snip) Thanks. Very useful piece of code.
What about includding columns:
- Documentation (not for .NET operations) - event when most of operations
are intuitive, would be nice to have.
|
16 |
Jonas Hogstrom [CapableObjects]
replied
on 24-Jun-2008:
Dmitriy Nagirnyak wrote:
(snip)
in Eco4 it uses the numeric routines from .net. I'm pretty sure that
Round did the same in Eco3 too.
--
Jonas Hogstrom, developer
|
18 |
Dmitriy Nagirnyak
replied
on 24-Jun-2008:
Hello Jonas,
(snip) That means banking rounding.
Isn't any arithmetic rounding operation included out of the box?
I think the default rounding operation should be arithmetic and not banking
one.
|
15 |
John Herbster
replied
on 25-Jun-2008:
(snip) "Dmitriy Nagirnyak" wrote
(snip)
Dmitriy,
While I am not familiar with the numeric types that ECO4=20
uses, I do wonder why you would choose one rounding rule=20
over another. I would presume that the application should=20
|
15 |
Dmitriy Nagirnyak
replied
on 26-Jun-2008:
Hello John,
(snip) I prefer arithmetic rounding because if it is traditional and most common
method (Symmetric Arithmetic Rounding).
It is used in mathematics, physics. In the science at the end.
http://en.wikipedia.org/wiki/Rounding
|
55 |
jesper hogstrom
replied
on 26-Jun-2008:
Hello Dmitriy Nagirnyak nagir_argocomputing_com_au,
(snip) Be that as it may, but I'd say it does make sense to use the rounding method
of the implementation platform (i.e. Math.Round). Adding your own ArithmeticRound
operation wouldn't be that hard. You could also add it as a mantis request
and wait for it to reach the top of the pile for Jonas :)
|
12 |
John Herbster
replied
on 26-Jun-2008:
(snip)
"Dmitriy Nagirnyak" wrote
(snip)
Dmitriy,=20
Just to help clarify the argument, are you referring to=20
rounding of decimal fraction variables like varDecimal or BCD?
Or binary fraction variables like single, double, and extended?
|
92 |
Dmitriy Nagirnyak
replied
on 26-Jun-2008:
Hello John,
(snip) Decimal and Double.
(snip) True, But you don't need to search for application that uses arithmetic rounding.
Pick the first one on the internet.
Also ask any developer (except .NET one) what do they expect from Round(3.5)
|
162 |
John Herbster
replied
on 26-Jun-2008:
(snip)
"Dmitriy Nagirnyak" wrote
(snip) Dmitriy, =20
To further clarify from where you are coming, are you aware=20
that can double cannot exactly represent numbers like 0.1?
Also using doubles, how do you code the rounding to get a=20
|
17 |
Dmitriy Nagirnyak
replied
on 26-Jun-2008:
Hello John,
(snip) ..NET already has these routines, I'm not talking about implementation. I
believe following tests will pass in .NET:
Assert.AreEqual(1.21, Math.Round(1.205, 2, MidpointRounding.AwayFromZero));
Assert.AreEqual(1.20, Math.Round(1.205, 2, MidpointRounding.ToEven));
|
27 |
John Herbster
replied
on 26-Jun-2008:
(snip) can
(snip)
"Dmitriy Nagirnyak" wrote
(snip) I=20
(snip) MidpointRounding.AwayFromZero));
(snip) Without knowledge of your underlying numeric types or for your =
|
19 |
Dmitriy Nagirnyak
replied
on 26-Jun-2008:
John,
(snip) ECO has Round operations for Double and Decimal.
(snip) Here are the signature of Round operations supported by ECO:
Decimal.Round --> Decimal
Decimal.Round(decimals) --> Decimal
|
33 |
John Herbster
replied
on 27-Jun-2008:
"Dmitriy Nagirnyak" wrote
(snip) =20
(snip)
Dmitriy,=20
It is difficult to implement correct rounding to decimal fractions=20
for *any* rounding rule using the type double . This is because=20
|
29 |
Dmitriy Nagirnyak
replied
on 27-Jun-2008:
Hello John,
(snip) I'm approaching to implement it.
It is already available in .NET Framework for Decimal and Double types.
I'm aksing why should banking rounding be prefered over arithmetical as a
default rounding method in ECO.
|
20 |
Dmitriy Nagirnyak
replied
on 27-Jun-2008:
(snip) Sorry I'm NOT.
|
5 |
John Herbster
replied
on 27-Jun-2008:
(snip)
"Dmitriy Nagirnyak" wrote
(snip)
I would be interested to know how dotNET Framework works=20
when rounding Double types representing decimal fraction=20
numbers to numbers with fewer fraction digits. It requires=20
some compromises.
|
34 |
Dmitriy Nagirnyak
replied
on 29-Jun-2008:
Hello John,
(snip) One thing I know is that it follow IEEE Standard 754, section 4 (As MSDN
says).
The source code for the .NET Framework might be available (MS released part
of it).
|
28 |
John Herbster
replied
on 03-Jul-2008:
arithmetical
(snip)
"Dmitriy Nagirnyak" wrote
(snip)
Dmitriy,
Yes, for numbers stored with exact decimal fractions. =20
However, for numbers stored in IEEE-754 type double=20
|
60 |
Dmitriy Nagirnyak
replied
on 26-Jun-2008:
Hello jesper,
(snip) I think it makse more sence to stick to most common method which (for me)
is arithmetic round (see my other answer why I think so).
Also it makes more sence to maintan backward compatibility.
I mean Bold. If it used arithmetic rounding (which was default in Pascal)
|
28 |
Dmitriy Nagirnyak
replied
on 26-Jun-2008:
(snip) One more thing. What if you will add support for .round InPS.
How should it work?
BTW, any plans to support more mathematical operations InPs (I'm not even
sure which are already supported)?
|
9 |