From e1714aceff24c8c8434626375d736e6ece9b52ce Mon Sep 17 00:00:00 2001 From: d_m Date: Fri, 29 Dec 2023 16:35:39 -0500 Subject: [PATCH] improve name: abs -> abs-sign --- math-notes.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/math-notes.txt b/math-notes.txt index 3f25a25..be67b2e 100644 --- a/math-notes.txt +++ b/math-notes.txt @@ -66,11 +66,11 @@ Other instructions will not handle "negative" integers correctly: way to handle this is to make both values non-negative, do unsigned division (i.e. DIV) and then set the correct sign at the end. - @abs ( x^ -- abs-x^ sign^ ) + @abs-sign ( x^ -- abs-x^ sign^ ) DUP #7f GTH #fe MUL INC STHk MUL STHr JMP2r @signed-div ( x^ y^ -- x/y^ ) - abs STH SWP abs STH SWP DIV MULr STHr MUL JMP2r + abs-sign STH SWP abs-sign STH SWP DIV MULr STHr MUL JMP2r Be careful! The smallest negative value (-128 for bytes, -32768 for shorts) has no corresponding positive value. This means that some operations will