| commit | 409deb17c28826e2293a24a93d340237525dd67b | [log] [tgz] |
|---|---|---|
| author | jeremie.tatibouet <jeremie.tatibouet@cea.fr> | Tue Sep 26 18:55:45 2017 +0200 |
| committer | jeremie.tatibouet <jeremie.tatibouet@cea.fr> | Tue Sep 26 18:55:45 2017 +0200 |
| tree | 6bd56a76359987d86e2b8b5aaac2a7b11242605c | |
| parent | 602541a6971f972685fbd60d276fed6254c76190 [diff] |
Bug 522610 The implementation of RealFunctions::ToInteger is incorrect Change-Id: Ie941db6182478c68a18f686fd7eb50adfdf74876 Signed-off-by: jeremie.tatibouet <jeremie.tatibouet@cea.fr>
diff --git a/bundles/core/libraries/org.eclipse.papyrus.moka.fuml.standardlibrary/src/org/eclipse/papyrus/moka/fuml/standardlibrary/library/real/ToInteger.java b/bundles/core/libraries/org.eclipse.papyrus.moka.fuml.standardlibrary/src/org/eclipse/papyrus/moka/fuml/standardlibrary/library/real/ToInteger.java index 5a5a5eb..60d45da 100644 --- a/bundles/core/libraries/org.eclipse.papyrus.moka.fuml.standardlibrary/src/org/eclipse/papyrus/moka/fuml/standardlibrary/library/real/ToInteger.java +++ b/bundles/core/libraries/org.eclipse.papyrus.moka.fuml.standardlibrary/src/org/eclipse/papyrus/moka/fuml/standardlibrary/library/real/ToInteger.java
@@ -29,9 +29,8 @@ public void doBody(List<IParameterValue> inputParameters, List<IParameterValue> outputParameters) { try { Double x = ((RealValue) inputParameters.get(0).getValues().get(0)).value; - String y = x.toString(); IIntegerValue result = new IntegerValue(); - result.setValue(new Integer(y)); + result.setValue((int) (x >= 0 ? Math.floor(x) : -Math.floor(Math.abs(x)))); result.setType((PrimitiveType) this.locus.getFactory().getBuiltInType("Integer")); List<IValue> outputs = new ArrayList<IValue>(); outputs.add(result);