English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
nth_root of num?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 1998-12-02 (12:48)
From: John Whitley <whitley@c...>
Subject: Re: nth_root of num?
Claude Marche writes:
 > An algorithm for computing the nth root of a float is easy :
 > 
 > let nth_root n x = exp (log(x)/.(float_of_int n));;

Alternatively, one could use the (**) float exponentiation operator:

let nth_root n x = x ** (1.0 /. n);;

-- John