Radio Buttons do not like value "0.07"

I’m still having odd issues with Radio Buttons on my form. This group of 5 buttons is only the 2nd group of buttons on my form. The other group is a pair of 2 that have worked without issue.

These 5 were working fine as a group yesterday - but suddenly stopped doing so today. Each button sets a value in a CommissionRate - and executes a call to a common procedure that calculates several other fields, like commission fee and net profit, etc.

I’ve tried:
Copying form elements from the original form to a new form
Moving to a fresh install of Catalina (had been working under Mojave)

Tonight, while testing, all 5 buttons in the group ceased to select/deselect - though, they were still putting the correct data in the associated field. Refreshing the form by closing and opening did not help. What DID restore the buttons to working order was to go into Data Button Options to uncheck and then recheck “Radio” Button for each.

Now, with them functioning again, I continued testing and found the value “0.07” produced odd behavior.

The buttons are associated with a floating number field called “CommissionRate”. Values should be 0, 0.01, 0.03, 0.05, and 0.07. All except 0.07 function correctly. No matter which button I assign 0.07, it displays in the form’s TextEdit field with trailing zeroes - as “0.07000”. This also results in that button not selecting/deselecting - although the data sheet shows the correct “0.07” value.

Though no output pattern was set originally, setting it to #.## has not solved this issue.

The internal representation of floating point values is binary, not decimal. The relevance of that to this situation is that many decimal fractional values cannot be exactly represented. For example 0.07 cannot be stored as an exact binary value, as you can see if you enter it in the Formula Workshop:

This is why your checkboxes don’t work. The checkbox requires an exact match (it knows nothing about output patterns), and for fractional values like this, that is impossible. (The data sheet show 0.07 because it is using an output pattern that rounds off the value. If you put in an output pattern that shows full precision, you’ll see the same result in the data sheet.)

My recommendation would to be use only text or integers with checkboxes. In this case I think it would make a lot more sense to use integer values of 1, 3, 5 and 7, and then divide by 100 as needed in any formulas that use this value.

If you have your heart set on using fractional floating point values with data buttons, you can’t do it directly linking to a field. You would have to use Formula mode, and use a formula that rounds the value, perhaps by using a pattern. See Formula Mode on the Data Button help page.

This is not a Panorama issue, it is an general issue with how floating point values are handled in modern computers. If you want to learn more about the details, I would suggest googling

floating-point fractional number problems

I just tried this search and it immediately came up with a wealth of web pages on this topic.

In the long run, this could be fixed by making data buttons (and popup menu buttons, etc.) aware of output patterns. I’ll add this to the list, with the caveat that this is very low priority, especially since there is an available workaround.

Using the fractional values seemed the most straightforward way to go… but calculating the decimal from a whole number was going to be my next approach. Interesting - I think computers are so precise that if I specify “.07” that I should get that and nothing more or less. So thanks for the education. You don’t know what you don’t know until someone tells you.

I’ve set the buttons and field to deal with an integer value… and my procedure to calculate divided by 100. It all works now. Of course!