04-09-2006 09:44 PM
int c,e;
int d;
int m;
int y;
double jd;
int b;
d = 10;
m = 04;
y = 2006;
++m;
c = 365.25*y;
e = 30.6*m;
jd = c+e+d-694039.09; /* jd is total days elapsed */
jd /= 29.53; /* divide by the moon cycle (29.53 days) */
b = jd; /* int(jd) -> b, take integer part of jd */
jd -= b; /* subtract integer part to leave fractional part of original jd */
b = jd*8 + 0.5; /* scale fraction from 0-8 and round by adding 0.5 */
b = b & 7; /* 0 and 8 are the same so turn 8 into 0 */
return b;
04-10-2006 03:28 AM
b = jd; /* int(jd) -> b, take integer part of jd */i.e.
jd -= b; /* subtract integer part to leave fractional part of original jd */
b = b & 7; /* 0 and 8 are the same so turn 8 into 0 */
Which should work straight in the Formula node.