QB64 Phoenix Edition
decfloat -- again - Printable Version

+- QB64 Phoenix Edition (https://staging.qb64phoenix.com)
+-- Forum: QB64 Rising (https://staging.qb64phoenix.com/forumdisplay.php?fid=1)
+--- Forum: Code and Stuff (https://staging.qb64phoenix.com/forumdisplay.php?fid=3)
+---- Forum: Programs (https://staging.qb64phoenix.com/forumdisplay.php?fid=7)
+---- Thread: decfloat -- again (/showthread.php?tid=886)

Pages: 1 2 3 4 5


RE: decfloat -- again - Jack - 10-14-2022

thanks Pete for testing
I only added the Sqr function to the eval but adding the nth root would be easy enough


RE: decfloat -- again - Jack - 10-14-2022

Pete, I added the root function, see the previous post


RE: decfloat -- again - Pete - 10-14-2022

This looks promising. Please check this. I put in root(-27, 3) and got 3. It should report -3. What impressed me was how fast it produced root(8, 500). For string math, anything over 200th root started to take a noticeable time to produce.

Pete


RE: decfloat -- again - Jack - 10-14-2022

thanks Pete for testing, edited the code, it now extracts negative number with an odd root


RE: decfloat -- again - Pete - 10-14-2022

Yep, "It's always something." This is so cool. I really wish I could wrap my head around bit flipping, but it just doesn't come together for me. Too strung out on strings, I guess.

Pete


RE: decfloat -- again - Jack - 10-14-2022

just in case you are interested, I changed the exponential ^ operator to use integer power if the right-hand side is integer, that allows raising negative numbers to some integer power


RE: decfloat -- again - Pete - 10-14-2022

Good idea.

Curious. How far can bit-flipping go and maintain accuracy? For instance, string math can go on for several thousands of digits before certain _INTEGER64 loops would be exceeded.

Pete


RE: decfloat -- again - Jack - 10-14-2022

I don't know how far you could go but it gets slow once you go pass 10000 digits
btw, changed the code again to take into account negative integer powers, so this works (-2)^(-3)


RE: decfloat -- again - Pete - 10-14-2022

String math holds together pretty well at 10,000 digits for regular arthritic, but powers and roots of a few hundreds make it run stupid slow. Bit flipping seems to handle those operations at a much better rate of speed.

Pete


RE: decfloat -- again - Jack - 10-25-2022

I think that it's pretty much finished now, the library includes log, exp, sqr, nroot and trig functions plus an eval function

test1

deleted due to lack of interest Sad