Re: nth_root of num?

From: John Whitley (whitley@cse.buffalo.edu)
Date: Tue Dec 01 1998 - 21:25:26 MET


From: John Whitley <whitley@cse.buffalo.edu>
Date: Tue, 1 Dec 1998 15:25:26 -0500 (EST)
To: caml-list@inria.fr
Subject: Re: nth_root of num?
In-Reply-To: <13923.50811.334235.394872@sun8f.LRI>
        <Pine.SOL.4.05.9812011025090.6015-100000@odin.maths.bath.ac.uk>

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



This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:17 MET