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