5 people like it.

Date of Easter

For a given integer year the snippet calculates the date of Easter. This is valid in the Gregorian calendar for years 1583 onwards. It is based on a method devised in 1876 which first appeared in Butcher's Ecclesiastical Calendar.

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
let Easter year =
    let a = year % 19
    let b = year / 100
    let c = year % 100
    let d =  b /4
    let e = b % 4
    let f = (b+8) / 25
    let g = (b - f + 1) /3
    let h = (19 * a + b - d - g + 15) % 30
    let i = c / 4
    let k = c % 4
    let l = ( 32 + 2 * e + 2 * i - h - k) % 7
    let m = (a + 11 * h + 22 * l ) / 451
    let n = ( h + l - 7 * m + 114) / 31
    let p = ( h + l - 7 * m + 114) % 31
    (p+1,n,year)
val Easter : year:int -> int * int * int

Full name: Script.Easter
val year : int
val a : int
val b : int
val c : int
val d : int
val e : int
val f : int
val g : int
val h : int
val i : int
val k : int
val l : int
val m : int
val n : int
val p : int
Raw view Test code New version

More information

Link:http://fssnip.net/iC
Posted:11 years ago
Author:Ben Clare
Tags: astronomy