[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Prayer Times from C to Java



Dear Ahmad, 

I am sorry for not responding. I have been busy with a few things. I
had received your email that you sent to me a few weeks ago (although
I cant find it anymore).

Among the algorithms I have seen, there are minor differences in
minutes, yes. But, I think that is expected because of precision. I
had the same problem with some mathematical functions in Java. So, I
just wrote my own (when I was trying to port the library to Java
natively).

Have you tried JPrayer and seen any difference between the output of C
code you ran and that of JPrayer? If not, then may be you can find a
way to compile C code for the device you mentioned, then use JPrayer
(or write your own interface if that device does not support swing).
The code will loose portability but thre wont be 2-3 minutes
difference (assuming that C would make more precise calculations than
Java). And, you are welcome to enhance JPrayer if your device does
support swing and if you want to make it easier to use.

We are humans, after all. Nothing we make is perfect : ).

Regards,
Moazzam Khan


On Sat, 1 Jan 2005 21:03:40 -0800 (PST), Ahmed Talaat
<aa_talaat at yahoo dot com> wrote:
>  
>  
> Dear Moazzam, and all,
> Thank you very much for you initiative, and I appologize for the delay in
> replying to you. I was not checking my e-mail regularly in the past few
> weeks. 
>  
> My main objective of porting the C code to Java was to build an azan
> application on my Java enabled Sony Ericsson K700i mobile, as well as to
> practice more and more my java skills which is only few months old.
>  
> I attached here the java code. As you may know, the code relies heavily on
> advanced trigonometric functions which are not available in the CLDC 1.1 of
> current mobile devices. So, the next challenge is to find a library
> developed by someone who can fill this gap. I looked around in several
> places, and did not find a library that satisfies my needs. I found a MathFP
> library, but then I discovered that it accepts integer values, while all the
> variables inside the prayer program are double.
>  
> By the way, I ran the java, and C code, and I found differences in the
> results of both programs in the range of 2 to 3 minutes. Going through the
> debugger, I found out that this difference is coming from the accumulation
> of tiny differences between the results of the trigonometric functions in
> the C vs Java JVM. This is one more thing that I am not sure what to do
> about it.
>  
> And finaly, comparing the results of either the C or Java code to the one or
> two ready made prayer programs on my PC, again they are all different. 
>  
> I live in Dubai, and in the past few months, I found that all the masjeeds
> have now installed an electronic clock that shows the 5 prayer times,
> according to which they operate. Again, I compared the values on their clock
> to any of the current program, and I found that they are different. So, I
> really do not know which is the most accurate program, or may be there is
> none at the moment.
> 
> 
>  ________________________________
> Do you Yahoo!?
>  Meet the all-new My Yahoo! – Try it today! 
> 
> 
> _______________________________________________
> Developer mailing list
> Developer at arabeyes dot org
> http://lists.arabeyes.org/mailman/listinfo/developer
> 
> 
>