All pastes #735563 Raw Edit

arithmetic max

public text v1 · immutable
·published 2007-10-13 19:00 UTC
rendered paste body
REQUIRE /TEST ~profit/lib/testing.f

: max ( a b - max )  2DUP + 2/ -ROT - ABS 2 /MOD + + ;

/TEST
REQUIRE TESTCASES ~ygrek/lib/testcase.f 

TESTCASES max testing
(( 10 3 max -> 10 ))
(( 9 10 max -> 10 ))
(( -4 10 max -> 10 ))
(( -3 -5 max -> -3 ))
END-TESTCASES