From 9c93bc20cc68e50461bb086f24f335de9dcc5135 Mon Sep 17 00:00:00 2001 From: Peter Mikkelsen Date: Sat, 22 Jan 2022 16:53:29 +0000 Subject: =?UTF-8?q?Implement=20=E2=8E=95DIV=20for=20allowing=20division=20?= =?UTF-8?q?by=20zero=20to=20result=20in=200=20if=20needed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- functions.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'functions.c') diff --git a/functions.c b/functions.c index 870ee17..2e0bfa2 100644 --- a/functions.c +++ b/functions.c @@ -680,8 +680,12 @@ SCALAR_FUNCTION_2(fnTimes, 0, left->type, SCALAR_FUNCTION_2(fnDivide, 1, left->type, case AtypeFloat: - if(right->floatdata[i] == 0) - throwerror(nil, EDomain); + if(right->floatdata[i] == 0){ + if(currentsymtab->div) + res->floatdata[i] = 0; + else + throwerror(nil, EDomain); + } else res->floatdata[i] /= right->floatdata[i]; break; -- cgit v1.2.3