decfloat -- again
#31
thanks Pete for testing
I only added the Sqr function to the eval but adding the nth root would be easy enough
Reply
#32
Pete, I added the root function, see the previous post
Reply
#33
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
Reply
#34
thanks Pete for testing, edited the code, it now extracts negative number with an odd root
Reply
#35
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
Reply
#36
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
Reply
#37
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
Reply
#38
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)
Reply
#39
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
Reply
#40
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
Reply




Users browsing this thread: 10 Guest(s)