Compute Variable: Division does not work?

Everything related to development of the jamovi platform

by Terpsichord » Fri Sep 27, 2019 5:42 pm

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

by jonathon » Sat Sep 28, 2019 2:17 am

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: 965
Joined: Fri Jan 27, 2017 10:04 am

by jonathon » Sat Sep 28, 2019 6:26 am

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

by Terpsichord » Mon Sep 30, 2019 5:18 pm

wow, thanks! opening files works again, too
Terpsichord
 
Posts: 3
Joined: Thu Apr 25, 2019 8:42 am


Return to jamovi development