Post Reply 
LEEP YEAR
01-27-2017, 03:33 PM (This post was last modified: 01-27-2017 04:59 PM by ggauny@live.fr.)
Post: #1
LEEP YEAR
HI,

May be usefull for some one. Based on a idea from Christian Meland (One-Minute Marvels), Only into the range 1583 to 9999. To see if a year is leep or ordinary.

Code:

EXPORT YEAR(Year)
BEGIN
IFTE(((FP(DATEADD((Year+0.0228),1)))
−0.0229≠0),"ORD","LEAP");
END;

Have a nice day.

Gérard.
Find all posts by this user
Quote this message in a reply
01-27-2017, 04:47 PM
Post: #2
RE: LEEP YEAR
Very nice!
Just one thing, the correct spelling is "LEAP"
Find all posts by this user
Quote this message in a reply
01-27-2017, 05:00 PM
Post: #3
RE: LEEP YEAR
Thanks, I have corrected.

Gérard.
Find all posts by this user
Quote this message in a reply
01-27-2017, 07:18 PM
Post: #4
RE: LEEP YEAR
Here is another version of this program, using the fact that DAYOFWEEK returns -1 for dates that don't exist

Code:

EXPORT YEAR(Year)
BEGIN
  IFTE(DAYOFWEEK(Year+0.0229) < 0, "ORD", "LEAP");
END;
Find all posts by this user
Quote this message in a reply
01-27-2017, 08:37 PM
Post: #5
RE: LEEP YEAR
Nice and elegant !

Gérard.
Find all posts by this user
Quote this message in a reply
01-27-2017, 08:56 PM
Post: #6
RE: LEEP YEAR
But will only work on updated Primes.
Find all posts by this user
Quote this message in a reply
02-06-2017, 03:08 PM
Post: #7
RE: LEEP YEAR
(01-27-2017 04:47 PM)JMB Wrote:  Very nice!
Just one thing, the correct spelling is "LEAP"
Certainly simpler than the French "Bissextile", altho' the same word used to be used in English long ago:

Origin
late Middle English: from Latin bisextilis (annus) or bissextilis (annus) ‘the year of the bissextus’, from bissextus (from bis ‘twice’ + sextus ‘sixth’), the name given to the extra day inserted every fourth year by the Julian calendar, which was originally obtained by counting 24 February (the sixth day before the beginning of March) twice.

Your daily dose of trivia Smile
Find all posts by this user
Quote this message in a reply
02-06-2017, 03:25 PM (This post was last modified: 02-06-2017 04:55 PM by salvomic.)
Post: #8
RE: LEEP YEAR
(02-06-2017 03:08 PM)grsbanks Wrote:  [i]late Middle English: from Latin bisextilis (annus) or bissextilis (annus) ‘the year of the bissextus’, from bissextus ...

better :-)
Latin bisextǐlis (acc. bisextǐlem -> Italian: bisestile), from bisĕxtus [< "bis sextus"], "two times the sixth" :-)
(with only one "s") precisely, but the same meaning.

The 366th day every four year...

Another simple but useful Leap proposal:
Code:
EXPORT leap(y)
BEGIN
local b, l;
IF (NOT(y MOD 4) AND y MOD 100) OR (NOT y MOD 400) THEN b:=1; l:="leap"; // leap
ELSE b:=0; l:="not leap"; // ordinary
END;
PRINT;
PRINT(STRING(y) + " is " + STRING(l));
RETURN {y,b};
END;

salvo

∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 2 Guest(s)