Using Ubuntu 14.04 with python3.4.
Noticed that Geany 1.24.1 gives wrong decimals when I try to execute a script.
Wrote a very simple program (test.py):
print(float(30/8))
In Geany the answer was 3.0 but if I write in terminal:
python3.4 test.py the answer was 3.75.
Tried this on my other computer and it showed the same error.
So either both my computers are defect or this is a bug.
The default Geany configuration uses
python
which is very likely to be linked to Python 2.x on your system.And the behavior is perfectly correct with Python 2, as the operator
/
will perform an Euclidean division when operating on integers. For Python 2 to give the result you want, you'd need something likeprint(float(30)/8)
.However you can easily configure your Geany to explicitly use Python 3.x, go to Build → Set build commands and replace the occurrences of
python
withpython3
(in Execute and Compile).