Login or Sign Up
Logging in...
Remember me
Log in
Or
Sign Up
Forgot password or user name?
Log in with
Search in titles only
Search in C only
Search
Advanced Search
Forums
BYTES
Product Launch
Updates
Developer Toolkit
Today's Posts
Member List
Calendar
Home
Forum
Topic
C
to divide a number by 128 without using division operator
Collapse
X
Collapse
Posts
Latest Activity
Photos
Page
of
1
Filter
Time
All Time
Today
Last Week
Last Month
Show
All
Discussions only
Photos only
Videos only
Links only
Polls only
Events only
Filtered by:
Clear All
new posts
Previous
template
Next
karthikeyan2494
New Member
Join Date:
Mar 2013
Posts:
1
#1
to divide a number by 128 without using division operator
Mar 8 '13, 04:42 PM
Question about instead of using the division operator to display the output of user"s input
Rabbit
Recognized Expert
MVP
Join Date:
Jan 2007
Posts:
12517
#2
Mar 8 '13, 05:07 PM
You can use a bit shift but it will only work on integers and it won't have the decimal portion. So the answer won't be accurate.
Comment
Post
Cancel
zmbd
Recognized Expert
Moderator
Expert
Join Date:
Mar 2012
Posts:
5501
#3
Mar 8 '13, 06:33 PM
homework question?
Are exponents and multiplication out of the question?
That's my only thought and how I solved
almost
the same question some 20+ years ago... different number though so the bit-shift didn't even dawn on me!
Comment
Post
Cancel
weaknessforcats
Recognized Expert
Expert
Join Date:
Mar 2007
Posts:
9214
#4
Mar 8 '13, 07:13 PM
Did you try subtracting 128 inside a loop thst counts the number of cycles?
Comment
Post
Cancel
zmbd
Recognized Expert
Moderator
Expert
Join Date:
Mar 2012
Posts:
5501
#5
Mar 9 '13, 04:31 AM
WFC: Now that's cheating! ;-)
Comment
Post
Cancel
Previous
template
Next
Working...
Yes
No
OK
OK
Cancel
👍
👎
☕
Comment