[metapost] Metafun: the pi number in double precision

luigi scarso luigi.scarso at gmail.com
Sat Jan 25 11:20:26 CET 2014


On Sat, Jan 25, 2014 at 9:05 AM, Franck Pastor <franck.pastor at me.com> wrote:
>
> Hello,
>
> I am still practicing with the brand new double number system. This time
I noticed something wrong with the pi number as it is defined in the
Metafun format.
>
> With numbersystem=scaled,  "show pi;"  returns (as expected)
>
> >> 3.14159
>
> Now, with numbersystem set to double, it returns
>
> >> 3.1415926
>
> Only two more decimals, whereas I expected something with plenty of
decimals, like
>
> 3.14159265358979
>
> Is it a bug? or a feature? I couldn't help noticing that Metafun's answer
is precisely the number version of the TeX's distribution to be found in
TeX Live 2013…
>
> Thanks,
>
> Franck Pastor
> --
> http://tug.org/metapost/
I see this:

$> cat test.mp
pi := 3.14159265358979323846;
show pi;
end.

$> mpost --version
MetaPost 1.803 (TeX Live 2013)
The MetaPost source code in the public domain.
MetaPost also uses code available under the
GNU Lesser General Public License (version 3 or later);
therefore MetaPost executables are covered by the LGPL.
There is NO warranty.
For more information about these matters, see the file
COPYING.LESSER or <http://gnu.org/licenses/lgpl.html>.
Original author of MetaPost: John Hobby.
Author of the CWEB MetaPost: Taco Hoekwater.

$> for j in scaled double binary decimal; do  echo "%%%%% $j "; mpost
 -numbersystem=$j  test.mp; done
%%%%% scaled
This is MetaPost, version 1.803 (kpathsea version 6.1.1)
(/opt/luatex/standalone-mkiv-new/tex/texmf/metapost/base/mpost.mp(/opt/luatex/standalone-mkiv-new/tex/texmf/metapost/base/
plain.mp
Preloading the plain mem file, version 1.004) ) (./test.mp
>> 3.14159 )
Transcript written on test.log.
%%%%% double
This is MetaPost, version 1.803 (kpathsea version 6.1.1)
(/opt/luatex/standalone-mkiv-new/tex/texmf/metapost/base/mpost.mp(/opt/luatex/standalone-mkiv-new/tex/texmf/metapost/base/
plain.mp
Preloading the plain mem file, version 1.004) ) (./test.mp
>> 3.14159265358979 )
Transcript written on test.log.
%%%%% binary
This is MetaPost, version 1.803 (kpathsea version 6.1.1)
(/opt/luatex/standalone-mkiv-new/tex/texmf/metapost/base/mpost.mp(/opt/luatex/standalone-mkiv-new/tex/texmf/metapost/base/
plain.mp
Preloading the plain mem file, version 1.004) ) (./test.mp
>> 3.14159265358979 )
Transcript written on test.log.
%%%%% decimal
This is MetaPost, version 1.803 (kpathsea version 6.1.1)
(/opt/luatex/standalone-mkiv-new/tex/texmf/metapost/base/mpost.mp(/opt/luatex/standalone-mkiv-new/tex/texmf/metapost/base/
plain.mp
Preloading the plain mem file, version 1.004) ) (./test.mp
>> 3.14159265358979 )
Transcript written on test.log.

-- 
luigi
 Hello,

I am still practicing with the brand new double number system. This time I
noticed something wrong with the pi number as it is defined in the Metafun
format.

With numbersystem=scaled,  "show pi;"  returns (as expected)

>> 3.14159

Now, with numbersystem set to double, it returns

>> 3.1415926

Only two more decimals, whereas I expected something with plenty of
decimals, like

3.14159265358979

Is it a bug? or a feature? I couldn't help noticing that Metafun's answer
is precisely the number version of the TeX's distribution to be found in
TeX Live 2013…

Thanks,

Franck Pastor
--
http://tug.org/metapost/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/metapost/attachments/20140125/74469e78/attachment.html>


More information about the metapost mailing list