After much spelunking of some awful old code that has apparently been
only sort of converted from fortran (lots of goto statements -
shudder) I finally discovered that the exp() function on the phone was
returning the wrong answer in some circumstances. For instance:
exp( -3.451682e-06 )
yields 9.939789e-01 while the correct answer should be: 9.999965e-01.
You can confirm this by simply using the standard calculator app that
comes with the iPhone. Once you get the wrong answer, try taking the
ln of it to show that the original number is not returned.
Fortunately there is a simple work around by declaring my own exp
function as:
double exp( double x) {
return pow( 2.718281828,x);
}
It probably isn't as efficient, but if there is a slow down, it hasn't
been noticeable to me. I did file a bug report with Apple, so perhaps
a fix will come in the future.
After discovering this I decided to revisit a problem I had noticed
before in doing flashes at extreme conditions - namely things like dew
points of hydrogen / helium mixtures. I was able to come up with a
case where not only did the flash fail, Alph actually crashed and
quit. After applying the hack above, all was well.
I just released version 1.02 a couple of days ago, so I will probably
wait a decent interval, but look for a 1.03 with this fix shortly.
Fortunately the problem only seems to only raise its head in some
pretty ugly circumstances.
--
YauKun Li yau...@virtualMaterials.com
======================================================================================
This e-mail may be privileged and/or confidential, and the sender does not waive any
related rights and obligations.
Any distribution, use or copying of this e-mail or the information it contains by
other than an intended recipient is unauthorized.
If you received this message by mistake, please advise me (by return e-mail or otherwise)
immediately.
======================================================================================
So it probably is either a glitch in the library function or it might even be a processor problem, for the iPhone uses the Arm processor and perhaps that has a problem.
Craig