Click here to Skip to main content
16,004,761 members
Home / Discussions / Algorithms
   

Algorithms

 
GeneralRe: The origins of calculus Pin
73Zeppelin24-Aug-07 10:31
73Zeppelin24-Aug-07 10:31 
GeneralRe: The origins of calculus Pin
A Noteworthy Programmer25-Aug-07 3:52
A Noteworthy Programmer25-Aug-07 3:52 
GeneralRe: The origins of calculus Pin
Dan Neely23-Aug-07 2:40
Dan Neely23-Aug-07 2:40 
GeneralRe: The origins of calculus Pin
Maximilien15-Aug-07 3:17
Maximilien15-Aug-07 3:17 
GeneralActually, it was Archimedes Pin
Jay Gatsby17-Aug-07 11:51
Jay Gatsby17-Aug-07 11:51 
JokeRe: The origins of calculus Pin
PIEBALDconsult26-Aug-07 5:45
mvePIEBALDconsult26-Aug-07 5:45 
QuestionGetting s week number from a date Pin
Steven J Jowett6-Aug-07 6:14
Steven J Jowett6-Aug-07 6:14 
AnswerRe: Getting s week number from a date Pin
cp98766-Aug-07 15:10
cp98766-Aug-07 15:10 
Exactly how you do this depends on the language / support for calculating differences between dates. The formula you want is:

week number = ( ( (day(date) - day(base)) / 7 ) % 4 ) + 1

where day(date) - day(base) is the number of days difference between 'date' and 'base', and is assumed to be an integer.

e.g.: day(tomorrow) - day(today) = 1

% is the remainder operator in C/C++, so 4%4 = 0, 5%4 = 1, 6%4 = 2, 7%4 = 3 and so on





Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."

GeneralRe: Getting s week number from a date Pin
Steven J Jowett6-Aug-07 22:19
Steven J Jowett6-Aug-07 22:19 
QuestionBasic 64-bit integer question Pin
Domenic Denicola1-Aug-07 16:42
Domenic Denicola1-Aug-07 16:42 
AnswerRe: Basic 64-bit integer question [modified] Pin
Luc Pattyn1-Aug-07 23:14
sitebuilderLuc Pattyn1-Aug-07 23:14 
GeneralRe: Basic 64-bit integer question Pin
Domenic Denicola2-Aug-07 6:27
Domenic Denicola2-Aug-07 6:27 
GeneralRe: Basic 64-bit integer question Pin
Luc Pattyn2-Aug-07 6:47
sitebuilderLuc Pattyn2-Aug-07 6:47 
GeneralHey Luc, Pin
CPallini2-Aug-07 21:18
mveCPallini2-Aug-07 21:18 
GeneralRe: Hey Luc, Pin
Luc Pattyn2-Aug-07 21:43
sitebuilderLuc Pattyn2-Aug-07 21:43 
GeneralSorry... Pin
CPallini2-Aug-07 21:50
mveCPallini2-Aug-07 21:50 
Questionimage Pin
zainab ibrahim29-Jul-07 22:54
zainab ibrahim29-Jul-07 22:54 
AnswerRe: image Pin
Habib Ahmed Bhutto30-Jul-07 12:39
Habib Ahmed Bhutto30-Jul-07 12:39 
QuestionPatterns Pin
ThaScorpion29-Jul-07 14:40
ThaScorpion29-Jul-07 14:40 
AnswerRe: Patterns Pin
cp987629-Jul-07 14:56
cp987629-Jul-07 14:56 
GeneralRe: Patterns Pin
ThaScorpion29-Jul-07 15:08
ThaScorpion29-Jul-07 15:08 
GeneralRe: Patterns Pin
Paul Conrad29-Jul-07 17:00
professionalPaul Conrad29-Jul-07 17:00 
GeneralRe: Patterns Pin
Jörgen Sigvardsson2-Aug-07 21:15
Jörgen Sigvardsson2-Aug-07 21:15 
GeneralRe: Patterns Pin
Paul Conrad3-Aug-07 3:34
professionalPaul Conrad3-Aug-07 3:34 
GeneralRe: Patterns Pin
Jörgen Sigvardsson3-Aug-07 3:41
Jörgen Sigvardsson3-Aug-07 3:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.