Skip to main content

A Temporary Fix

Posted by editor on November 7, 2007 at 7:09 AM PST

Making do without parts of java.lang.Math on ME

When I got the pitch for Lawrence Fulton and Daniel Williams' article on implementing Math.pow() in Java ME, I wasn't sure it was that big of a deal. I mean, for integers, don't you do exponents by just going into a for loop and multiplying? Well, yeah, you do. But Java ME now supports the double type, and your base and exponent might both be fractional. Or negative for that matter. And if you can't bank on having a corresponding CPU instruction, what do you do?

Maybe you guess. Or, more specifically, you work your way around approximations of the right answer until you get a good enough result.

In today's Feature Article, the authors look at techniques for
Creating a Java ME Math.pow() Method, focusing on the example problem n = 82/3.

Without the availability of the initial exponent up front, other solutions to this problem (including Newton's method and the secant method) are not readily programmed. Although there are some workarounds for the bisection method, we (instead) focus on three methods not traditionally investigated. The first is a simple (yet sometimes inefficient) geometric decay algorithm, while the second method leverages the Math.sqrt() method and guarantees convergence to an approximate solution in no more than 11 iterations. The third and final method uses the Taylor series approximation for the logarithm followed by the Euler transformation on the Taylor series.

Speaking of ME, the latest Java Mobility Podcast is
Tricastmedia Mail and TWUIK . In it, Dr. Brian Lee and Dr. Salmon Ahmad introduce their Tricast Mail and push technology for delivering user information to cell phones. It uses TWUIK which greatly improves usability with dazzling graphics, vibrant animation in an engaging rich-media user experience.

In Java Today,

Mark Reinhold's latest blog has a timeline for Upcoming OpenJDK infrastructure projects. "The publication last week of our experimental Mercurial repositories heralds the list of many infrastructure projects that we hope to initiate, and in most cases complete, over the next year or so. Here's the entire list..." He starts with Q4's to-dos -- code-review publication, core community database, and public Mercurial forests -- and then previews 2008's key projects in detail.

The JSR for Java EE 6, JSR 316, was submitted to the JCP in July. So what will the the 316 Expert Group include in this version? In the Artima interview, Java EE 6: A Conversation with Bill Shannon and Roberto Chinnici, the spec leads for JSR 316 discuss the key design considerations for the upcoming version of the enterprise Java specification.

The Java Communications Community is congratulating the JDiameter project for their graduation and promotion out of the incubator. "JDiameter is an API and default implementation of the Diameter protocol (based on RFC 3588) written in Java. API can be used for commercial realizations of a stack and appendices such as NASREQ (RFC 4005), EAP-based authentication (RFC 4072), Credit-Control (RFC 4006), or even some of the 3GPP applications (Sh, Ro, Cx and ets.)."

Some blogs about conference visits don't do much more than offer some pictures of a couple speakers and attendees. Arun Gupta's GlassFish Day Beijing 2007 - By the Community, For the Community, featured in today's Weblogs is very much the opposite, offering links to the slides that were presented in the sessions, and also covering the question-and-answer sessions that closed each presentation.

Sean Sheedy brain dumps his GPhone Open Phone Alliance thoughts in
On the Android announcement - a bullet list. "A friend in the industry asked me for my opinion on the Android news, and this was my response."

Finally, in
JSF Usage and JSF 2.0 Update, Ed Burns shares "the latest discoveries about sites using JSF and give a quick update on JSF 2.0."

Today's Forums start off with
Shyamal Mehta seeking help with
Publishing data to all instances in a cluster.
"In a clustered environment I need to publish data to all instances in the cluster. What is the best way to do it? The use case is for the requirement is to be able to process an external rate feed, which will be done by only one of the instances and then make that available in all instances. The external feed is parsed every 10-15 seconds. Using JMS and a Topic seemed like a solution, but glassfish only invokes one MDB for a message so the change will not be propogated to all instances."

Robert Engels works through a conversion gotcha in
Re: [JAI-IMAGEIO] Read Tiff, Write Tiff... why are the files different sizes?
"This question brings up a good point... I don't think it is possible to read an image that uses lossly compression, and rewrite it changing some of the metadata - if you don't set the compression, the file will become large, if you set the compression then the image is compressed again (multiplying the error). It seems you would need to be able to extract the compressed stream from the original image, and write it out verbatim. Any ideas?"

Finally, sloanb is trying to figure out
Listeners and custom mapped listener methods in jMaki.
"I'm finally beginning to somewhat understand how things are meshed together with jMaki but I still have lots to learn. One thing that is still unclear to me is the user of custom events with widgets and how to setup them up. For example lets say I have a table and I want a custom onSelect listener to be registered with the dojo.table when the user clicks on the table row. To my understanding you should simple put a custom listener in the glue.js and have the widget (dojo.table) subscribe to it. When the widget publishes to this it will call the method and perform that logic. Am I way off base here? I've been working through several of the examples but haven't figured it out completely yet."

Current and upcoming Java

Registered users can submit event listings for the href=""> Events Page using our href="">events submission form.
All submissions go through an editorial review before being posted to the

Archives and Subscriptions: This blog is delivered weekdays as
the Java
Today RSS feed
. Also, once this page is no longer featured as the
front page of it will be
archived along with other past issues in the href=""> Archive.

Making do without parts of java.lang.Math on ME