Mac Niff
Mac Niff

Reputation: 35

How to convert integer to decimal point in PROLOG?

How to convert integer to decimal point in PROLOG? Example, imagine I assign Integer = 10 How do I change integer's value to turn to 1.0 (1 decimal point) ?

Upvotes: 1

Views: 1768

Answers (1)

chs
chs

Reputation: 652

It's not an assignment but Integer is unified with 10 and can't be changed thereafter.

You could write Integer2 is 1.0 * Integer or Integer2 is float(Integer) at least in some Prolog implementations.

Upvotes: 2

Related Questions