Roots

Share your advanced PureBasic knowledge/code with the community.
merendo
Enthusiast
Enthusiast
Posts: 449
Joined: Sat Apr 26, 2003 7:24 pm
Location: Germany
Contact:

Roots

Post by merendo »

Code updated For 5.20+

This is a very simple but accurate and effective way to calculate any types of roots. Wether it is a square-root, a cube-root or anything else... This function can do it.

Code: Select all

    Procedure.f Root(index.f,root.f)
    ProcedureReturn Pow(index,1/root)
    EndProcedure
Simple, isn't it?
The truth is never confined to a single number - especially scientific truth!
User avatar
tinman
PureBasic Expert
PureBasic Expert
Posts: 1102
Joined: Sat Apr 26, 2003 4:56 pm
Location: Level 5 of Robot Hell
Contact:

Post by tinman »

Some discussion about this and rounding errors: viewtopic.php?t=8484&highlight=root
If you paint your butt blue and glue the hole shut you just themed your ass but lost the functionality.
(WinXPhSP3 PB5.20b14)
Post Reply