Skip to content

Minimal example of indeterminacy of CGAL::to_double ? #6000

Answered by lrineau
alecjacobson asked this question in Q&A
Discussion options

You must be logged in to vote
c2 = CGAL::to_double(a.exact());
c3 = CGAL::to_double(a);

a.exact() returns the exact type inside a (of type CGAL::Epeck::FT::ET), so c2 is constructed by calling CGAL::to_double(CGAL::Epeck::FT::ET), whereas c3 is constructed by calling CGAL::to_double(CGAL::Epeck::FT). That explains why c2 and c3 differ.

Your function cast_to_double could be implemented that way:

template <typename Lazy_FT>
double cast_to_double(const Lazy_FT& x) {
  x.exact();
  return CGAL::to_double(x);
}

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
4 replies
@afabri
Comment options

@MaelRL
Comment options

@alecjacobson
Comment options

@MaelRL
Comment options

Comment options

You must be logged in to vote
1 reply
@alecjacobson
Comment options

Answer selected by alecjacobson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
4 participants