Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » Set Real to NaN
Set Real to NaN [message #1838493] Fri, 26 February 2021 11:39 Go to next message
Gunnar Arndt is currently offline Gunnar ArndtFriend
Messages: 82
Registered: June 2012
Member
Is there a way to set Real values in the output model of an ATL transformation to 'Not a Number' (NaN) or other special floating point values, e.g. by dividing by zero?
Thanks.
Re: Set Real to NaN [message #1838509 is a reply to message #1838493] Fri, 26 February 2021 17:32 Go to previous messageGo to next message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 581
Registered: September 2012
Location: Belgium
Senior Member

ATL stores Reals as Java Double values, which support positive and negative Infinity, as well as NaN.

The following code prints "NaN":
query DivisionByZero = (0.0 / 0.0).debug();


The following code prints "Infinity":
query DivisionByZero = (5.0 / 0.0).debug();


The following code prints "-Infinity":
query DivisionByZero = (-5.0 / 0.0).debug();


Cheers,
Dennis
Re: Set Real to NaN [message #1838622 is a reply to message #1838509] Tue, 02 March 2021 15:45 Go to previous message
Gunnar Arndt is currently offline Gunnar ArndtFriend
Messages: 82
Registered: June 2012
Member
Cool, thanks again.
Previous Topic:org.eclipse.m2m.atl.engine.emfvm.VMException
Next Topic:Redefinitions in an extending rule
Goto Forum:
  


Current Time: Sat Nov 11 08:17:37 GMT 2023

Powered by FUDForum. Page generated in 0.01113 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top