summaryrefslogtreecommitdiff
path: root/metapost
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2014-02-13 13:00:35 +0200
committerMarius <mariausol@gmail.com>2014-02-13 13:00:35 +0200
commit43b2c43c53673bbaebc0cec57d32c4609c026cd9 (patch)
treefe93e87b47c31f163d6042cc27af86d2a990fb28 /metapost
parent8c7fab57c5fd2db6b9ade5f7608add9f650c8460 (diff)
downloadcontext-43b2c43c53673bbaebc0cec57d32c4609c026cd9.tar.gz
beta 2014.02.13 11:27
Diffstat (limited to 'metapost')
-rw-r--r--metapost/context/base/mp-base.mpiv39
1 files changed, 37 insertions, 2 deletions
diff --git a/metapost/context/base/mp-base.mpiv b/metapost/context/base/mp-base.mpiv
index 638be4628..0b655ef47 100644
--- a/metapost/context/base/mp-base.mpiv
+++ b/metapost/context/base/mp-base.mpiv
@@ -323,7 +323,7 @@ primarydef w dotprod z =
enddef ;
primarydef x**y =
- if y=2 :
+ if y = 2 :
x*x
else :
takepower y of x
@@ -348,11 +348,46 @@ def takepower expr y of x =
endfor
fi
else :
- hide(errmessage "Undefined power: " & decimal x&"**"&decimal y)
+ hide(errmessage "Undefined power: " & decimal x & "**" & decimal y)
fi
fi
enddef ;
+% for big number systems:
+%
+% primarydef x**y =
+% if y = 1 :
+% x
+% elseif y = 2 :
+% x*x
+% elseif y = 3 :
+% x*x*x
+% else :
+% takepower y of x
+% fi
+% enddef ;
+%
+% vardef takepower expr y of x =
+% if (x=0) and (y>0) :
+% 0
+% else :
+% 1
+% if y = floor y :
+% if y >= 0 :
+% for n=1 upto y :
+% *x
+% endfor
+% else :
+% for n=-1 downto y :
+% /x
+% endfor
+% fi
+% else :
+% hide(errmessage "Undefined power: " & decimal x & "**" & decimal y)
+% fi
+% fi
+% enddef ;
+
vardef direction expr t of p =
postcontrol t of p - precontrol t of p
enddef ;