Re: [eclipse-clp-users] How to handle double values in eclipse clp?

From: Sergii Dymchenko <kit1980_at_gmail.com>
Date: Sun, 19 May 2013 12:20:45 -0700
I think 'floats' in ECLiPSe are double precision.

Compare ECLiPSe:

$ X is float(pi).
X = 3.1415926535897931

with C++:

#include <iostream>
#include <cmath>
int main() {
  float float_pi = M_PI;
  double double_pi = M_PI;
  std::cout.precision(17);
  std::cout << "float:  " << float_pi << std::endl;
  std::cout << "double: " << double_pi << std::endl;
}

float:  3.1415927410125732
double: 3.1415926535897931

Sergii.


On Sun, May 19, 2013 at 4:16 AM, Hadeer Diwan <hadeer.diwan_at_gmail.com>wrote:

> Hello,
> I wanted to ask a question regarding data types in eclipse clp. I am using
> the following code and i want to change it so that it handles double values
> for the cost. I was able to make it handle floating point values by adding
> float(Result, Cost). How can i refine it to handle double values?
> search_min(List,Dists,Cost) :-
> Result $= sum(Dists),
>         float(Result,Cost),
>         minimize(labeling(List),Cost).
> --
> Best Regards,
> Hadeer Diwan
>
>
> ------------------------------------------------------------------------------
> AlienVault Unified Security Management (USM) platform delivers complete
> security visibility with the essential security capabilities. Easily and
> efficiently configure, manage, and operate all of your security controls
> from a single console and one unified framework. Download a free trial.
> http://p.sf.net/sfu/alienvault_d2d
> _______________________________________________
> ECLiPSe-CLP-Users mailing list
> ECLiPSe-CLP-Users_at_lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users
>
>
Received on Sun May 19 2013 - 19:21:08 CEST

This archive was generated by hypermail 2.2.0 : Mon May 20 2013 - 06:13:34 CEST