Difference between revisions of "Talk:Days in Month"
Jump to navigation
Jump to search
(New page: Strife, appreciate the rewriting the code, but you seem to have left out the test for months that are 31 days long. Plz fix.) |
|||
Line 1: | Line 1: | ||
Strife, appreciate the rewriting the code, but you seem to have left out the test for months that are 31 days long. Plz fix. | Strife, appreciate the rewriting the code, but you seem to have left out the test for months that are 31 days long. Plz fix.{{unsigned|IntLibber Brautigan|22:42, 2 March 2009}} | ||
:The current code is already doing that. It's the bit operator portial behind the return. | |||
:(month & 1) gives 1 when it's an uneven month and 0 when it's an even month. | |||
:(month > 6) gives 1 when it's a month after June and 0 otherwise. | |||
:30 is 11110 in the dual system. So what he does is, he manipulates the last bit with OR and XOR [[LSL_Operators|bitwise operators]], depending on the month. | |||
:This is a pretty clever solution... And it works *just tested* [[Image:Zai_signature.png|45px]] '''[[User:Zai Lynch|Lynch]]''' <sup><small>([[User talk:Zai Lynch|talk]]|[[Special:Contributions/Zai Lynch|contribs]])</small></sup> 23:19, 2 March 2009 (UTC) |
Revision as of 15:19, 2 March 2009
Strife, appreciate the rewriting the code, but you seem to have left out the test for months that are 31 days long. Plz fix.—The preceding unsigned comment was added on 22:42, 2 March 2009 by IntLibber Brautigan
- The current code is already doing that. It's the bit operator portial behind the return.
- (month & 1) gives 1 when it's an uneven month and 0 when it's an even month.
- (month > 6) gives 1 when it's a month after June and 0 otherwise.
- 30 is 11110 in the dual system. So what he does is, he manipulates the last bit with OR and XOR bitwise operators, depending on the month.
- This is a pretty clever solution... And it works *just tested* Lynch (talk|contribs) 23:19, 2 March 2009 (UTC)