binhpt / slimmath

Automatically exported from code.google.com/p/slimmath
0 stars 0 forks source link

Integer Vector #4

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Looked for integer Vector
2. ???
3. No Profit

What is the expected output? What do you see instead?
Integer vector. Like a normal vector but more integery.

What version of the product are you using? On what operating system?
Trunk, VS 2010

Please provide any additional information below.
foo[v.x, v.y]

Original issue reported on code.google.com by Siris...@gmail.com on 29 Jun 2010 at 3:18

GoogleCodeExporter commented 8 years ago
In consideration.

Could you give an example as to why an integer vector would be preferred over a 
floating point vector?

Original comment by Jorgy...@gmail.com on 29 Jun 2010 at 10:54

GoogleCodeExporter commented 8 years ago
Not preferred. Just a different vector. If you just need a vector that works 
with integers and you want to access arrays then converting from float is kind 
of pointless.

Original comment by Siris...@gmail.com on 1 Jul 2010 at 1:36

GoogleCodeExporter commented 8 years ago
I can't imagine an integer vector all that usefull, tuples of integers yes but 
thats what Tuple<T...> is for.

Original comment by Frassle on 1 Jul 2010 at 2:48

GoogleCodeExporter commented 8 years ago
I agree with Frassle. Virtually all operations done on vectors won't yield 
useful results when using integers as the backing store for vectors. The dot 
product would almost be useless though still semi-usable and many of the vector 
operations would be like this. An integer vector would also give up x87 (and 
possibly SSE) and use pure x86 code to do multiplies and, dare I say it, 
divides. Integer multiplies, and especially integer divides, are generally 
slower than x87 multiplies and divides (note x87 divide is reciprocal-multiply).

Unless someone else on the project wants this, I won't be implementing it. As a 
workaround, use the regular vectors and convert to integers where necessary. 
This may be a bit slower but if the coding is careful .net will generate the 
FISTP instruction which would take the place of FSTP. This will also yield more 
accuracy. You can also use Frassle's suggestion of the Tuple(T...).

Thank you for the suggestion though.

Original comment by Jorgy...@gmail.com on 2 Jul 2010 at 11:58