S
Skybuck Flying
Hello,
Perhaps the intel instruction set has a little bit of a problem.
As far as I know memory cells/access can only be done via integers.
Thus programming languages like C and Pascal/Delphi need to write code as
follows:
ArrayElement[ vIndex ] = ...;
Where vIndex always has to be an integer ?!?
This leads to problems where some code works with floating points and some
with integers.
Since floating points can represent integers as well, floating points could
be considered more "universal" data types.
Therefore it makes more sense to access memory cells via floating points
than integers.
This would allow the programmers to write code once and use the floating
point formats for pretty much everything: calculations and array lookups.
So my suggestion for intel/amd is to add new instructions to the instruction
set so that memory lookups can be done via floating points. (The whole
numbers of the floating points could then be used for lookups, the
fractional part is ignored).
As far as I know C cannot do this currently for x86 compilers ?
I think the following C code will probably not compile:
SomeArray[ vIndex ] = 5;
Where vIndex is some floating point ?
An easy solution would ofcourse be to call something like round or ceil or
floor...
But having to call such routines all the time seems a bit
overheadish/excessive.
Therefore perhaps instructions and hardware can do it much faster so this
problem would be a thing of the past ?!? (And ofcourse the necessary
compiler extensions/features/modifications for easy programming like
above...)
(Ofcourse floating points would have a little drawback because their
range/precision is limited to 24 bit for 32 bit IEEE floating point
format... and also 48 or something for 64 bit floating point format... but
for many purposes this would probably be enough... so the idea of using
floating points for memory lookups remain interesting and usefull !
)
Bye,
Skybuck.
Perhaps the intel instruction set has a little bit of a problem.
As far as I know memory cells/access can only be done via integers.
Thus programming languages like C and Pascal/Delphi need to write code as
follows:
ArrayElement[ vIndex ] = ...;
Where vIndex always has to be an integer ?!?
This leads to problems where some code works with floating points and some
with integers.
Since floating points can represent integers as well, floating points could
be considered more "universal" data types.
Therefore it makes more sense to access memory cells via floating points
than integers.
This would allow the programmers to write code once and use the floating
point formats for pretty much everything: calculations and array lookups.
So my suggestion for intel/amd is to add new instructions to the instruction
set so that memory lookups can be done via floating points. (The whole
numbers of the floating points could then be used for lookups, the
fractional part is ignored).
As far as I know C cannot do this currently for x86 compilers ?
I think the following C code will probably not compile:
SomeArray[ vIndex ] = 5;
Where vIndex is some floating point ?
An easy solution would ofcourse be to call something like round or ceil or
floor...
But having to call such routines all the time seems a bit
overheadish/excessive.
Therefore perhaps instructions and hardware can do it much faster so this
problem would be a thing of the past ?!? (And ofcourse the necessary
compiler extensions/features/modifications for easy programming like
above...)
(Ofcourse floating points would have a little drawback because their
range/precision is limited to 24 bit for 32 bit IEEE floating point
format... and also 48 or something for 64 bit floating point format... but
for many purposes this would probably be enough... so the idea of using
floating points for memory lookups remain interesting and usefull !
Bye,
Skybuck.