[PD] haversine formula in Pd

Cyrille Henry ch at chnry.net
Sun Jun 7 08:10:29 CEST 2015



Le 07/06/2015 04:48, Max a écrit :
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Merci Cyrille,
>
> in the formula the intermediate steps are quite small fractions and it
> seems their precision is important.
> In the test case the Pd implementation is 8917.74 km off the proper
> result (2887.26). However I need a precision of about 1m.
i don't know how you get the 2887.26 km proper result : it's not the value computed by the website you send (using value in the patch).

>
> So I assume the haversine formula is not implementable in Pd at all?
> (unless double precision will be there that is)
>
> Or is there a workaround?

i'll thing about it.
cheers
c


>
> m.
>
>
> On 2015년 06월 07일 05:05, Cyrille Henry wrote:
>> hello,
>>
>> pow 2 did not like negative number. use "t f f" and "*" in order to
>> compute the square of a number.
>>
>> i correct 2 of your formula according to what i found in your
>> link. they both gives the same result : 11805 the same value
>> computed with your 2nd link gives 12210. for other value, it also
>> look close. so i guess the difference is number precision.
>>
>>
>> cheers c
>>
>>
>>
>> Le 06/06/2015 20:18, Max a écrit :
>>> I tried to implement the Haversine formula in Pd which should
>>> give you the distance in km between two lat long coordinates.
>>>
>>> https://en.wikipedia.org/wiki/Haversine_formula
>>> http://www.movable-type.co.uk/scripts/latlong.html
>>>
>>> One huge obstacle is the imprecision of the 32bit floats, but
>>> even without that I can't get the formula to work. I kept 3
>>> failed implementations in the test-case.
>>>
>>> http://rosettacode.org/wiki/Haversine_formula
>>>
>>> Could someone give me a hand please?
>>>
>>>
>>>
>>> _______________________________________________
>>> Pd-list at lists.iem.at mailing list UNSUBSCRIBE and
>>> account-management ->
>>> http://lists.puredata.info/listinfo/pd-list
>>>
>>
>>
>> _______________________________________________
>> Pd-list at lists.iem.at mailing list UNSUBSCRIBE and
>> account-management -> http://lists.puredata.info/listinfo/pd-list
>>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1
>
> iEYEARECAAYFAlVzsO0ACgkQ3EB7kzgMM6KETQCfRvgOmpqbmyhZaH2Y5hzsRHlC
> XOgAnR+6lqxJfjTj5k7vR747UU8ATrqA
> =pBZv
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> Pd-list at lists.iem.at mailing list
> UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
>



More information about the Pd-list mailing list