On UV the vlist would indicate yes (the complete expression is processed) .

 LEAP.YEAR = NOT(MOD(YEAR,4)) AND (NOT(MOD(YEAR,400)) OR MOD(YEAR,100))
00062 : 0F6 mod            YEAR 4  => $R1
0006A : 10E not            $R1  => $R2
00070 : 0F6 mod            YEAR 400  => $R3
00078 : 10E not            $R3  => $R4
0007E : 0F6 mod            YEAR 100  => $R5
00086 : 122 or             $R4 $R5  => $R6
0008E : 008 and            $R2 $R6  => LEAP.YEAR
00096 : 190 stop

I get minuscually better results using a case statement:

YEAR = oconv(THE.DATE, 'dy')
 begin case
 case mod(YEAR,4) ; LEAP.YEAR = @false
 case mod(YEAR,100); LEAP.YEAR = @true
 case mod(YEAR,400); LEAP.YEAR = @false
 case @true ; LEAP.YEAR = @true
 end case


-----Original Message-----
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson
Sent: Thursday, 8 December 2011 15:02
To: andyb...@yahoo.co.uk; u2-users@listserver.u2ug.org
Subject: Re: [U2] End of Month date routine


 Why couldn't you say


LEAP.YEAR = NOT(MOD(YEAR,4)) AND (NOT(MOD(YEAR,400)) OR MOD(YEAR,100))

Would the system process the whole line even on an initial finding of False ?





 

 

-----Original Message-----
From: andy baum <andyb...@yahoo.co.uk>
To: U2 Users List <u2-users@listserver.u2ug.org>
Sent: Wed, Dec 7, 2011 7:25 pm
Subject: Re: [U2] End of Month date routine


Seem to have lost a bit of last reply which should have read


Ran Dan's test code on latest Windows PE version of Universe and got :-

9.788
1.558
1.474
3.412

Tried
 NOT(MOD(YEAR,400)) OR(NOT(MOD(YEAR,4)) AND MOD(YEAR,100))) which took 2.181 
seconds but the fastest I could get was

LEAP.YEAR = NOT(MOD(YEAR,4))
IF LEAP.YEAR THEN
           LEAP.YEAR = (NOT(MOD(YEAR,400)) OR MOD(YEAR,100)) END

which took 1.423 seconds

Got the same trend, although different timings on our Solaris 10 box running 
Universe 10.3.6

Cheers,
Andy



________________________________
 From: Daniel McGrath <dmcgr...@rocketsoftware.com>
To: "dgr...@dagconsulting.com" <dgr...@dagconsulting.com>; U2 Users List 
<u2-users@listserver.u2ug.org>
Sent: Wednesday, 7 December 2011, 18:57
Subject: Re: [U2] End of Month date routine
 
I added the code to PasteBin so as to not flood here: 
http://pastebin.com/JMyqhFud

I did a few more than 100K and I cut the OCONV step out from all of them. I 
took the liberty to adjust Will's version to return correct results. The 
results I got, in order, was:

16.872
2.804
2.384
5.561

So, if you have a need to account for your milliseconds, the slightly optimized 
Wikipedia algorithm seems to be the fastest.

Interested to see if there are any better? (Or if I made any mistakes...)

Regards,
Dan

-----Original Message-----
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org]
On Behalf Of David A. Green
Sent: Wednesday, December 07, 2011 10:48 AM
To: 'U2 Users List'
Subject: Re: [U2] End of Month date routine

Who wants to take each of the Leap Year calculations and put them into 
different subroutines and loop 100K times and see which one is faster using 
profiling?

David A. Green
(480) 813-1725
DAG Consulting

_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

 
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users



_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to