Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Getting output always in double format?

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Getting output always in double format?


Chronological Thread 
  • From: Martin Baeker <>
  • To:
  • Subject: Re: [cgal-discuss] Getting output always in double format?
  • Date: Tue, 28 Aug 2007 14:22:21 +0200 (CEST)
  • Organization: Institut fuer Werkstoffe TU Braunschweig

Thanks a lot for the information, that will be helpful.

I'm thinking of adding a kind of global output-parameter which I can
switch to switch the output in the desired way, so the line would look
somewhat like

if (doTheDoubleOutput)
return s << to_double(r);
else
return s << r;

This should hopefully not get me into too much trouble.

Might perhaps be even nicer to add this functionality to the stream
itself so that different streams can get different output styles. This
could probably be done similarly to the IO::mode-stuff where you can
do pretty-printing or binary output, right?

Best regards,

Martin.

> > Is it possible to change the output format so that instead of points
> > being output as fractions when using exact number types, they get
> > automatically converted to doubles, so that I would get
> >
> > 84.20... instead of
> > 9.5827368501575693e+20/1.1379770555658617e+19
> >
> > I'm using these number types
> > typedef CGAL::Quotient<CGAL::MP_Float> NT;
> > typedef CGAL::Cartesian<NT> TutorialR;
>
> No, this is not possible. The quotient always outputs itself as
> numerator/denominator (not much else would make sense in general).
>
> > If this functionality is not provided, would it be possible to change
> > the definition of operator<<?If so, where would I find it?
>
> The operator is defined in the file include/CGAL/Quotient.h. You would need
> to
> change its body to "return s << to_double(r);" I would recommend to invent a
> new function for this, though, instead of changing CGAL code.
>
> Best,
> Bernd.
> --
> You are currently subscribed to cgal-discuss.
> To unsubscribe or access the archives, go to
> https://lists-sop.inria.fr/wws/info/cgal-discuss
>

Priv.-Doz. Dr. Martin Bäker
Institut für Werkstoffe
Technische Universität Braunschweig
Langer Kamp 8
38106 Braunschweig
Germany
Tel.: 00-49-531-391-3073
Fax 00-49-531-391-3058
e-mail
<>





Archive powered by MHonArc 2.6.16.

Top of Page