Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Newton had a fun way to approximate general roots...
#7
for completeness here's how you could use the CRT functions as first approximation
Code: (Select All)
Declare Library
    Function snprintf& (Dest As String, Byval l As Long, frmt As String, Byval x As _Float)
    Function powl## (ByVal x As _Float, Byval y As _Float)
End Declare

Dim As _Float x, y, z, p
Dim As String frmt, s
Dim As Long ok
frmt = "%Lf" + Chr$(0)
x = 3.1415926535897932384626433832795##
p = 0.33333333333333333333##
y = powl(x, p)
s = Space$(64)
frmt = "%.18Lg" + Chr$(0)
ok = snprintf(s, Len(s), frmt, y)
Print s
z = y * y * y
s = Space$(64)
ok = snprintf(s, Len(s), frmt, z)
Print s
Reply


Messages In This Thread
RE: Newton had a fun way to approximate general roots... - by Jack - 09-13-2022, 03:28 PM



Users browsing this thread: 15 Guest(s)