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

Algorithms

 
AnswerRe: a parellel program problem Pin
JackPuppy2-Mar-09 2:43
JackPuppy2-Mar-09 2:43 
AnswerRe: a parellel program problem Pin
JackPuppy2-Mar-09 2:44
JackPuppy2-Mar-09 2:44 
QuestionGreedy problem with filling sequence Pin
proggged26-Feb-09 4:23
proggged26-Feb-09 4:23 
AnswerRe: Greedy problem with filling sequence Pin
Perisic, Aleksandar28-Feb-09 5:38
Perisic, Aleksandar28-Feb-09 5:38 
GeneralRe: Greedy problem with filling sequence Pin
Perisic, Aleksandar1-Mar-09 3:45
Perisic, Aleksandar1-Mar-09 3:45 
QuestionAnd Or and Xor with floating point Pin
PIEBALDconsult25-Feb-09 4:35
mvePIEBALDconsult25-Feb-09 4:35 
AnswerRe: And Or and Xor with floating point Pin
Dan Neely25-Feb-09 4:47
Dan Neely25-Feb-09 4:47 
GeneralRe: And Or and Xor with floating point Pin
supercat925-Feb-09 5:28
supercat925-Feb-09 5:28 
IIRC they're stored as 1.01 * 2^(01) and 1.00 * 2^(01); so doing a bitwise or you should get 1.01 * 2^(11) = 10.

It would be more natural to treat floating-point numbers for Boolean operators the same as with arithmetic operators: line up the binary point and then process them bit-wise, keeping the most significant bits of the result. Thus, e.g., 1.5 xor 4.75 would be 5.25 (001.10 xor 100.11 is 101.01). Boolean and/or/xor/andNot operators would work as expected for integers that are within precision limits. Other operators involving inversion would be problematic, however.

The difficulty is that while leading 1's can be represented by negative numbers (thanks to the fact that sum[n=0..inf](2^n)=-1) Wink | ;) trailing 1's cannot be represented in floating-point in any manner that will persist. The floating-point value "not 0" should be "-epsilon", which should have all bits set to the left and right of the binary point. Any value--no matter how larger or small--that is and'ed with "not 0" should yield itself. The value "not 1" should have all bits set except for bit 0, and should be the same as "(not 0) - 1". And'ing any value (no matter the magnitude) with that quantity should leave all bits other than bit 0. Unfortunately, -1-epsilon is going to get rounded to -1, which will have all bits to the left of the binary point (including bit 0) set, and all bits to the right clear.

I think the Boolean operators and/or/xor/andNot could be sensibly applied to floating-point numbers, but I don't see any good way of handling the rest. Note that the normal equality (x and y)=(x andNot (-1-y)) which is applicable to integers would not apply with floats, however (with integers, 'not 0' is -1, but with floats it isn't).
GeneralRe: And Or and Xor with floating point Pin
Dan Neely25-Feb-09 5:38
Dan Neely25-Feb-09 5:38 
GeneralRe: And Or and Xor with floating point Pin
supercat925-Feb-09 6:08
supercat925-Feb-09 6:08 
GeneralRe: And Or and Xor with floating point Pin
PIEBALDconsult25-Feb-09 6:48
mvePIEBALDconsult25-Feb-09 6:48 
QuestionCalculate intersection between arcs / lines and arc /arc Pin
sagaert21-Feb-09 8:12
sagaert21-Feb-09 8:12 
AnswerRe: Calculate intersection between arcs / lines and arc /arc Pin
Arash Partow21-Feb-09 16:40
Arash Partow21-Feb-09 16:40 
GeneralRe: Calculate intersection between arcs / lines and arc /arc Pin
sagaert22-Feb-09 3:13
sagaert22-Feb-09 3:13 
QuestionCaculate time left for data transfer Pin
cdpace17-Feb-09 6:21
cdpace17-Feb-09 6:21 
GeneralRe: Caculate time left for data transfer Pin
Luc Pattyn17-Feb-09 6:32
sitebuilderLuc Pattyn17-Feb-09 6:32 
GeneralRe: Caculate time left for data transfer Pin
cdpace17-Feb-09 11:30
cdpace17-Feb-09 11:30 
GeneralRe: Caculate time left for data transfer Pin
Luc Pattyn17-Feb-09 13:51
sitebuilderLuc Pattyn17-Feb-09 13:51 
AnswerRe: Caculate time left for data transfer Pin
Leonardo Muzzi17-Feb-09 9:12
Leonardo Muzzi17-Feb-09 9:12 
Questionthinning algorithm Pin
Swati Khanna17-Feb-09 1:40
Swati Khanna17-Feb-09 1:40 
AnswerRe: thinning algorithm Pin
riced17-Feb-09 2:33
riced17-Feb-09 2:33 
AnswerRe: thinning algorithm Pin
Andrew Kirillov5-Mar-09 0:49
Andrew Kirillov5-Mar-09 0:49 
QuestionAES Rijndael Cryptography fails Pin
Leonardo Muzzi16-Feb-09 10:16
Leonardo Muzzi16-Feb-09 10:16 
GeneralRe: App fails to use AES Rijndael Cryptography correctly? Pin
Luc Pattyn16-Feb-09 10:41
sitebuilderLuc Pattyn16-Feb-09 10:41 
AnswerRe: App fails to use AES Rijndael Cryptography correctly? Pin
Leonardo Muzzi17-Feb-09 3:13
Leonardo Muzzi17-Feb-09 3:13 

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.