[metapost] Graph v New number systems

luigi scarso luigi.scarso at gmail.com
Fri Nov 4 07:39:54 CET 2022


On Wed, 2 Nov 2022 at 20:01, luigi scarso <luigi.scarso at gmail.com> wrote:

>
>
> On Wed, 2 Nov 2022 at 18:38, Toby Thurston <thurston at eml.cc> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/metapost/attachments/20221104/3d562243/attachment.html>


More information about the metapost mailing list.