From 06021c4b490ff237bf7ef13ab0f7bce0e5ef11be Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 30 Mar 2019 08:48:48 -0700 Subject: u-d-arithmetic: proper treatment of ceil & round. * arith.c (r_ceil_s, r_round_s): New symbol variables. (ceildiv, roundiv): Route binary cases involving struts directly to binary methods so the object is responsible for the complete implementation. (arith_init): Initialize r_ceil_s and r_round_s. * tests/016/ud-arith.tl (numbase): Binary methods added for ceil and round. Test cases added. * txr.1: Descriptions for binary ceil and round methods added; Notes about non-existence of binary methods removed from unary ceil and round removed. --- tests/016/ud-arith.tl | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/016/ud-arith.tl b/tests/016/ud-arith.tl index d086b9e6..052fcaed 100644 --- a/tests/016/ud-arith.tl +++ b/tests/016/ud-arith.tl @@ -35,8 +35,12 @@ (:method floor (me arg) ^(floor ,me.v ,arg)) (:method r-floor (me arg) ^(floor ,arg ,me.v)) (:method floor1 (me) ^(floor ,me.v)) - (:method round1 (me) ^(round ,me.v)) + (:method ceil (me arg) ^(ceil ,me.v ,arg)) + (:method r-ceil (me arg) ^(ceil ,arg ,me.v)) (:method ceil1 (me) ^(ceil ,me.v)) + (:method round (me arg) ^(round ,me.v ,arg)) + (:method r-round (me arg) ^(round ,arg ,me.v)) + (:method round1 (me) ^(round ,me.v)) (:method sin (me) ^(sin ,me.v)) (:method cos (me) ^(cos ,me.v)) (:method tan (me) ^(tan ,me.v)) @@ -102,8 +106,12 @@ (test (floor n 0) (floor 1 0)) (test (floor 0 n) (floor 0 1)) (test (floor n) (floor 1)) -(test (round n) (round 1)) +(test (ceil n 0) (ceil 1 0)) +(test (ceil 0 n) (ceil 0 1)) (test (ceil n) (ceil 1)) +(test (round n 0) (round 1 0)) +(test (round 0 n) (round 0 1)) +(test (round n) (round 1)) (test (sin n) (sin 1)) (test (cos n) (cos 1)) (test (tan n) (tan 1)) -- cgit v1.2.3