From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/24969 Path: news.gmane.org!not-for-mail From: David Arnold Newsgroups: gmane.comp.tex.context Subject: Re: Arithmetic Overflow Date: Thu, 5 Jan 2006 22:09:55 -0800 Message-ID: References: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1136527889 957 80.91.229.2 (6 Jan 2006 06:11:29 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 6 Jan 2006 06:11:29 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Fri Jan 06 07:11:22 2006 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by ciao.gmane.org with esmtp (Exim 4.43) id 1Eukoq-0003bx-DJ for gctc-ntg-context-518@m.gmane.org; Fri, 06 Jan 2006 07:11:20 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id E39FD127B9; Fri, 6 Jan 2006 07:11:19 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 32240-04; Fri, 6 Jan 2006 07:11:17 +0100 (CET) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id ABBD6127B0; Fri, 6 Jan 2006 07:11:17 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id DF811127B0 for ; Fri, 6 Jan 2006 07:11:15 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 32269-03 for ; Fri, 6 Jan 2006 07:11:14 +0100 (CET) Original-Received: from fed1rmmtao12.cox.net (fed1rmmtao12.cox.net [68.230.241.27]) by ronja.ntg.nl (Postfix) with SMTP id E595D127AA for ; Fri, 6 Jan 2006 07:11:13 +0100 (CET) Original-Received: from [10.0.1.2] (really [70.191.56.23]) by fed1rmmtao12.cox.net (InterMail vM.6.01.05.02 201-2131-123-102-20050715) with ESMTP id <20060106060853.XCXC17437.fed1rmmtao12.cox.net@[10.0.1.2]> for ; Fri, 6 Jan 2006 01:08:53 -0500 In-Reply-To: Original-To: mailing list for ConTeXt users X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.5 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:24969 Archived-At: I found warningcheck:=0. Anything allow me to get even bigger numbers to work? On Jan 5, 2006, at 6:15 PM, David Arnold wrote: > All, Is there a switch I can set to get rid of the arithmetic > overflow in the following example? > > %output=pdf > > \setupcolors[state=start] > > \definecolor[gridlines][s=0.7] > > \startMPinclusions > > color gridlines; gridlines:=\MPcolor{gridlines}; > > vardef create_grid (expr l,r,h,b,t,v,wid,ht)= > save ux, uy; numeric ux, uy; > (r-l)*ux=wid; (t-b)*uy=ht; > for k=b step v until t: > draw (l*ux,k*uy)--(r*ux,k*uy) withcolor \MPcolor{gridlines}; > endfor; > for k=l step h until r: > draw (k*ux,b*uy)--(k*ux,t*uy) withcolor \MPcolor{gridlines}; > endfor; > enddef; > > vardef create_axes (expr l,r,b,t,wid,ht,blbl) (text xlbl,ylbl) = > save ux, uy; numeric ux, uy; > (r-l)*ux=wid; (t-b)*uy=ht; > textextoffset:=3pt; > drawdblarrow (1.05*l*ux,0)--(1.05*r*ux,0); > draw textext.rt(xlbl) shifted (1.05*r*ux,0); > if blbl:draw textext.bot(decimal r) shifted (r*ux,0); fi; > drawdblarrow (0,1.05*b*uy)--(0,1.05*t*uy); > draw textext.top(ylbl) shifted (0,1.05*t*uy); > if blbl: draw textext.lft(decimal t) shifted (0,t*uy); fi; > enddef; > > vardef drawfcn (expr ind,dep,l,r,b,t,wid,ht,n) text txt = > save x, dx, ux, uy; numeric x, dx, ux, uy; > dx:=(r-l)/n; > (r-l)*ux=wid; (t-b)*uy=ht; > save cpath; path cpath; cpath:=(l,b)--(r,b)--(r,t)--(l,t)--cycle; > save p; path p; hide (x:=l;) p:=(scantokens(ind),scantokens(dep)); > for xx:=l step dx until r: > hide (x:=xx;) p:=p--(scantokens(ind),scantokens(dep)); > endfor; > hide(x:=r;) p:=p--(scantokens(ind),scantokens(dep)); > p:=p cutbefore cpath; > p:=reverse p; > p:=p cutbefore cpath; > p:=p xyscaled (ux,uy); > drawdblarrow p txt; > enddef; > > \stopMPinclusions > > \starttext > > > \startMPpage %figure library name: x2 > > %initialize window parameters > numeric xmin, xmax, xscl, ymin, ymax, yscl; > xmin:=-10; > xmax:=10; > xscl:=1; > ymin:=-10; > ymax:=10; > yscl:=1; > > %initialize number of points > numeric num_points; > num_points:=100; > > %initialize dimensions of image > numeric width, height; > width=1.5in; > height=1.5in; > > %create the grid > create_grid(xmin,xmax,xscl,ymin,ymax,yscl,width,height); > > boolean lbl_scl; lbl_scl:=true; > > %create the axes > create_axes(xmin,xmax,ymin,ymax,width,height,lbl_scl)("$x$")("$y$"); > > %draw the function > drawfcn("x","x*x",xmin,xmax,ymin,ymax,width,height,100) > withcolor blue ; > > \stopMPpage > > \startMPpage %figure library name: x4 > > %initialize window parameters > numeric xmin, xmax, xscl, ymin, ymax, yscl; > xmin:=-10; > xmax:=10; > xscl:=1; > ymin:=-10; > ymax:=10; > yscl:=1; > > %initialize number of points > numeric num_points; > num_points:=100; > > %initialize dimensions of image > numeric width, height; > width=1.5in; > height=1.5in; > > %create the grid > create_grid(xmin,xmax,xscl,ymin,ymax,yscl,width,height); > > boolean lbl_scl; lbl_scl:=true; > > %create the axes > create_axes(xmin,xmax,ymin,ymax,width,height,lbl_scl)("$x$")("$y$"); > > %draw the function > drawfcn("x","x**4",xmin,xmax,ymin,ymax,width,height,100) > withcolor blue ; > > \stopMPpage > > \startMPpage %figure library name: x6 > > %initialize window parameters > numeric xmin, xmax, xscl, ymin, ymax, yscl; > xmin:=-10; > xmax:=10; > xscl:=1; > ymin:=-10; > ymax:=10; > yscl:=1; > > %initialize number of points > numeric num_points; > num_points:=100; > > %initialize dimensions of image > numeric width, height; > width=1.5in; > height=1.5in; > > %create the grid > create_grid(xmin,xmax,xscl,ymin,ymax,yscl,width,height); > > boolean lbl_scl; lbl_scl:=true; > > %create the axes > create_axes(xmin,xmax,ymin,ymax,width,height,lbl_scl)("$x$")("$y$"); > > %draw the function > drawfcn("x","x**6",xmin,xmax,ymin,ymax,width,height,100) > withcolor blue ; > > \stopMPpage > > \stoptext > > %%% Local Variables: > %%% mode: conTeXt-en > %%% End: > > > _______________________________________________ > ntg-context mailing list > ntg-context@ntg.nl > http://www.ntg.nl/mailman/listinfo/ntg-context