shithub: patch

ref: b479ec0292521b730c716bd7d07b16514178932a
dir: /fplot-abs/

View raw version
diff -r 82ca4d784349 sys/src/cmd/fplot.c
--- a/sys/src/cmd/fplot.c	Sun Jul 01 23:35:23 2018 -0400
+++ b/sys/src/cmd/fplot.c	Thu Jul 05 04:41:48 2018 +0200
@@ -61,6 +61,7 @@
 void oexp(void) { *sp = exp(*sp); }
 void olog(void) { *sp = log10(*sp); }
 void oln(void) { *sp = log(*sp); }
+void oabs(void) { *sp = fabs(*sp); }
 
 struct Operator {
 	char *s;
@@ -85,6 +86,7 @@
 	"exp",	OUNARY,		0,	300,	oexp,
 	"log",	OUNARY,		0,	300,	olog,
 	"ln",	OUNARY,		0,	300,	oln,
+	"abs",	OUNARY,		0,	300,	oabs,
 };
 
 struct Constant {