Skip to main content

Timeline for Shift right by half a bit

Current License: CC BY-SA 4.0

13 events
when toggle format what by license comment
Jan 25, 2020 at 16:24 comment added paw88789 @RGS I think one could program it to be exact for all Python integer values. But it would be a much longer program (at least by my reckoning).
Jan 25, 2020 at 16:21 comment added RGS @paw88789 machine precision can only get you so far :)
Jan 25, 2020 at 16:18 comment added paw88789 @RGS true. I wasn't sure from the original problem statement whether it mattered that one didn't necessarily get the correct values for these larger inputs.
Jan 25, 2020 at 16:15 comment added RGS @paw88789 it probably has to do with the fact that when we are dividing, we are no longer dealing with integers. No?
Jan 25, 2020 at 15:30 comment added paw88789 Do we care that this only works for inputs of up to about $10**16$, even though Python 3 allows for much larger integers?
S Jan 24, 2020 at 19:57 history suggested mypetlion CC BY-SA 4.0
Updated TiO
Jan 24, 2020 at 19:39 review Suggested edits
S Jan 24, 2020 at 19:57
Jan 24, 2020 at 11:13 comment added RGS @Mukundan of course!!! Well pointed out :)
Jan 24, 2020 at 11:13 history edited RGS CC BY-SA 4.0
added 37 characters in body; added 3 characters in body
Jan 24, 2020 at 11:11 comment added Mukundan314 Save 2 byte by doing truediv when dividing by sqrt of 2 instead of after it like lambda x:x//2**.5
Jan 24, 2020 at 7:55 comment added RGS @Deadcode thanks for your feedback :)
Jan 24, 2020 at 7:37 comment added Deadcode Ooh, I like this method of rounding. Was scared for a moment there because I thought I wouldn't be able to accept this answer (output ends in .0), but I never said the output had to be in integer form, just that it had to be rounded to an integer. :)
Jan 24, 2020 at 7:32 history answered RGS CC BY-SA 4.0