Page 1 of 1

Compute Variable: Division does not work?

Posted: Fri Sep 27, 2019 5:42 pm
by Terpsichord
1) Compute Variable: The formula

Code: Select all

`variable1`/`variable`
does not work for me on the latest Windows 10 version and Jamovi 1.1.4 version. It only shows "0" as result. If I use

Code: Select all

1/2
it does not work either. However

Code: Select all

2/1
works fine. Seems to be a problem with decimals? Am I doing something wrong or is this a bug?

2) I used to open .omv files directly by double clicking on them. Now that will just open an empty Jamovi file. But opening datasets from the menu works fine.

Thanks for reading!

Re: Compute Variable: Division does not work?

Posted: Sat Sep 28, 2019 2:17 am
by jonathon
hi,

so the computer science answer is that when you divide two integers, the result itself is an integer. so 1/2 = 0.5, which is then truncated to 0.

if you go 1.0/2 you'll get the expected 0.5

it's an issue which crops up in a lot of places, i.e.

https://stackoverflow.com/questions/213 ... -7-and-3-3

so now i'm wondering if there's any issue with treating *all* divisions as decimals. i'm not entirely sure. i'll have to think about it.

wrt double clicking .omv files, yup, i'm on it.

cheers

jonathon

Re: Compute Variable: Division does not work?

Posted: Sat Sep 28, 2019 6:26 am
by jonathon
hi,

i've decided to treat all divisions from now on as floating point, so 1/2 will now equal 0.5

i've also added an integer divide for the old behaviour 1//2, will now equal 0

this will be in the 1.1.6 version or newer.

(wrt file associations not working, the 1.1.5 will fix this)

thanks for reporting.

jonathon

Re: Compute Variable: Division does not work?

Posted: Mon Sep 30, 2019 5:18 pm
by Terpsichord
wow, thanks! opening files works again, too