[metapost] The "angle" function clashes with numbersystem=double

Franck Pastor franck.pastor at me.com
Thu Jan 2 23:21:39 CET 2014


> 
> Hi Franck,
> 
> On 01/01/2014 02:02 PM, Franck Pastor wrote:
>> 
>> But if the same program is executed with numbersystem set to
>> "double", a=angle((1, 6)) becomes way too approximate: 80,5625
>> instead of 80.5367, and the accuracy of its tangent suffers
>> accordingly. Here is the console output: [...]
>> 
>> Any idea of why it has gone wrong?
> 
> Yeah, I've got it. I was trying to fix a precision issue in the
> wrong way. I was rounding the value in the angle in a misguided
> attempt to fix this 'problem':
> 
>  >> "double"
>  >> 80.53767779197439
>  >> 6.000000000000003
> 
> Obviously the rounding thing was wrong, but the above output is
> also horrible, so I also changed the double print routine to
> use a ".15g" printf() argument instead of ".16g". My development
> version now outputs:
> 
>  >> "double"
>  >> 80.5376777919744
>  >> 6
> 
> Best wishes,
> Taco
> 
> -

Great! Thanks for the quick solving.

Gelukkig nieuwjaar,

Franck Pastor




More information about the metapost mailing list