Re: Graph v New number systems
Toby Thurston <[email protected]> Fri, 4 Nov 2022 08:25:04 +0000
| Newsgroups | gmane.comp.tex.metapost |
|---|---|
| Message-ID | <[email protected]> |
thanks for that. I think I will have a further look at marith.mp then, and see if it could be made compatible with the extended number systems. Something like: if numbersystem = “scaled”: % do normal marith else: % provide versions of all the marith functions that work with new number systems fi Toby > On 4 Nov 2022, at 06:39, luigi scarso <[email protected]> wrote: > > > > On Wed, 2 Nov 2022 at 20:01, luigi scarso <[email protected]> wrote: > > > On Wed, 2 Nov 2022 at 18:38, Toby Thurston <[email protected]> wrote: > Can I draw your attention to this unanswered question on TeX.SE? > > https://tex.stackexchange.com/q/507361/15036 > > the questioner had found that this graph is created correctly with the scaled number system > > > hm... I will check surely for this weekend. > > > I am afraid that there's nothing we can do... graph.mp uses marith.mp, which is fine only for the scaled numbersystem. > We ca see the problem here: save the example below as test.mp, test-decimal.mp and test-decimal10.mp > > loggingall; > %%numberprecision:=10; > prologues := 3; > outputtemplate := "%j%c.%{outputformat}"; > input graph > beginfig(1); > numeric width; width = 7cm; > draw begingraph(width, 0.618034 width); > setrange((-4, 0), (11, 100)); > gdraw "setrange.data"; > endgraph; > endfig; > end. > where in test-decimal10.mp we uncomment %%numberprecision:=10; > then > $>mpost test.mp > $>mpost -numbersystem=decimal test-decimal.mp > $>mpost -numbersystem=decimal test-decimal10.mp > > If we > $>diff -y -W200 test.log test-decimal.log > at some point we see > > Mabs<primary>->begingroup(EXPR2)*0.5*2endgroup Mabs<primary>->begingroup(EXPR2)*0.5*2endgroup > (SUFFIX0)<- (SUFFIX0)<- > (SUFFIX1)<-Mabs (SUFFIX1)<-Mabs > (EXPR2)<-354.89137 | (EXPR2)<-354.8913717054810609216228461865864 > {begingroup} {begingroup} > {(354.89137)*(0.5)} | {(354.8913717054810609216228461865864)*(0.5)} > {(177.4457)*(2)} | {(177.4456858527405304608114230932932)*(2)} > {endgroup} {endgroup} > {(354.89137)=(354.89139)} | {(354.8913717054810609216228461865864)=(354.8913717054810609216228461865864)} > {false} | {true} > {fi} | {else} > {mexp(354.89137)} | {mexp(354.8913717054810609216228461865864)} > {-(4)} < > {endgroup} {endgroup} > {restoring warningcheck=0} {restoring warningcheck=0} > {endgroup} {endgroup} > {(X_.low)=(-4)} | {(X_.low)=(4.000000238418586206989998773161838)} > ## X_.low=-4 | ## X_.low=4.000000238418586206989998773161838 > {if} {if} > {length(2)} {length(2)} > {(2)<>(1)} {(2)<>(1)} > {true} {true} > > while > $>diff -y -W200 test.log test-decimal10.log > > Mabs<primary>->begingroup(EXPR2)*0.5*2endgroup Mabs<primary>->begingroup(EXPR2)*0.5*2endgroup > (SUFFIX0)<- (SUFFIX0)<- > (SUFFIX1)<-Mabs (SUFFIX1)<-Mabs > (EXPR2)<-354.89137 | (EXPR2)<-354.8913717 > {begingroup} {begingroup} > {(354.89137)*(0.5)} | {(354.8913717)*(0.5)} > {(177.4457)*(2)} | {(177.4456859)*(2)} > {endgroup} {endgroup} > {(354.89137)=(354.89139)} | {(354.8913717)=(354.8913718)} > {false} {false} > {fi} {fi} > {mexp(354.89137)} | {mexp(354.8913717)} > {-(4)} | {-(4.00000024)} > {endgroup} {endgroup} > {restoring warningcheck=0} {restoring warningcheck=0} > {endgroup} {endgroup} > {(X_.low)=(-4)} | {(X_.low)=(-4.00000024)} > ## X_.low=-4 | ## X_.low=-4.00000024 > {if} {if} > {length(2)} {length(2)} > {(2)<>(1)} {(2)<>(1)} > {true} {true} > > > (test-decimal10.mp fails in another point, btw). > Same for the double and the binary numbersystem. > > > -- > luigi -- http://tug.org/metapost/