Discussions related to Visual Prolog

Martin Meyer
 VIP Member
 Posts: 294
 Joined: 14 Nov 2002 0:01
Unread post
by Martin Meyer » 29 Apr 2013 12:34
Hello Thomas, hi all,
this compiles and outputs "X is infinity_positive":
Code: Select all
...
X = math::infinity_positive,
if X = math::infinity_positive then
stdIo::write("X is infinity_positive")
end if.
...
On that however the compiler (7.4 build 7401) throws error c224 : The value 1.#INF is out of the range [ 1.79769313486232e+308 .. 1.79769313486232e+308 ] for the domain '::real':
Code: Select all
...
X = math::infinity_positive,
test(X),
...
class predicates
test : (real X).
clauses
test(math::infinity_positive):
!,
stdIo::write("X is infinity_positive").
test(_).
Is it a bug? If not, please explain how to use
math::infinity_positive and similar constants of class
math correctly.
Thank you,
Martin

Thomas Linder Puls
 VIP Member
 Posts: 1635
 Joined: 28 Feb 2000 0:01
Unread post
by Thomas Linder Puls » 30 Apr 2013 13:39
The standard defining the real/floating point representation used on our processor defines these special patterns that does not represent a number but some metavalue(s).
We have defined the corresponding bit patterns without really considering what it should mean for Visual Prolog and how we intend them to be used.
The compiler does not pay any special attention to these constants, so in cases where the compiler itself needs a number it may issue the error you see, and in cases where the compiler just needs a bit pattern it will not react to these values. From a language semantics point of view you can say that the semantics of these values is underspecified.
I am not sure if or when we will deal with this underspecification.
Regards Thomas Linder Puls
PDC