Click here to Skip to main content
15,928,111 members
Home / Discussions / Algorithms
   

Algorithms

 
QuestionCan comparisons be done without If statements in C [modified] Pin
nripun11-Dec-06 2:30
nripun11-Dec-06 2:30 
AnswerRe: Can comparisons be done without If statements in C Pin
Guffa11-Dec-06 3:18
Guffa11-Dec-06 3:18 
GeneralRe: Can comparisons be done without If statements in C Pin
Ed.Poore11-Dec-06 3:52
Ed.Poore11-Dec-06 3:52 
GeneralRe: Can comparisons be done without If statements in C Pin
Guffa11-Dec-06 4:06
Guffa11-Dec-06 4:06 
AnswerRe: Can comparisons be done without If statements in C Pin
Luc Pattyn11-Dec-06 3:19
sitebuilderLuc Pattyn11-Dec-06 3:19 
GeneralRe: Can comparisons be done without If statements in C Pin
Stephen Hewitt11-Dec-06 15:54
Stephen Hewitt11-Dec-06 15:54 
GeneralRe: Can comparisons be done without If statements in C Pin
Luc Pattyn12-Dec-06 4:27
sitebuilderLuc Pattyn12-Dec-06 4:27 
AnswerRe: Can comparisons be done without If statements in C Pin
Guffa11-Dec-06 4:18
Guffa11-Dec-06 4:18 
The condition itself has a value. Simply change it so that it evaluated to True when the variable is inside the interval, and return the value.

return (x >= 0.5 && x <= 1.0);

I'm not sure, but the value of True might be -1 rather than 1. It might also depend on the implementation. Anyhow, a binary and with one assures that the value is 1 in either case.

return (x >= 0.5 && x <= 1.0) & 1;


---
b { font-weight: normal; }

AnswerRe: Can comparisons be done without If statements in C Pin
Maximilien11-Dec-06 4:49
Maximilien11-Dec-06 4:49 
AnswerRe: Can comparisons be done without If statements in C Pin
Stephen Hewitt11-Dec-06 15:56
Stephen Hewitt11-Dec-06 15:56 
AnswerRe: Can comparisons be done without If statements in C Pin
ShermansLagoon8-Jan-07 3:09
ShermansLagoon8-Jan-07 3:09 
AnswerRe: Can comparisons be done without If statements in C Pin
Rilhas30-Jan-07 12:57
Rilhas30-Jan-07 12:57 
Questionhow to read outlook express file inbox.dbx to simple english Pin
naveen padiyar10-Dec-06 19:06
naveen padiyar10-Dec-06 19:06 
QuestionRe: Control generation of my own public & private key pairs using C# Pin
edchan10-Dec-06 18:53
edchan10-Dec-06 18:53 
Questionconvert Metric to English and English to Metric using pseudocod Pin
xcom20018-Dec-06 21:15
xcom20018-Dec-06 21:15 
AnswerRe: convert Metric to English and English to Metric using pseudocod Pin
El Corazon9-Dec-06 6:15
El Corazon9-Dec-06 6:15 
AnswerRe: convert Metric to English and English to Metric using pseudocod Pin
#1239-Dec-06 21:53
#1239-Dec-06 21:53 
GeneralRe: convert Metric to English and English to Metric using pseudocod Pin
toxcct10-Dec-06 4:57
toxcct10-Dec-06 4:57 
GeneralRe: convert Metric to English and English to Metric using pseudocod Pin
Chris Maunder10-Dec-06 9:46
cofounderChris Maunder10-Dec-06 9:46 
GeneralRe: convert Metric to English and English to Metric using pseudocod Pin
#12310-Dec-06 10:34
#12310-Dec-06 10:34 
GeneralRe: convert Metric to English and English to Metric using pseudocod Pin
Chris Maunder10-Dec-06 10:50
cofounderChris Maunder10-Dec-06 10:50 
GeneralRe: convert Metric to English and English to Metric using pseudocod Pin
#12310-Dec-06 12:11
#12310-Dec-06 12:11 
GeneralRe: convert Metric to English and English to Metric using pseudocod Pin
toxcct10-Dec-06 22:30
toxcct10-Dec-06 22:30 
GeneralRe: convert Metric to English and English to Metric using pseudocod Pin
Paul Conrad11-Dec-06 4:23
professionalPaul Conrad11-Dec-06 4:23 
GeneralRe: convert Metric to English and English to Metric using pseudocod Pin
Paul Conrad10-Dec-06 15:40
professionalPaul Conrad10-Dec-06 15:40 

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.