summaryrefslogtreecommitdiff
path: root/Master/texmf/doc/asymptote/examples/floor.asy
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf/doc/asymptote/examples/floor.asy')
-rw-r--r--Master/texmf/doc/asymptote/examples/floor.asy28
1 files changed, 28 insertions, 0 deletions
diff --git a/Master/texmf/doc/asymptote/examples/floor.asy b/Master/texmf/doc/asymptote/examples/floor.asy
new file mode 100644
index 00000000000..02c2446abe8
--- /dev/null
+++ b/Master/texmf/doc/asymptote/examples/floor.asy
@@ -0,0 +1,28 @@
+import graph;
+unitsize(1cm);
+
+real Floor(real x) {return floor(x);}
+
+pair[] Close;
+pair[] Open;
+
+bool3 branch(real x) {
+ static real lasty;
+ static bool first=true;
+ real y=floor(x);
+ bool samebranch=first || lasty == y;
+ first=false;
+ if(samebranch) lasty=x;
+ else {
+ Close.push((x,lasty));
+ Open.push((x,y));
+ }
+ lasty=y;
+ return samebranch ? true : default;
+};
+
+draw(graph(Floor,-5.5,5.5,500,branch));
+axes("$x$",rotate(0)*"$\lfloor x\rfloor$",red);
+
+dot(Close);
+dot(Open,UnFill);