| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Cube root |
Hi Mike, On Wednesday December 06 1995, Mike Bilow wrote from 1:323/107 to Mike Fisher: MF>> ie. in Pascal, to calculate the Qth root of P ... MF>> root:=exp(ln(P)/Q); MB> Am I really missing something here, or does Pascal have no support MB> for direct exponentiation? The Qth root of P is equal to P raised to MB> the 1/Q power. Using C, it is a heck of a lot more efficient to MB> compute a Qth root as such: MB> double P, Q, root; MB> root = pow(P, 1.0 / Q); MB> It is perfectly legal and valid to use logarithmic calculations, but MB> why? Not knowing the particular compiler and associated link library used by the person to whom I was writing I quoted "standard" Pascal which all respectable compilers should be capable of handling. The compiler I use _does_ have a "power" function, and that which he uses _may_ have it as well. However, not being sure about that, I gave him something which I know will work even if not the fastest code. :-) Best regards, Mike. --- GoldED 2.50+* Origin: ROOTS (UK!) (2:440/50) SEEN-BY: 270/101 620/243 711/401 409 410 413 430 807 808 809 934 955 712/407 SEEN-BY: 712/515 517 628 713/888 800/1 7877/2809 @PATH: 440/50 4 141/209 270/101 712/515 711/808 809 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.