Subject: [SWIPL] How to convert atoms to reals

From: João Mariz <[email-masked]>
Date: Tue, 22 May 2001 17:39:57 +0100

Hello SWI-Prolog users,

I am sorry for taking your time with such simple questions.

However, I am trying to convert code from another prolog interpreter,
and I am still a newbie in SwiProlog and xpce. Althought I spend several
hours searching in the users guide for predicates that could resolve me
this question and I did not succeed.

So please tell me how can I convert from an atom to a real to preform
later some calculations? Or where can I find this answers in the Users
Guide.
Thanks in advance for any help you can provide,

João

Example for the XPCE code,

ask_number:-
    new(Dialog, dialog('Ask for a Real')),
    send(Dialog, append, new(Fi, text_item('Float'))),
    send(Dialog, append, button(ok, and(message(@prolog,  print_floatn,
Fi?selection)   ,

message(Dialog, destroy))
             )                                       ),
    send(Dialog, open).

print_floatn(X):- /* X should be a float */
   Y is X * 1.1, nl, nl,
   write('X x 1.1 = ') , write(Y).