Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » sci.math.* » sci.math.num-analysis.independent

Topic: integer Vs floating point efficiency?
Replies: 13   Last Post: Dec 5, 2012 8:41 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Herman Rubin

Posts: 323
Registered: 2/4/10
Re: integer Vs floating point efficiency?
Posted: Dec 2, 2012 6:10 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 2012-12-01, Rui Maciel <rui.maciel@gmail.com> wrote:
> Gratuitous cross-posting to extend this query to s.m.num-analysis.

> Rui Maciel wrote:

>> Is there any information on the relative efficiency of modern CPUs with
>> regards to algebraic operations on integer and floating point data types?


>> If there is, where can I get my hands on it?


>> Thanks in advance,
>> Rui Maciel


It depends on the operations. Unless the operations are integer
operations, there is always conversion of integer to float. This
conversion is not that efficient; it typically requires putting
the integer in an integer register, shifting if necessary, placing
an exponent in that register, putting it back in memory, reading
it into a floating point register, and subtracting what the result
would have been if it were 0. Even if memory references were not
needed, and shifing not needed, and the same registers could be
used for integers and floats, there are at least two operations
required if the needed constants were already in memory. This
is converting "single precision" integers into "double precision"
floats.

Getting the integer part of a float is even worse if not hardware.




--
This address is for information only. I do not claim that these views
are those of the Statistics Department or of Purdue University.
Herman Rubin, Department of Statistics, Purdue University
hrubin@stat.purdue.edu Phone: (765)494-6054 FAX: (765)494-0558



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.