Click here to Skip to main content
15,894,343 members
Home / Discussions / Algorithms
   

Algorithms

 
QuestionExtracting shear X&Y from 3x3 affine transformation matrix Pin
Jim Crafton19-May-08 10:27
Jim Crafton19-May-08 10:27 
AnswerRe: Extracting shear X&Y from 3x3 affine transformation matrix Pin
Anthony Mushrow19-May-08 11:08
professionalAnthony Mushrow19-May-08 11:08 
GeneralRe: Extracting shear X&Y from 3x3 affine transformation matrix Pin
Jim Crafton20-May-08 2:54
Jim Crafton20-May-08 2:54 
GeneralRe: Extracting shear X&Y from 3x3 affine transformation matrix Pin
Anthony Mushrow20-May-08 3:31
professionalAnthony Mushrow20-May-08 3:31 
AnswerRe: Extracting shear X&Y from 3x3 affine transformation matrix Pin
73Zeppelin19-May-08 19:21
73Zeppelin19-May-08 19:21 
AnswerRe: Extracting shear X&Y from 3x3 affine transformation matrix Pin
Arash Partow29-May-08 23:37
Arash Partow29-May-08 23:37 
QuestionLong and Int64 Pin
MumbleB15-May-08 20:18
MumbleB15-May-08 20:18 
AnswerRe: Long and Int64 Pin
Ed.Poore15-May-08 21:18
Ed.Poore15-May-08 21:18 
If what you're totaling is overflowing a 16-bit number then you cannot return a 16 bit number without losing precision. You'd have to return at least a 32 bit number with the result of the summation.

For example:
short[] numbers = new short[] { short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue };
short total = 0;
foreach (short number in numbers)
	total += number;
Console.WriteLine(total);


Returns -4 as the result, obviously not what you want, this is because you've overflowed and the number has rolled back to zero. If you change total to an int then you get the correct result.


I doubt it. If it isn't intuitive then we need to fix it. - Chris Maunder

GeneralRe: Long and Int64 Pin
CPallini15-May-08 21:37
mveCPallini15-May-08 21:37 
GeneralRe: Long and Int64 Pin
Ed.Poore15-May-08 21:48
Ed.Poore15-May-08 21:48 
AnswerRe: Long and Int64 Pin
MarkB77715-May-08 21:28
MarkB77715-May-08 21:28 
AnswerRe: Long and Int64 Pin
cp987615-May-08 21:46
cp987615-May-08 21:46 
AnswerRe: Long and Int64 Pin
Mark Churchill18-May-08 4:34
Mark Churchill18-May-08 4:34 
AnswerRe: Long and Int64 Pin
PIEBALDconsult5-Jun-08 8:14
mvePIEBALDconsult5-Jun-08 8:14 
AnswerRe: Long and Int64 Pin
Tadeusz Westawic13-Jun-08 3:28
Tadeusz Westawic13-Jun-08 3:28 
QuestionCounting bricks from image Pin
asiv14-May-08 23:04
asiv14-May-08 23:04 
AnswerRe: Counting bricks from image Pin
Matthew Butler15-May-08 1:34
Matthew Butler15-May-08 1:34 
GeneralRe: Counting bricks from image Pin
asiv15-May-08 2:34
asiv15-May-08 2:34 
GeneralRe: Counting bricks from image Pin
Tim Craig15-May-08 17:31
Tim Craig15-May-08 17:31 
GeneralRe: Counting bricks from image Pin
asiv15-May-08 20:47
asiv15-May-08 20:47 
GeneralRe: Counting bricks from image Pin
MarkB77715-May-08 21:31
MarkB77715-May-08 21:31 
GeneralRe: Counting bricks from image Pin
Tim Craig15-May-08 22:43
Tim Craig15-May-08 22:43 
GeneralRe: Counting bricks from image Pin
Paul Conrad28-Jun-08 9:16
professionalPaul Conrad28-Jun-08 9:16 
AnswerRe: Counting bricks from image Pin
asiv29-May-08 9:53
asiv29-May-08 9:53 
QuestionVideo Data on Network at a Bitrate? Pin
Andy Rama13-May-08 20:19
Andy Rama13-May-08 20:19 

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.