Skip to content

Commit

Permalink
Force type conversion
Browse files Browse the repository at this point in the history
Forced a type conversion before setting the initial value of Phase, in order to avoid range overflow.
  • Loading branch information
Louis-Aime committed Jul 11, 2017
1 parent 8adde3a commit bde4a8e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion MilesianMoon.bas
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ Dim Phase As Double
If IsMissing(MoonPhase) Then MoonPhase = 0
If ActiveWorkbook.Date1904 And FromDate >= 1 Then FromDate = FromDate - DayOffsetMacOS
If MoonPhase < 0 Or MoonPhase > 3 Then Error 1
Phase = FromDate - MeanNewMoon2000 - (MoonPhase / 4) * MeanSynodicMoon
Phase = FromDate 'Force conversion to Double
Phase = Phase - MeanNewMoon2000 - (MoonPhase / 4) * MeanSynodicMoon
If ActiveWorkbook.Date1904 Then Phase = Phase + DayOffsetMacOS
While Phase < 0
Phase = Phase + MeanSynodicMoon
Expand Down

0 comments on commit bde4a8e

Please sign in to comment.