posted 9 years ago
This is what they teach in Calculus II in college. The standard way for computers to compute logarithms is by using an infinite series, stopping the calculations once the desired precision has been attained. As a performance boost, the calculations are generally folded into an area where results converge rapidly so that fewer terms need to be evaluated.
Although the standard logarithms are base 10 (common) and base e (natural), any other base scales from the same process.
Actually, I think your harder problem is getting the floating-point support you need to do the calculations with.
Although the standard logarithms are base 10 (common) and base e (natural), any other base scales from the same process.
Actually, I think your harder problem is getting the floating-point support you need to do the calculations with.
An IDE is no substitute for an Intelligent Developer.
Stefano Malinconico
Greenhorn
Posts: 4
posted 9 years ago
The thing is,
The MID profile API does not provide any support for logarithms (even it is 10-based or Nepperian) as J2SE does.
Diving into the source code we can see that there is a method "java.lang.StrictMath.log10(double a)" declared as native.
The implementation for this method can be found at fdlibm.tar (according to the doc) in a file called e_log10.c But, how could i use this lib on my mobile project? Before all... Is it possible?
Thanks in advance.
The MID profile API does not provide any support for logarithms (even it is 10-based or Nepperian) as J2SE does.
Diving into the source code we can see that there is a method "java.lang.StrictMath.log10(double a)" declared as native.
The implementation for this method can be found at fdlibm.tar (according to the doc) in a file called e_log10.c But, how could i use this lib on my mobile project? Before all... Is it possible?
Thanks in advance.
posted 9 years ago
I think your best bet is to implement an algorithm yourself in Java, rather than trying to call some C code. Wikipedia describes a couple algorithms that should work, in its "Logarithm" article (under "Computers").
posted 9 years ago
Well, if you want to go that route, the actual code that does the calculations is almost identical in C and Java. The only things to watch for are differences in precision, since that affects the cutoff point for series calculation.
Originally posted by Stefano Malinconico:
The thing is,
The MID profile API does not provide any support for logarithms (even it is 10-based or Nepperian) as J2SE does.
Diving into the source code we can see that there is a method "java.lang.StrictMath.log10(double a)" declared as native.
The implementation for this method can be found at fdlibm.tar (according to the doc) in a file called e_log10.c But, how could i use this lib on my mobile project? Before all... Is it possible?
Thanks in advance.
Well, if you want to go that route, the actual code that does the calculations is almost identical in C and Java. The only things to watch for are differences in precision, since that affects the cutoff point for series calculation.
An IDE is no substitute for an Intelligent Developer.