Precision Math Software - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1) +--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3) +---- Forum: Help Me! (https://qb64phoenix.com/forum/forumdisplay.php?fid=10) +---- Thread: Precision Math Software (/showthread.php?tid=1600) Pages:
1
2
|
Precision Math Software - dISP - 04-03-2023 Hi, I am new to this forum so you wont recognize my user name (diSP stands for Drew is a stupid programmer - I couldn't even get the caps right). I'm looking for precision math software to run in QB64. Basically, Functions or Subs that can perform decimal math calcs (add, subtract, multiply, divide, etc...) on the whole spectrum of very small and very large numbers. Background: My own for-fun fractal program looses iteration precision and could go far deeper with precision calculations. I have successfully implemented a decimal math package from a user on another site and it worked great except for one thing. A 1.264 second (using my baseline machine math) Mandelbrot iteration took (or would have took) 8 hours. I soon realized that although hundreds to thousands of units of precision are great they take too long for an iteration that only needs 30-50 place precision calculations. Ideally I'd like to find a precision decimal math package that goes no longer than 30-50 precision or even better lets me assign the precision so the algorithms don't go crazy and start managing giant strings that aren't needed and tie up my CPU. I am a retired Chem Eng. who just likes to play with Basic (QB64) programming. I am a low level programmer so things can get over my head. To that end I am looking for a fast but not highly technical package. Something an everyday programmer can get a grip on. A user on another forum suggested there is a QB64 library call xscript which I have not found a lot on. I also took a look at GMP which seems to run in C+ and I am not sure it is very reasonable to try to force into QB64. It also may be a bit comprehensive for me. Any ideas would be appreciated. >Best Regards -disp RE: Precision Math Software - bplus - 04-03-2023 Hi @dISP welcome to this forum. We already talked about String math, not fast enough... but I bet @jack might have some ideas! RE: Precision Math Software - Jack - 04-03-2023 hi dISP I wrote some decimal math routines but for your use it would be way too slow, I think that gmp or mpfr would be a better choice https://qb64forum.alephc.xyz/index.php?topic=1175.0 RE: Precision Math Software - RhoSigma - 04-03-2023 I'm not really deep in such kind of math, but maybe this C-Library from our Wiki might help: https://qb64phoenix.com/qb64wiki/index.php/C_Libraries#Fast_Math RE: Precision Math Software - Jack - 04-03-2023 dISP I tested my math routines which have about 60 digits of precision against double division in a loop from 1 to 100000000 took .383 seconds in double whereas my routines took 260 seconds, that's about 679 times slower the sin function in a loop from 1 to 10000000 took .45 seconds in double, my routines took 361 seconds, about 802 times slower RE: Precision Math Software - mnrvovrfc - 04-03-2023 That's better than what Roscoe P. Coltrane usually called Enis (not sure of his name but it sounded like this), his assistant in "Dukes of Hazzard" comedy/television show I saw in the 1980's. Rumors had it that Enis was good enough much later to become LAPD officer, but even so Daisy refused to marry him. Welcome to the forums, dISP(lay). What I wrote on the top demonstrates my top talent. Also trying my best to be like Pete. RE: Precision Math Software - dISP - 04-03-2023 Thanks for the thoughts Jack. So gmp and mpfr will work OK inserted into the QB64 IDE? They'll just have a little bit of a C look to their usage? Is either one simpler to implement than the other for most of the speed? RE: Precision Math Software - dISP - 04-03-2023 Thanks RhoSigma - i'll take a look see. RE: Precision Math Software - Jack - 04-03-2023 I have not timed gmp vs mpfr but mpfr uses gmp for implementing their arithmetic functions it's possible that gmp might be a bit faster in basic arithmetic but it lacks trig and exponential functions RE: Precision Math Software - dISP - 04-03-2023 Ok -thanks Jack. Ive took a very, very brief look at mpfr but, didn't want to bother jumping in and screwing around with some qb64 test code only to find it doesn't work in basic. Sounds like its fine for use inside qb64 so i'll give it it a try. thanks again guys. |