Compute Variable: Division does not work?

Everything related to development of the jamovi platform
Post Reply
Terpsichord
Posts: 3
Joined: Thu Apr 25, 2019 8:42 am

Compute Variable: Division does not work?

Post 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!
User avatar
jonathon
Posts: 2613
Joined: Fri Jan 27, 2017 10:04 am

Re: Compute Variable: Division does not work?

Post 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
User avatar
jonathon
Posts: 2613
Joined: Fri Jan 27, 2017 10:04 am

Re: Compute Variable: Division does not work?

Post 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
Terpsichord
Posts: 3
Joined: Thu Apr 25, 2019 8:42 am

Re: Compute Variable: Division does not work?

Post by Terpsichord »

wow, thanks! opening files works again, too
Post Reply