For a JulianDate instance , this method
returns a new JDJulianDate instance that
differs by delta days.
# - - - J u l i a n D a t e . o f f s e t
def offset ( self, delta ):
"""Return a new JulianDate for self+(delta days)
[ delta is a number of days as a float ->
return a new JulianDate (delta) days in the
future, or past if negative ]
"""
To preserve the precision, we'll perform the addition
directly on the internal value that is biased by JULIAN_BIAS, then separate the sum into whole
part and fraction, and then un-bias the whole part and
pass both to the class constructor.
#-- 1 --
newJ = self.j + delta
#-- 2 --
# [ newWhole := whole part of newJ
# newFrac := fractional part of newJ ]
newWhole, newFrac = divmod ( newJ )
#-- 3 --
return JulianDate ( newWhole+JULIAN_BIAS, newFrac )