Alexei<br>Thanks for answering my question. I think I understand what to do. Suppose I say,<br>cln_R x = 3.4;<br>then I computer exp(x),<br>now I convert it to cln_F,<br>Can I do so at any precision. Is exp(x) just a symbolic computation, and does the actual computation come about only when converting to a cln_F?<br>
<br>Thanks<br><br><br><div class="gmail_quote">On Tue, May 18, 2010 at 4:45 PM, <span dir="ltr"><<a href="mailto:cln-list-request@ginac.de">cln-list-request@ginac.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Send CLN-list mailing list submissions to<br>
<a href="mailto:cln-list@ginac.de">cln-list@ginac.de</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
<a href="https://www.cebix.net/mailman/listinfo/cln-list" target="_blank">https://www.cebix.net/mailman/listinfo/cln-list</a><br>
or, via email, send a message with subject or body 'help' to<br>
<a href="mailto:cln-list-request@ginac.de">cln-list-request@ginac.de</a><br>
<br>
You can reach the person managing the list at<br>
<a href="mailto:cln-list-owner@ginac.de">cln-list-owner@ginac.de</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of CLN-list digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
1. confusion with cln::cl_F and cln::cl_R (Joshua Friedman)<br>
2. Re: confusion with cln::cl_F and cln::cl_R (Alexei Sheplyakov)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Tue, 18 May 2010 11:22:25 -0400<br>
From: Joshua Friedman <<a href="mailto:crowneagle@gmail.com">crowneagle@gmail.com</a>><br>
To: <a href="mailto:cln-list@ginac.de">cln-list@ginac.de</a><br>
Subject: [CLN-list] confusion with cln::cl_F and cln::cl_R<br>
Message-ID:<br>
<<a href="mailto:AANLkTimibjqTFsn4dXLgX946oMrL7E7rmMaiu-eEZFVk@mail.gmail.com">AANLkTimibjqTFsn4dXLgX946oMrL7E7rmMaiu-eEZFVk@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="windows-1252"<br>
<br>
The program runs when I define "bigF = cln_R", but I get errors when I set<br>
"bigF = cln_F"<br>
I found that the exponential function only gives many digits of precision<br>
when I use cln_F.<br>
I am attaching my program and the out put is below:<br>
<br>
fuji:rama joshua$ make<br>
g++ -DHAVE_CONFIG_H -I. -I../include -I../include -g -O2 -MT e.o -MD -MP<br>
-MF .deps/e.Tpo -c -o e.o e.cc<br>
In file included from /usr/include/c++/4.0.0/backward/iostream.h:31,<br>
from e.cc:1:<br>
/usr/include/c++/4.0.0/backward/backward_warning.h:32:2: warning: #warning<br>
This file includes at least one deprecated or antiquated header. Please<br>
consider using one of the 32 headers found in section 17.4.1.2 of the C++<br>
standard. Examples include substituting the <X> header for the <X.h> header<br>
for C++ includes, or <iostream> instead of the deprecated header<br>
<iostream.h>. To disable this warning use -Wno-deprecated.<br>
e.cc: In function ?bigF h(bigF, bigF*, int, int, int)?:<br>
e.cc:233: error: conversion from ?const cln::cl_N? to non-scalar type ?bigF?<br>
requested<br>
e.cc: In function ?bigF ff(bigF, bigF, bigF*, int, int, int)?:<br>
e.cc:251: error: no match for ?operator=? in ?q = cln::operator*(const<br>
cln::cl_R&, const cln::cl_R&)(((const cln::cl_R&)(& cln::exp(const<br>
cln::cl_R&)())))?<br>
../include/cln/float_class.h:40: note: candidates are: cln::cl_F&<br>
cln::cl_F::operator=(const cln::cl_F&)<br>
../include/cln/float_class.h:47: note: cln::cl_F&<br>
cln::cl_F::operator=(float)<br>
../include/cln/float_class.h:48: note: cln::cl_F&<br>
cln::cl_F::operator=(double)<br>
e.cc:258: error: conversion from ?const cln::cl_N? to non-scalar type ?bigF?<br>
requested<br>
e.cc: In function ?bigF v(bigF, bigF*, int, int, int)?:<br>
e.cc:275: error: conversion from ?int? to ?cln::cl_F? is ambiguous<br>
../include/cln/float_class.h:38: note: candidates are:<br>
cln::cl_F::cl_F(cln::cl_anything*)<br>
../include/cln/float_class.h:26: note: cln::cl_F::cl_F(const<br>
char*)<br>
../include/cln/float_class.h:48: note:<br>
cln::cl_F::cl_F(double)<br>
../include/cln/float_class.h:47: note:<br>
cln::cl_F::cl_F(float)<br>
e.cc:276: error: conversion from ?int? to ?cln::cl_F? is ambiguous<br>
../include/cln/float_class.h:38: note: candidates are:<br>
cln::cl_F::cl_F(cln::cl_anything*) <near match><br>
../include/cln/float_class.h:26: note: cln::cl_F::cl_F(const<br>
char*) <near match><br>
../include/cln/float_class.h:48: note:<br>
cln::cl_F::cl_F(double)<br>
../include/cln/float_class.h:47: note:<br>
cln::cl_F::cl_F(float)<br>
e.cc:281: error: no match for ?operator=? in ?w = cln::operator*(const<br>
cln::cl_R&, const cln::cl_R&)(((const cln::cl_R&)((const cln::cl_R*)(&<br>
w.cln::cl_F::<anonymous>))))?<br>
../include/cln/float_class.h:40: note: candidates are: cln::cl_F&<br>
cln::cl_F::operator=(const cln::cl_F&)<br>
../include/cln/float_class.h:47: note: cln::cl_F&<br>
cln::cl_F::operator=(float)<br>
../include/cln/float_class.h:48: note: cln::cl_F&<br>
cln::cl_F::operator=(double)<br>
e.cc:283: error: ambiguous overload for ?operator=? in ?q = 0?<br>
../include/cln/float_class.h:40: note: candidates are: cln::cl_F&<br>
cln::cl_F::operator=(const cln::cl_F&)<br>
../include/cln/float_class.h:47: note: cln::cl_F&<br>
cln::cl_F::operator=(float)<br>
../include/cln/float_class.h:48: note: cln::cl_F&<br>
cln::cl_F::operator=(double)<br>
e.cc:289: error: no match for ?operator=? in ?q = cln::operator*(const<br>
cln::cl_R&, const cln::cl_R&)(((const cln::cl_R&)(& cln::exp(const<br>
cln::cl_R&)())))?<br>
../include/cln/float_class.h:40: note: candidates are: cln::cl_F&<br>
cln::cl_F::operator=(const cln::cl_F&)<br>
../include/cln/float_class.h:47: note: cln::cl_F&<br>
cln::cl_F::operator=(float)<br>
../include/cln/float_class.h:48: note: cln::cl_F&<br>
cln::cl_F::operator=(double)<br>
e.cc:294: error: conversion from ?const cln::cl_N? to non-scalar type ?bigF?<br>
requested<br>
e.cc: In function ?bigF integralH(bigF*, int, int, int, int)?:<br>
e.cc:312: error: ambiguous overload for ?operator=? in ?aa = 1?<br>
../include/cln/float_class.h:40: note: candidates are: cln::cl_F&<br>
cln::cl_F::operator=(const cln::cl_F&)<br>
../include/cln/float_class.h:47: note: cln::cl_F&<br>
cln::cl_F::operator=(float)<br>
../include/cln/float_class.h:48: note: cln::cl_F&<br>
cln::cl_F::operator=(double)<br>
e.cc:313: error: ambiguous overload for ?operator=? in ?b = 20?<br>
../include/cln/float_class.h:40: note: candidates are: cln::cl_F&<br>
cln::cl_F::operator=(const cln::cl_F&)<br>
../include/cln/float_class.h:47: note: cln::cl_F&<br>
cln::cl_F::operator=(float)<br>
../include/cln/float_class.h:48: note: cln::cl_F&<br>
cln::cl_F::operator=(double)<br>
e.cc:317: error: conversion from ?int? to ?cln::cl_F? is ambiguous<br>
../include/cln/float_class.h:38: note: candidates are:<br>
cln::cl_F::cl_F(cln::cl_anything*)<br>
../include/cln/float_class.h:26: note: cln::cl_F::cl_F(const<br>
char*)<br>
../include/cln/float_class.h:48: note:<br>
cln::cl_F::cl_F(double)<br>
../include/cln/float_class.h:47: note:<br>
cln::cl_F::cl_F(float)<br>
e.cc:320: error: ambiguous overload for ?operator=? in ?w = 0?<br>
../include/cln/float_class.h:40: note: candidates are: cln::cl_F&<br>
cln::cl_F::operator=(const cln::cl_F&)<br>
../include/cln/float_class.h:47: note: cln::cl_F&<br>
cln::cl_F::operator=(float)<br>
../include/cln/float_class.h:48: note: cln::cl_F&<br>
cln::cl_F::operator=(double)<br>
e.cc:321: error: conversion from ?int? to ?cln::cl_F? is ambiguous<br>
../include/cln/float_class.h:38: note: candidates are:<br>
cln::cl_F::cl_F(cln::cl_anything*) <near match><br>
../include/cln/float_class.h:26: note: cln::cl_F::cl_F(const<br>
char*) <near match><br>
../include/cln/float_class.h:48: note:<br>
cln::cl_F::cl_F(double)<br>
../include/cln/float_class.h:47: note:<br>
cln::cl_F::cl_F(float)<br>
e.cc: In function ?bigF integralL(bigF*, int, int, int, int)?:<br>
e.cc:339: error: ambiguous overload for ?operator=? in ?b = 1?<br>
../include/cln/float_class.h:40: note: candidates are: cln::cl_F&<br>
cln::cl_F::operator=(const cln::cl_F&)<br>
../include/cln/float_class.h:47: note: cln::cl_F&<br>
cln::cl_F::operator=(float)<br>
../include/cln/float_class.h:48: note: cln::cl_F&<br>
cln::cl_F::operator=(double)<br>
e.cc:346: error: ambiguous overload for ?operator=? in ?w = 0?<br>
../include/cln/float_class.h:40: note: candidates are: cln::cl_F&<br>
cln::cl_F::operator=(const cln::cl_F&)<br>
../include/cln/float_class.h:47: note: cln::cl_F&<br>
cln::cl_F::operator=(float)<br>
../include/cln/float_class.h:48: note: cln::cl_F&<br>
cln::cl_F::operator=(double)<br>
make: *** [e.o] Error 1<br>
fuji:rama joshua$ make<br>
<br>
<br>
<br>
<br>
<br>
--<br>
Joshua Friedman PhD<br>
<a href="mailto:CrownEagle@gmail.com">CrownEagle@gmail.com</a><br>
<a href="http://www.math.sunysb.edu/%7Ejoshua" target="_blank">http://www.math.sunysb.edu/~joshua</a><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://www.cebix.net/pipermail/cln-list/attachments/20100518/5dda878b/attachment-0001.htm" target="_blank">http://www.cebix.net/pipermail/cln-list/attachments/20100518/5dda878b/attachment-0001.htm</a>><br>
-------------- next part --------------<br>
A non-text attachment was scrubbed...<br>
Name: e.cc<br>
Type: application/octet-stream<br>
Size: 8206 bytes<br>
Desc: not available<br>
URL: <<a href="http://www.cebix.net/pipermail/cln-list/attachments/20100518/5dda878b/attachment-0001.dll" target="_blank">http://www.cebix.net/pipermail/cln-list/attachments/20100518/5dda878b/attachment-0001.dll</a>><br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Tue, 18 May 2010 23:37:49 +0300<br>
From: Alexei Sheplyakov <<a href="mailto:alexei.sheplyakov@gmail.com">alexei.sheplyakov@gmail.com</a>><br>
To: CLN discussion list <<a href="mailto:cln-list@ginac.de">cln-list@ginac.de</a>><br>
Subject: Re: [CLN-list] confusion with cln::cl_F and cln::cl_R<br>
Message-ID: <<a href="mailto:20100518203749.GA14186@vargsbox.jinr.ru">20100518203749.GA14186@vargsbox.jinr.ru</a>><br>
Content-Type: text/plain; charset=utf-8<br>
<br>
Hello,<br>
<br>
On Tue, May 18, 2010 at 11:22:25AM -0400, Joshua Friedman wrote:<br>
> The program runs when I define "bigF = cln_R", but I get errors when I set<br>
> "bigF = cln_F"<br>
> I found that the exponential function only gives many digits of precision<br>
> when I use cln_F.<br>
> I am attaching my program and the out put is below:<br>
[skipped]<br>
<br>
Here's a simpler example which illustrates the problem.<br>
<br>
$ cat noconv.cc<br>
<br>
#include <cln/cln.h><br>
<br>
cln::cl_F foo(const cln::cl_F& x)<br>
{<br>
cln::cl_F one = 1;<br>
return one;<br>
}<br>
<br>
This code won't compile because CLN does not provide implicit conversion<br>
of exact numbers (such as integers) into inexact ones (i.e. floating<br>
point ones):<br>
<br>
g++ -c noconv.cc `pkg-config --libs --cflags cln`<br>
noconv.cc: In function ?cln::cl_F foo(const cln::cl_F&)?:<br>
noconv.cc:5: error: conversion from ?int? to ?cln::cl_F? is ambiguous<br>
/home/varg/target/x86_64-linux-gnu/include/cln/float_class.h:38: note: candidates are: cln::cl_F::cl_F(cln::cl_anything*) <near match><br>
/home/varg/target/x86_64-linux-gnu/include/cln/float_class.h:26: note: cln::cl_F::cl_F(const char*) <near match><br>
/home/varg/target/x86_64-linux-gnu/include/cln/float_class.h:48: note: cln::cl_F::cl_F(double)<br>
/home/varg/target/x86_64-linux-gnu/include/cln/float_class.h:47: note: cln::cl_F::cl_F(float)<br>
<br>
<br>
One should use an appropriate cl_float function, i.e.<br>
<br>
#include <cln/cln.h><br>
<br>
cln::cl_F foo(const cln::cl_F& x)<br>
{<br>
cln::cl_F one = cln::cl_float(1, x);<br>
// Constructs a floating-point number representing 1 with the same<br>
// mantissa size as that of x<br>
return one;<br>
}<br>
<br>
<br>
I admit this is a bit annoying, but debugging issues due to implicit<br>
conversions is even more annoying.<br>
<br>
Best regards,<br>
Alexei<br>
<br>
<br>
<br>
------------------------------<br>
<br>
_______________________________________________<br>
CLN-list mailing list<br>
<a href="mailto:CLN-list@ginac.de">CLN-list@ginac.de</a><br>
<a href="https://www.cebix.net/mailman/listinfo/cln-list" target="_blank">https://www.cebix.net/mailman/listinfo/cln-list</a><br>
<br>
<br>
End of CLN-list Digest, Vol 49, Issue 3<br>
***************************************<br>
</blockquote></div><br><br clear="all"><br>-- <br>Joshua Friedman PhD<br><a href="mailto:CrownEagle@gmail.com">CrownEagle@gmail.com</a><br><a href="http://www.math.sunysb.edu/~joshua">http://www.math.sunysb.edu/~joshua</a><br>