From 9054a17e1bbc1f302774e76466139cf21975fa4c Mon Sep 17 00:00:00 2001 From: Koichi Nakamura Date: Sun, 10 Jan 2021 17:34:23 +0900 Subject: [PATCH] Add abs --- bootstrap.fs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bootstrap.fs b/bootstrap.fs index 19a32bb..d354e7b 100644 --- a/bootstrap.fs +++ b/bootstrap.fs @@ -814,6 +814,8 @@ allot-cell : &find! [ ' L , , ] ; \ ( c-addr -- nt ) Throw exception at error : max 2dup > if drop else nip then ; : min 2dup < if drop else nip then ; +: abs dup 0< if negate then ; + \ === Multiline Comment === : '(' [ key ( ] literal ; @@ -2424,7 +2426,7 @@ need-defined (read) catch throw success : ; create :noname does> variable constant ' ['] compile [compile] literal - + - * div mod negate not and or xor invert within max min + + - * div mod negate not and or xor invert within max min abs < > <= >= = <> 0< 0> 0<= 0>= 0= 0<> 1+ 1- true false