diff options
Diffstat (limited to 'functions.c')
-rw-r--r-- | functions.c | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/functions.c b/functions.c index daff046..43a2505 100644 --- a/functions.c +++ b/functions.c @@ -72,9 +72,9 @@ fndyad dyadfunctiondefs[] = { 0, /* ○ */ 0, /* ! */ 0, /* ? */ - 0, /* | */ - 0, /* ⌈ */ - 0, /* ⌊ */ + fnResidue, /* | */ + fnMaximum, /* ⌈ */ + fnMinimum, /* ⌊ */ 0, /* ⊥ */ 0, /* ⊤ */ fnLeft, /* ⊣ */ @@ -592,6 +592,32 @@ SCALAR_FUNCTION_2(fnLogarithm, 1, break; ) +SCALAR_FUNCTION_2(fnResidue, 1, + case AtypeFloat: + if(res->floatdata[i] == 0) + res->floatdata[i] = right->floatdata[i]; + else + res->floatdata[i] = right->floatdata[i] - res->floatdata[i] * floor(right->floatdata[i]/res->floatdata[i]); +) + +SCALAR_FUNCTION_2(fnMaximum, 0, + case AtypeFloat: + if(res->floatdata[i] < right->floatdata[i]) + res->floatdata[i] = right->floatdata[i]; + case AtypeInt: + if(res->intdata[i] < right->intdata[i]) + res->intdata[i] = right->intdata[i]; +) + +SCALAR_FUNCTION_2(fnMinimum, 0, + case AtypeFloat: + if(res->floatdata[i] > right->floatdata[i]) + res->floatdata[i] = right->floatdata[i]; + case AtypeInt: + if(res->intdata[i] > right->intdata[i]) + res->intdata[i] = right->intdata[i]; +) + Array * fnLeft(Array *left, Array *right) { |