b+ String Math Update
#9
BTW here is copy of proof of concept where I tested this method of Power$ calculation with the QB64 _Float Type:
Code: (Select All)
Option _Explicit
Print power##(8, 1 / 1025)

Function power## (x As _Float, exponent As _Float)
    Dim step1 As _Float
    step1 = exponent * nLn##(x)
    power## = eToTheX##(step1)
End Function


Function nLn## (x As _Float)
    Dim As _Float term, xbase, coef, sum, newsum
    Dim As Long k, count, kPower
    sum = 0
    term = (x - 1) / (x + 1)
    k = 0
    xbase = 1
    Do
        sum = newsum
        coef = 2 / (2 * k + 1) ' 2
        kPower = 2 * k + 1 ' 1
        While count < kPower
            xbase = xbase * term
            count = count + 1
        Wend
        newsum = sum + coef * xbase
        k = k + 1
    Loop Until sum = newsum
    nLn## = sum
End Function

Function eToTheX## (x As _Float)
    Dim As _Float sum
    Dim As Long n, i
    sum = 1: n = 50
    For i = n - 1 To 1 Step -1
        sum = 1 + x * sum / i
    Next
    eToTheX## = sum
End Function
b = b + ...
Reply


Messages In This Thread
b+ String Math Update - by bplus - 09-26-2022, 06:01 PM
RE: b+ String Math Update - by Pete - 09-26-2022, 06:27 PM
RE: b+ String Math Update - by bplus - 09-26-2022, 06:38 PM
RE: b+ String Math Update - by Pete - 09-26-2022, 06:53 PM
RE: b+ String Math Update - by vince - 09-29-2022, 03:16 AM
RE: b+ String Math Update - by bplus - 09-29-2022, 09:26 AM
RE: b+ String Math Update - by Pete - 09-29-2022, 07:59 PM
RE: b+ String Math Update - by bplus - 10-01-2022, 05:22 PM
RE: b+ String Math Update - by bplus - 10-01-2022, 05:30 PM
RE: b+ String Math Update - by Pete - 10-01-2022, 06:09 PM
RE: b+ String Math Update - by bplus - 10-01-2022, 06:45 PM
RE: b+ String Math Update - by bplus - 10-02-2022, 01:49 AM



Users browsing this thread: 2 Guest(s)