Python Forum
Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Large Number Math
#1
Hi all,

I'm trying to write a calculator to help me with some research that I am doing. I only need the following basic math functions (multiply, divide, add, subtract, square root) but I need exact precision. Also, I am only looking for precise integers, any results with a decimal value are discarded. I have tried utilizing the decimal library but I am running into errors with it, it seems that unless I know the exact level of decimal precision required for each calculation the decimal functions have a tendency to return inaccurate numbers.

Is there a better way to do this? Speed of processing is not so much a factor as accuracy is.
Reply
#2
(Nov-20-2018, 07:15 PM)fibonacci Wrote: but I am running into errors with it

The decimal module is the way to get accuracy, so share your errors please.
Reply
#3
You can also use the Gnu multiprecision library by installing the gmpy2 module. For advanced number theory, you can also use the PARI/GP computer algebra system by installing a module such as cypari or cypari2.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  math.log versus math.log10 stevendaprano 10 2,301 May-23-2022, 08:59 PM
Last Post: jefsummers
  Why getting ValueError : Math domain error in trig. function, math.asin() ? jahuja73 3 3,703 Feb-24-2021, 05:09 PM
Last Post: bowlofred

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020