Related articles |
---|
Q: division vs multiplication t.hulek@imperial.ac.uk (1995-03-24) |
Re: Q: division vs multiplication kptben@aol.com (1995-04-02) |
Re: Q: division vs multiplication Terje.Mathisen@hda.hydro.com (1995-04-02) |
Re: Q: division vs multiplication mikeq@primenet.com (1995-04-02) |
Re: Q: division vs multiplication hbaker@netcom.com (1995-04-03) |
Re: Q: division vs multiplication davidm@Rational.COM (1995-04-03) |
Re: Q: division vs multiplication brandis@inf.ethz.ch (1995-04-04) |
Re: Q: division vs multiplication Terje.Mathisen@hda.hydro.com (1995-04-06) |
Re: Q: division vs multiplication meissner@cygnus.com (Mike Meissner) (1995-04-16) |
Re: Q: division vs multiplication martens@cis.ohio-state.edu (1995-04-16) |
[9 later articles] |
Newsgroups: | comp.compilers |
From: | mikeq@primenet.com (Michael Quinlan) |
Keywords: | arithmetic, optimize |
Organization: | Primenet |
References: | 95-04-003 |
Date: | Sun, 2 Apr 1995 13:50:23 GMT |
t.hulek@imperial.ac.uk (Mr Tomas Hulek) writes:
[Can one optimize floating division by powers of two into something like a
shift?]
>I would imagine that division by 2.0 could be done very efficiently, just like
>division by 10 in our decimal system. But is it really so?
On at least one set of machines (the IBM System 370/390 series), division
of a floating point number by 2 is significantly faster than multiplication
because the hardware has a special instruction for it.
Of course, in a C program, division by 2 will only be faster when the
compiler detects the situation and generates code using the instruction.
A well-written compiler might detect both situations above and generate
identical code.
+---------------------------------+
| Michael Quinlan |
| mikeq@primenet.com |
| http://www.primenet.com/~mikeq/ |
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.