Click here to Skip to main content
15,887,214 members
Home / Discussions / Algorithms
   

Algorithms

 
AnswerRe: Learning software design patterns Pin
PIEBALDconsult10-Nov-11 1:54
mvePIEBALDconsult10-Nov-11 1:54 
GeneralRe: Learning software design patterns Pin
Hypermommy10-Nov-11 2:44
Hypermommy10-Nov-11 2:44 
QuestionA small exercise Pin
PIEBALDconsult9-Nov-11 13:25
mvePIEBALDconsult9-Nov-11 13:25 
AnswerRe: A small exercise Pin
Luc Pattyn9-Nov-11 14:34
sitebuilderLuc Pattyn9-Nov-11 14:34 
GeneralRe: A small exercise Pin
PIEBALDconsult9-Nov-11 14:35
mvePIEBALDconsult9-Nov-11 14:35 
GeneralRe: A small exercise Pin
Luc Pattyn9-Nov-11 14:37
sitebuilderLuc Pattyn9-Nov-11 14:37 
GeneralRe: A small exercise Pin
PIEBALDconsult9-Nov-11 14:37
mvePIEBALDconsult9-Nov-11 14:37 
AnswerRe: A small exercise PinPopular
BobJanova10-Nov-11 1:30
BobJanova10-Nov-11 1:30 
Well, this is a quadratic equation, with roots at 0 and 1 and therefore a midpoint at ½.

y = (x - ½)² - ¼ (expand and compare with the initial constant which was 0)
(x - ½)² = y + ¼
x - ½ = sqrt(y + ¼)
x = sqrt(y + ¼) + ½

Since you're already using a square root this won't be much more expensive than what you're doing now (maybe less, not sure of the cost of ceil) and it's accurate.

x(x - 1) isn't that close to x², it differs by x and therefore the relative error only goes down as 1/x. That's a very poor approximation and I don't see why you'd use it if it's also an expensive one with a sqrt in it.
AnswerRe: A small exercise Pin
Roger Wright9-Dec-11 4:26
professionalRoger Wright9-Dec-11 4:26 
QuestionSearching for algorithm for text file comparison (with list of differences) Pin
xtomiii9-Nov-11 10:48
xtomiii9-Nov-11 10:48 
AnswerRe: Searching for algorithm for text file comparison (with list of differences) Pin
Luc Pattyn9-Nov-11 11:46
sitebuilderLuc Pattyn9-Nov-11 11:46 
AnswerRe: Searching for algorithm for text file comparison (with list of differences) Pin
PIEBALDconsult9-Nov-11 13:18
mvePIEBALDconsult9-Nov-11 13:18 
AnswerRe: Searching for algorithm for text file comparison (with list of differences) Pin
Luc Pattyn9-Nov-11 13:33
sitebuilderLuc Pattyn9-Nov-11 13:33 
GeneralRe: Searching for algorithm for text file comparison (with list of differences) Pin
PIEBALDconsult9-Nov-11 13:34
mvePIEBALDconsult9-Nov-11 13:34 
GeneralRe: Searching for algorithm for text file comparison (with list of differences) Pin
Luc Pattyn9-Dec-11 6:31
sitebuilderLuc Pattyn9-Dec-11 6:31 
QuestionAudio processing Pin
Guy00731-Oct-11 8:08
Guy00731-Oct-11 8:08 
AnswerRe: Audio processing Pin
Albert Holguin1-Nov-11 9:20
professionalAlbert Holguin1-Nov-11 9:20 
AnswerRe: Audio processing Pin
BobJanova10-Nov-11 1:32
BobJanova10-Nov-11 1:32 
GeneralRe: Audio processing Pin
sgorozco25-Nov-11 8:16
sgorozco25-Nov-11 8:16 
AnswerRe: Audio processing Pin
molesworth18-Nov-11 2:04
molesworth18-Nov-11 2:04 
QuestionHi There is a function in PhotoShop Color match! Pin
shengcheng_jin23-Oct-11 23:50
shengcheng_jin23-Oct-11 23:50 
AnswerRe: Hi There is a function in PhotoShop Color match! Pin
mikemar29-Oct-11 7:07
mikemar29-Oct-11 7:07 
GeneralRe: Hi There is a function in PhotoShop Color match! Pin
shengcheng_jin30-Oct-11 19:36
shengcheng_jin30-Oct-11 19:36 
GeneralRe: Hi There is a function in PhotoShop Color match! Pin
shengcheng_jin10-Nov-11 20:57
shengcheng_jin10-Nov-11 20:57 
AnswerRe: Hi There is a function in PhotoShop Color match! Pin
Richard MacCutchan29-Oct-11 7:16
mveRichard MacCutchan29-Oct-11 7:16 

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.