calca

Open full view…

How should I define max()?

frustrati
Sun, 07 Dec 2014 10:21:40 GMT

Expected behaviour: --- max(x,y) = if x < y then y else x max(£0,£1) => £1 max(£1,£2) => £2 max(£2,£3) => £3 --- Actual behaviour: --- max(x,y) = if x < y then y else x max(£0,£1) => if 0 < £ then £ else 0 max(£1,£2) => if £ < £2 then £2 else £ max(£2,£3) => £3 --- What am I doing wrong? How should I be defining max()? (I can put up with £1 appearing as £, but Calca not simplifying the calculation is infuriating.)

zimmie
Thu, 15 Jan 2015 14:26:44 GMT

The issue appears to be with a symbol associated with the number. I see the same behavior with the dollar sign in front and the cent sign afterwards. Space separation does not affect it. I also tried it with units that are known to work ('max(1 kmph, 3 mph)') and the behavior is the same. I suspect the input is being simplified to "1 * kmph" rather than kmph being associated as a unit with the magnitude 1. This appears to be a special case for the integers 0 and 1.