HP Forums

Full Version: LEEP YEAR
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
Very nice!
Just one thing, the correct spelling is "LEAP"
Thanks, I have corrected.
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;
Nice and elegant !
But will only work on updated Primes.
(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
(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
Reference URL's