Search the web
Sign In
New User? Sign Up
varaq-dev · for developers of and for the Klingon programming language var'aq
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Julian Date Algorithm   Message List  
Reply | Forward Message #351 of 616 |
Well,

I am excited that there is a new release! I will have to be sure to
let my students know about it! I will download it as soon as I get
this piece of code posted.

Here is a program one of my students put together this term.

(* Written by T. Nathan Wheeler *)
(* Date: 2453110.5 (04/15/2004) *)

~ tojulian { (* yyyy m d --- days *)
(* This function uses the formula given on page 405 of *)
(* JAVA Algorithms by Scott Robert Ladd to convert a *)
(* Gregorian date in the form yyyy mm dd to a Julian *)
(* date (i.e. the number of days since Jan 1, 4713 BC) *)

(* I am not sure why a Klingon would have need of this but *)
(* it made a fun demonstration for a class project. ;) *)

"day" cher (* store the day *)

latlh 2 law''a' wIv (* is month > Feb? *)
{ woD "month" cher 1 } HIja'chugh (* just store the month *)
{ 12 boq "month" cher } ghobe'chugh (* add 12 and store the
month *)

latlh 2 law''a' wIv (* is month > Feb? *)
{ woD "year" cher 1 } HIja'chugh (* just store the year *)
{ 1 boqHa' "year" cher } ghobe'chugh (* subtract 1 and store
year *)

year 100 boqHa''egh poD 2 tam boqHa' (* 2 - INT(year/100) *)
year 400 boqHa''egh poD boq (* + INT(year/400) *)

365.25 year boq'egh poD boq (* [INT(365.25*year)] + *)
30.6001 month 1 boq boq'egh poD boq (* [INT(30.6001*
(month+1))] + *)

day boq (* [day] + *)

1720994.5 boq (* add the base constant
(1720994.5) *)

} pong

(* testing area *)
2004 04 06 tojulian cha' (* should return 2453101.5 *)
2004 04 15 tojulian cha' (* should return 2453110.5 *)


Note that comments in the Var'aq interpreter are confined to a
single line, so if the code wraps in this post, you might have to
reformat it slightly to get it to work.

Have fun!

_Merrick




Mon May 3, 2004 3:13 am

merrick_stemen
Offline Offline
Send Email Send Email

Forward
Message #351 of 616 |
Expand Messages Author Sort by Date

Well, I am excited that there is a new release! I will have to be sure to let my students know about it! I will download it as soon as I get this piece of code...
merrick_stemen
Offline Send Email
May 3, 2004
3:14 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help