Compare commits
10 commits
b98bb3b06b
...
b22aef12ef
Author | SHA1 | Date | |
---|---|---|---|
b22aef12ef | |||
|
5901380a6d | ||
|
15c23f04e5 | ||
|
ca9fe5abed | ||
|
aeb7a3836d | ||
|
d080ed2b8d | ||
|
82bdd9718c | ||
|
4db973014b | ||
|
55605b632a | ||
|
376f57f9c6 |
3 changed files with 62 additions and 3 deletions
27
LICENSE
Normal file
27
LICENSE
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
Copyright (c) 2014-2019, Radovan Bast
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
* Neither the name of git-bisect-exercise nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from
|
||||||
|
this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
|
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
32
README.md
Normal file
32
README.md
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
[![License](https://img.shields.io/badge/license-%20BSD--3-blue.svg)](../master/LICENSE)
|
||||||
|
|
||||||
|
|
||||||
|
## Git bisect exercise
|
||||||
|
|
||||||
|
### Motivation
|
||||||
|
|
||||||
|
The motivation for this exercise is to be able to do archaeology with Git on a
|
||||||
|
source code where the bug is difficult to see visually. **Finding the offending
|
||||||
|
commit is often more than half the debugging**.
|
||||||
|
|
||||||
|
|
||||||
|
### Background
|
||||||
|
|
||||||
|
The script `get_pi.py` approximates pi using terms of the Nilakantha series. It
|
||||||
|
should produce 3.14 but it does not. The script broke at some point and
|
||||||
|
produces 3.57 using the last commit:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ python get_pi.py
|
||||||
|
|
||||||
|
3.57
|
||||||
|
```
|
||||||
|
|
||||||
|
At some point within the 500 first commits, an error was introduced. The only
|
||||||
|
thing we know is that the first commit worked correctly.
|
||||||
|
|
||||||
|
|
||||||
|
### Your task
|
||||||
|
|
||||||
|
Clone or fork this repository and use `git bisect` to find the commit which
|
||||||
|
broke the computation.
|
|
@ -1,16 +1,16 @@
|
||||||
# commit 492
|
# commit 500
|
||||||
t0 = 3.0 + 0.16666666666666666
|
t0 = 3.0 + 0.16666666666666666
|
||||||
t1 = t0 + -0.03333333333333333
|
t1 = t0 + -0.03333333333333333
|
||||||
t2 = t1 + 0.011904761904761904
|
t2 = t1 + 0.011904761904761904
|
||||||
t3 = t2 + -0.005555555555555556
|
t3 = t2 + -0.005555555555555556
|
||||||
t4 = t3 + 0.0030303030303030303
|
t4 = t3 + 0.0030303030303030303 # this comment is added to obfuscate git blame
|
||||||
t5 = t4 + -0.0018315018315018315
|
t5 = t4 + -0.0018315018315018315
|
||||||
t6 = t5 + 0.0011904761904761906
|
t6 = t5 + 0.0011904761904761906
|
||||||
t7 = t6 + 0.4312830065359477
|
t7 = t6 + 0.4312830065359477
|
||||||
t8 = t7 + 0.0005847953216374269
|
t8 = t7 + 0.0005847953216374269
|
||||||
t9 = t8 + -0.0004329004329004329
|
t9 = t8 + -0.0004329004329004329
|
||||||
t10 = t9 + 0.00032938076416337287
|
t10 = t9 + 0.00032938076416337287
|
||||||
t11 = t10 + -0.0002564102564102564 # this comment is added to obfuscate git blame
|
t11 = t10 + -0.0002564102564102564
|
||||||
t12 = t11 + 0.0002035002035002035
|
t12 = t11 + 0.0002035002035002035
|
||||||
t13 = t12 + -0.00016420361247947455
|
t13 = t12 + -0.00016420361247947455
|
||||||
print('%.2f' % (t13))
|
print('%.2f' % (t13))
|
||||||
|
|
Loading…
Reference in a new issue