Thread: math.h library
View Single Post
  #12   Spotlight this post!  
Unread 15-01-2004, 12:42
deltacoder1020's Avatar
deltacoder1020 deltacoder1020 is offline
Computer Guy
AKA: Dav
#1020 (The Indiana Prank Monkeys)
Team Role: Programmer
 
Join Date: Jan 2004
Location: Muncie, Indiana
Posts: 340
deltacoder1020 has a spectacular aura aboutdeltacoder1020 has a spectacular aura about
Send a message via AIM to deltacoder1020
Re: math.h library

Quote:
Originally Posted by Kevin Watson
Well, I shouldn't have made such a generalization. Integer division by powers of two is very fast (if the compiler is designed for such an optimization) because you only need to do a binary right shift to divide a number by two (multiplication works by shifting left). Division of two eighty-bit IEEE floating-point numbers on an eight-bit microcontroller is very painful.
you could always hardcode the bitshift for the division to make sure that the optimization is in, even if the compiler doesn't automatically do it - just replace "x / 16" with "x >> 4"
__________________
Team 1020, the Indiana Prank Monkeys (www.team1020.org)