Funny math, microwaves, and user interface

I’ve been contemplating the math that my microwave uses. It’s kinda weird. If you forget that it works on time values instead of regular integers, you can get some surprising responses.

My microwave oven is digital, so I enter a set of numbers to indicate the cooking time. I’m not sure if all microwaves are like mine, but mine will accept integer values that are not logical clock values. I can enter, for example, 75, and it will run for 75 seconds. If you forget, for an instant, that you’re dealing with clock values, the inputs and outputs (what you type and how long it runs) can seem pretty weird.Consider the following inputs and outputs:

Input Output
1 1
99 99
100 60
101 61
199 159
200 120
299 219

I decided to try to mock this up in Excel. It turns out that you can paste this into a cell, and it will give the output (number of seconds) given the input (integers typed on the keypad).

=IF(A1<100,A1,(TRUNC(A1/100)*60)+(A1-(TRUNC(A1/100)*100)))

I like this as an example of user interface design because it has some really unintuitive effects. I have some ideas how I might use this one day in training testers and security folks.