Re: Natural logarithm method not recognised
Octavio wrote:
Good day dear members of the comp.lang.java.programmer newsgroup.
I've got the following error message while trying to use the "logl()"
method (natural logarithm function) on my NetBeans IDE
symbol : method logl(double)
location: class org.me.mylib.fluidmechanics.DarcyLaw
wfr = 7.08e-3 * ko_dl * depth_dl * (pr_dl - wbp_dl) / (mu_dl *
bo_dl * ((logl(re_dl/rw_dl) - 0.75)));
1 error
Should I import any special mathematic library from NetBeans?
No, but you should stop trying to convert C to Java by mere
transliteration. For starters, C's logl() function takes a
`long double' argument and delivers a `long double' result,
but Java has no `long double' type. (I mention this because
if your algorithm really needs ultra-high floating-point
precision, porting it to Java's medium-high precision may
be far more involved than just translating the source code.)
If you can make do with the ordinary `double' numbers Java
provides, you need the log() method, not logl(). And, by
the way, log() is a static method of the java.lang.Math and
java.lang.StrictMath classes, so you'll need to write Math.log()
or StrictMath.log() in your formulas, or use a "static import:"
import java.lang.Math.log; // or StrictMath
...
double roller = log(...);
--
Eric.Sosman@sun.com