Page 1 of 1
Root()
Posted: Thu Mar 25, 2004 7:34 pm
by Psychophanta
Code updated for 5.20+
This is stupid for those who know a little bit maths.
But this could be a "trick" for those who are ignorants in maths and want a Root(a,n) funtion.
As an assignment from Einander, i began to do an ASM Procedure to return the "n" root of a number value.
I realized that Pow(a.f,1/n.f) is just the wanted function.
Code: Select all
Procedure.f Root(a.f, n.f)
ProcedureReturn Pow(a, 1/n)
EndProcedure
Posted: Fri Mar 26, 2004 7:19 am
by Guimauve
I have coded the same procedure 4 month ago.
(Désolé le source est en français.)
Code: Select all
; ××××××××××××××××××××××××××××××××××××××××××××××××××××××
; Fonction Racine
; Version 1.0 Finale
; Programmation = OK
; Programmé par : Guimauve
; Date : 24 novembre 2003
; Codé avec PureBasic V3.80
; ××××××××××××××××××××××××××××××××××××××××××××××××××××××
Procedure.f Root(nombre.f,puissance.f)
ProcedureReturn Pow(nombre, (1 / puissance))
EndProcedure
; La procédure Root(nombre.f,puissance.f)
; Fonctionnement :
; nombre.f est le nombre dont on veut extraire la racine
; puissance.f désigne le type de racine
; Donc si puissance est égale à :
; Valeur Correspondance mathématique
; 2 ----------------------> Racine carré
; 3 ----------------------> Racine cubique
; 4 ----------------------> Racine 4e
; 5 ----------------------> Racine 5e
; 6 ----------------------> Racine 6e
; X ----------------------> Racine Xe
; /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
; TRÈS IMPORTANT PUISSANCE NE DOIT JAMAIS ÊTRE
; ÉGALE À 0.
; /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Posted: Fri Mar 26, 2004 5:40 pm
by merendo
I realized a long time ago...
Posted: Sat Mar 27, 2004 3:14 am
by Dare2
lol. I didn't have a clue.
Thanks for posting.