HP Forums
LEEP YEAR - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: LEEP YEAR (/thread-7673.html)



LEEP YEAR - ggauny@live.fr - 01-27-2017 03:33 PM

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.


RE: LEEP YEAR - JMB - 01-27-2017 04:47 PM

Very nice!
Just one thing, the correct spelling is "LEAP"


RE: LEEP YEAR - ggauny@live.fr - 01-27-2017 05:00 PM

Thanks, I have corrected.


RE: LEEP YEAR - JMB - 01-27-2017 07:18 PM

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;



RE: LEEP YEAR - ggauny@live.fr - 01-27-2017 08:37 PM

Nice and elegant !


RE: LEEP YEAR - KeithB - 01-27-2017 08:56 PM

But will only work on updated Primes.


RE: LEEP YEAR - grsbanks - 02-06-2017 03:08 PM

(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


RE: LEEP YEAR - salvomic - 02-06-2017 03:25 PM

(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