From joao.mariz@mail.ineti.pt Tue May 22 18:31:15 2001
Received: from mail.ineti.pt ([193.136.150.130])
	by swi.psy.uva.nl (8.11.2/8.11.2) with ESMTP id f4MGVB308139
	for <prolog@swi.psy.uva.nl>; Tue, 22 May 2001 18:31:15 +0200 (MET DST)
Received: from mail.ineti.pt (pc_4.ineti.pt [193.136.150.120]) by mail.ineti.pt with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13)
	id LL93FA86; Tue, 22 May 2001 17:28:09 +0100
Message-ID: <3B0A965D.BB28EA0D@mail.ineti.pt>
Date: Tue, 22 May 2001 17:39:57 +0100
From: =?iso-8859-1?Q?Jo=E3o?= Mariz <joao.mariz@mail.ineti.pt>
X-Mailer: Mozilla 4.72 [en] (Win98; I)
X-Accept-Language: en
MIME-Version: 1.0
To: Swi-PROLOG usergroup <prolog@swi.psy.uva.nl>
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Subject: [SWIPL] How to convert atoms to reals

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).

