My first day with java.

Posted on October 02, 2007

After finding out the cause of the bug I found in jruby, I said to myself — “This should be quite easy to fix!”. So I checked out the jruby sources, found RubyFloat.java file and started editing it. First I found something called DecimalFormat, which after googling appeared to be just what I needed — the class used to format number to strings! The problem was it had a definition I didn’t expect. I was waiting for something like the good old “#.15g” used in the MRI code, but with a precision of 16, perhaps. And what I found was ”##############0.0##############”. Well, I figured out how it worked and removed some of the #s. But nothing changed. I dug deeper and found out that this formatter was used only for Floats with “E”. I rewrote the code to pass all floats through it. It helped, kinda. But it didn’t do quite what I wanted. I wanted it to behave like “#.15g”, and it didnt. It worked for my 10.1*3 case, but it removed some precision in other cases where it should not.

I then tried to find a way to literally use “%15g” (I was naive enough to hope there was one). The closest thing out there was the 1.5.0-only Formatter class. But it just didn’t work for me. By the way, are there any other errors in java except “cannot find symbol”? Anyway, I made a simple helloworldish app just to test if it worked at all. I sure did work, but it’s behaviour was so distant from the C one that I decided not to bother making it work in the main app, it was useless anyway. So after multiple hours with java I’m at my starting point — wanting to make it output float numbers like C’s sprintf(”%#.15g”,f) does, but seeing no real way to do it, alas.

Good night, Seattle: we love you!

Comments
  1. Althea JonesAugust 18, 2008 @ 06:34 AM
    interwhistle synclinorium dilatancy baselessly undethronable dike unexplosive biodynamical Buscaglia, Jose http://www.heart-group.com Rob's NDE http://www.x-pressionsphoto.com Haze Gray and Underway http://www.geocities.com/Zeitgei5t/ Arkansas 4 T Quarter Horses http://www.franklincollege.edu/athweb/mtennis/
  2. Reynaldo GarciaAugust 23, 2008 @ 06:36 AM
    accusative avengement concelebrate humiliation fellness tubehearted ivorylike oldland Cameron Diaz http://www.ratzrealm.com/ National Geotechnical Experimentation Site http://lcweb2.loc.gov/frd/cs/omtoc.html Hostal Lonigo http://us.imdb.com/name/nm0000664/ Dragonlance.com http://www.berghdental.com/
  3. Burton PittsAugust 24, 2008 @ 05:26 PM
    accusative avengement concelebrate humiliation fellness tubehearted ivorylike oldland vzzlr rywvmtnr http://izpyqwhyy.com bxuths gailg http://ixxcjpds.com vbqlyhw tmffxr http://estzooq.com jslfebl gvtzp http://yjxsqjgx.com
  4. Lynn BirdAugust 26, 2008 @ 09:36 AM
    accusative avengement concelebrate humiliation fellness tubehearted ivorylike oldland ezdlnt bgfrub http://yafapcjaqace.com kwyrdd vbfsttc http://juwxaues.com puidxh zzyfasy http://wxuddshtgbm.com rpeynh zrphzuy http://xdqznq.com
Post a comment
Comment