tag:blogger.com,1999:blog-2815878794992689913.post2071816875660624451..comments2024-03-16T05:23:19.406+00:00Comments on FME Memorandum: 3/2 returns 1 or 1.5?Takashi Iijimahttp://www.blogger.com/profile/13371090267687503904noreply@blogger.comBlogger9125tag:blogger.com,1999:blog-2815878794992689913.post-26355170825891264722014-12-18T12:01:43.331+00:002014-12-18T12:01:43.331+00:00correction for a typo.
Tested with FME 2015 "...correction for a typo.<br />Tested with FME 2015 "b15230".Takashi Iijimahttps://www.blogger.com/profile/13371090267687503904noreply@blogger.comtag:blogger.com,1999:blog-2815878794992689913.post-79443902254533195822014-12-18T03:02:24.370+00:002014-12-18T03:02:24.370+00:00One more.
The Offsetter has the / operator only in...One more.<br />The Offsetter has the / operator only in the "Y Offset" parameter.<br />If you modify X or Z rather than Y, the message will not appear but the change will be applied when you have closed the parameters dialog with [OK].<br />There are many cases where the change will be applied without the message.<br />Tested with FME 2015 b15260.Takashi Iijimahttps://www.blogger.com/profile/13371090267687503904noreply@blogger.comtag:blogger.com,1999:blog-2815878794992689913.post-70729138318531096452014-12-17T12:31:20.450+00:002014-12-17T12:31:20.450+00:00so, it may be better that the "Division Behav...so, it may be better that the "Division Behavior Change" message will appear when the Transformer Parameters dialog is opened rather than the Arithmetic Editor, if a parameter setting of the transformer contains a division operator.Takashi Iijimahttps://www.blogger.com/profile/13371090267687503904noreply@blogger.comtag:blogger.com,1999:blog-2815878794992689913.post-44030640524241873772014-12-17T08:58:47.994+00:002014-12-17T08:58:47.994+00:00I tried another pattern.
If you modified the "...I tried another pattern.<br />If you modified the "Y Offset" parameter directly without using the Arithmetic Editor and closed the Offsetter Parameters dialog with [OK] button, the change will be applied without showing the warning message.<br />hmm...Takashi Iijimahttps://www.blogger.com/profile/13371090267687503904noreply@blogger.comtag:blogger.com,1999:blog-2815878794992689913.post-58489771731724155122014-12-17T01:30:11.293+00:002014-12-17T01:30:11.293+00:00Hi Mark, thanks for the comment.
I saw the large ...Hi Mark, thanks for the comment.<br /><br />I saw the large warning message when I opened a transformer parameter containing the / operator with the Arithmetic Editor.<br /><br />See this workspace example, which was created with FME 2014 SP5.<br />https://www.dropbox.com/s/3tak0ux1q8t3cmu/141217DivisionOperator_2014.fmw?dl=0<br /><br />Test with FME 2015 b15225:<br />Open the Offsetter Parameters dialog<br />-> Open the Arithmetic Editor for the "Y Offset" parameter<br />-> The warning message appears; close it with [OK] button<br />-> Close the Arithmetic Editor with [Cancel] button<br /><br />Then, if you close the Offsetter Parameters dialog with [Cancel] button, the change will not applied.<br />But if you close the dialog with [OK] button, the change will be applied even though you've closed the Arithmetic Editor with [Cancel].<br />I think it's ideal that the change will not be applied if the Arithmetic Editor has been closed with [Cancel] button.<br /><br />The warning message describes "what's going on", but doesn't describe "what you should do".<br />If the change will be applied anyway when the transformer parameters dialog has been closed with [OK] button, I hope the message will be enhanced so that the user can understand "what you should do".<br />For example, "It is recommended that you explicitly cast the return value from the division operator if you expect it returns an integer value. e.g. @int(3 / 2)."<br />Not sure if it is grammatically correct as an English sentence...Takashi Iijimahttps://www.blogger.com/profile/13371090267687503904noreply@blogger.comtag:blogger.com,1999:blog-2815878794992689913.post-74127564428774511252014-12-16T18:20:44.540+00:002014-12-16T18:20:44.540+00:00Not sure if my comment went through, so here it is...Not sure if my comment went through, so here it is again...<br /><br />We were very careful to avoid just changing the behaviour for existing workspaces, as we knew that would be very bad. So old workspaces will run as they always did.<br /><br />You are correct that opening and closing the transformer will change the behaviour. However, when that happens a very large warning message appears:<br /><br />https://dl.dropboxusercontent.com/u/4200566/Blog-FloatChange.jpg<br /><br />Hope this helps<br /><br />MarkFMEEvangelisthttps://www.blogger.com/profile/00067587737525504257noreply@blogger.comtag:blogger.com,1999:blog-2815878794992689913.post-32709184611424561652014-12-15T12:45:56.935+00:002014-12-15T12:45:56.935+00:00Thanks for sharing the bit about math expressions ...Thanks for sharing the bit about math expressions in FME 2015, that is fantastic news :-)David R.https://www.blogger.com/profile/12477139431737021274noreply@blogger.comtag:blogger.com,1999:blog-2815878794992689913.post-91247074102495659472014-12-15T12:25:28.734+00:002014-12-15T12:25:28.734+00:00Hi David, I didn't know the behavior of the / ...Hi David, I didn't know the behavior of the / operator has been changed in Python 3.<br />Thanks for the information.<br />I strongly agree that explicit is better than implicit.<br /><br />One more information.<br />I heard from Safe that math expressions in FME 2015 will be performed with native C++, will not be passed to Tcl interpreter any longer.<br />Performance should be better than traditional Tcl interpreting.<br />It's a good news :)Takashi Iijimahttps://www.blogger.com/profile/13371090267687503904noreply@blogger.comtag:blogger.com,1999:blog-2815878794992689913.post-47564006742682484192014-12-15T10:23:21.642+00:002014-12-15T10:23:21.642+00:00Hi Takashi,
good read. For what it's worth, t...Hi Takashi,<br /><br />good read. For what it's worth, this change of behavior in FME 2015 mimics the changes in Python 3, where 3 / 2 == 1.5 and 3 // 2 == 1.<br /><br />Details here: https://www.python.org/dev/peps/pep-0238/<br /><br />But I agree, confusion is bound to follow when migrating existing workspaces to FME 2015. But again, the Zen of Python prevails (https://www.python.org/dev/peps/pep-0020/): explicit is better than implicit, so careful use of typecasts will prevent such problems.<br /><br />DavidDavid R.https://www.blogger.com/profile/12477139431737021274noreply@blogger.com