New at C, have a math question - NEVER MIND

Discuss PocketC for Palm OS (including Desktop Edition)

Postby jfarr on Fri May 04, 2001 6:57 pm

Sorry, wish I could delete this...I didn't read the part about PocketC only being good to 7 decimal places. :)
--------------------------------------

I'm having a bit of difficulty and can't seem to spot my error. The routine below is rounding its output to one decimal place consistently and shouldn't be. Any ideas?

float jday(int year, int month, int day, int hour, int minute, int second) {
// Returns the Julian day number for a specific calendar date.
float dayFrac,a,b,c,d,jd;
dayFrac = hour + minute / 60.0 + second / 3600.0;
dayFrac = dayFrac / 24.0;

if(month <= 2) {
month = month + 12;
year--;
}

a = fix(year / 100);
b = 2 - a + fix(a / 4);
c = fix(365.25 * year);
d = fix(30.6001 * (month + 1));
jd = b + c + d + day + dayFrac + 1720994.5;
return jd;
}



Edited by - jfarr on 05/04/2001 14:40:15
jfarr
 
Posts: 1
Joined: Fri May 04, 2001 6:55 pm
Location: USA

Postby jstadolnik on Fri May 04, 2001 7:44 pm

You can delete your posts. Just login to web board first and you have the option of deleting old messages.

Joe
jstadolnik
 
Posts: 1741
Joined: Wed Dec 06, 2000 3:34 am
Location: USA


Return to PocketC for Palm OS

Who is online

Users browsing this forum: No registered users and 2 guests

cron