My solution was. Storm in a teacup, a very expensive teacup.
void DatasimDate::jul_to_greg(julTy& day, julTy& month, julTy& year) const
/*
* get the Gregorian DatasimDate (returned in the referenced variables
* day, month and year) from the number of Julian days (member
* Julian_days) from this DatasimDate. Algorithm 199 from Communications
* af the ACM Volume6, No.8, (Aug. 1963) p.144. If the number of
* Julian days = 0, return January 1, 1900. Gregorian calender started
* September 14, 1752.
*/
{
if (Julian_days == 0) { // return January 1, 1900
day = 1; month = 1; year = 1900;
return;
}
else { // This is the algorithm.
julTy j = Julian_days - 1721119l;
year = (julTy)(((j << 2) - 1) / 146097l);
j = (j << 2) - 1 - 146097l * year;
day = (julTy)(j >> 2);
j = ((day << 2) + 3) / 1461;
day = (julTy)((day << 2) + 3 - 1461 * j);
day = (day + 4) >> 2;
month = (5 * day - 3) / 153;
day = 5 * day - 3 - 153 * month;
day = (day + 5) / 5;
year = (julTy)(100 * year + j);
if (month < 10)
month += 3;
else {
month -=9;
year++;
}
}
}