# [SciPy-user] Can SciPy compute ln(640320**3 + 744)/163**.5 to 30 places?

Dick Moores rdm at rcblue.com
Mon Jan 15 12:45:44 CST 2007

```Of, course! I forgot about integer division. Thanks, Vincent and Darren.

But I still don't get the precision:
==========================
# clnumTest3-c.py
from __future__ import division
import clnum as n
n.set_default_precision(40)
print repr(n.exp(n.log(5/23)*2/7))
=========================
gets mpf('0.6466073240654112295',17)

How come?

Dick

At 09:54 AM 1/15/2007, you wrote:
>Try putting:
>
>from __future__ import division
>
>At the top of your program. This wil make division on integers act like
>'true' division.
>
>Then your calculation will work fine:
>
>In [1]: from __future__ import division
>In [2]: import numpy as n
>In [3]: n.exp(n.log(5/23)*2/7)
>0.646607324065
>
>Vincent
>
>
>On 1/15/07 10:52 AM, "Dick Moores" <rdm at rcblue.com> wrote:
>
> > That's great! Thanks!
> >
> > Now, how about something such as (5/23)**(2/7)?
> > print repr(n.exp(n.log(5/23)*2/7))
> > gets ValueError: log domain error
> >
> > Dick
> >
> > At 06:45 AM 1/15/2007, you wrote:
> >
> >> Hi,
> >>
> >> You should really ask the clnum guy, but I think you need to use exp()
> >> and log() instead of pow().  Also, you have to use only integers.
> >>
> >> pow(x,y) = exp(log(x)*y)
> >>
> >>
> >> from clnum import *
> >> set_default_precision(50)
> >> exp(log(2)*39/10)
> >>
> >> which gives:
> >>
> >> mpf('14.92852786458891865570149225839907467243567942962390462241',55)
> >>
> >> -Frank
> >>
> >>
> >> Dick Moores wrote:
> >>> I hope I may ask another question. I'd like to know how use clnum to
> >>> calculate 2**3.9 to a precision of 40. I looked carefully at
> >>> http://calcrpnpy.sourceforge.net/clnumManual.html and tried various
> >>> things, but to no avail.
> >>>
> >>> Despite these words in the manual:
> >>>
> >>> "Most of the functions in the clnum module are arbitrary precision
> >>> floating point versions of Python builtins. See the Python
> >>> documentation in the math, cmath, and builtins sections for the
> >>> following functions: acos, acosh, asin, asinh, atan, atan2, atanh,
> >>> ceil, cos, cosh, degrees, exp, floor, hypot, log, log10, radians,
> >>> round, sin, sinh, sqrt, tan, and tanh."
> >>>
> >>> it seems there is no clnum.pow(). Help, please.
> >>>
> >>> Thanks,
> >>>
> >>> Dick Moores
> >>> _______________________________________________
> >>> SciPy-user mailing list
> >>> SciPy-user at scipy.org
> >>> http://projects.scipy.org/mailman/listinfo/scipy-user
> >>>
> >>
> >> _______________________________________________
> >> SciPy-user mailing list
> >> SciPy-user at scipy.org
> >> http://projects.scipy.org/mailman/listinfo/scipy-user
> >
> >
> > _______________________________________________
> > SciPy-user mailing list
> > SciPy-user at scipy.org
> > http://projects.scipy.org/mailman/listinfo/scipy-user
> >
>
>--
>Vincent R. Nijs
>Assistant Professor of Marketing
>Kellogg School of Management, Northwestern University
>2001 Sheridan Road, Evanston, IL 60208-2001
>Phone: +1-847-491-4574 Fax: +1-847-491-2498
>E-mail: v-nijs at kellogg.northwestern.edu
>Skype: vincentnijs
>
>
>
>_______________________________________________
>SciPy-user mailing list
>SciPy-user at scipy.org
>http://projects.scipy.org/mailman/listinfo/scipy-user

```