Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Math conundrum



I still am sort of following up on my personal curiosity concerning large primes in general and the ability of java to handle them as a specific instance.
I didn't get back any Mac numbers on BigInteger square root performance? No one else all that curious I guess.
But, irregardless of that I have moved on to natural logs.
I now have another question. In looking at this there seem to be some fundamental floating point problems that arise between base 10 number entry and base 2 computer representation. Namely that 1.8, (say as an example number, I might not be remembering right that this was an actual example number given,)  might be a reasonably nice and exactly precise number in base 10 but it does not have a nice and exactly precise conversion to base 2 which results in you ending up with an inexact and imprecise base 2 representation.
One suggestion I saw there is to use the String constructor for the Double which is said to again allow for precise and exact base 2 values. Apparently it's easier to construct them from scratch rather than to convert but I'm not remembering what the exact reasoning was here.
OK, I am currently looking at some 'c' to java exact, to the best of my abilities, ports of some log code. So, I have a double I now want to return as probably a BigDecimal. Do I return more precise values by going double -> Double -> String -> BigDecimal or is the precision possibly already doomed and I might just as well just go double -> BigDecimal?
If it applies to anyones willingness to reply, my interest or curiosity here is not really platform differences in speed although for the time being I for reasons of basically no choice continue to plod along on Windows..
My interest more or less follows up on when I was looking at some MersennePrime RNG code a little bit ago and it appeared to me that JIT code was probably as fast as native but the native code suffered if there was a lot of linkage back and forth. The question in my mind would be - generally, for these purposes does the JITC in its current state of evolution produce results as good as or at least comparable to native compilers? So JIT vs. gcc say, not Windoze vs. Mac.
Maybe not anymore interest that way. Platform bashing is most likely funner.
 
Mike Hall       mikehall at spacestar dot net
http://www.spacestar.net/users/mikehall
 
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.