# Haversine Formulas (Or ACOS/COS/SINor SQT) Not functioning with Sensor Location

**URL:** <https://community.thunkable.com/t/haversine-formulas-or-acos-cos-sinor-sqt-not-functioning-with-sensor-location/2753592>\
**Category:** Issues / Bugs\
**Tags:** help\
**Created:** [December 17, 2023, 9:35pm UTC](https://community.thunkable.com/t/haversine-formulas-or-acos-cos-sinor-sqt-not-functioning-with-sensor-location/2753592 "2023-12-17T21:35:58Z")\
**Posts on this page:** 18\
**Page:** 2

<div class="post-metadata">

**Author:** ![cresto.pgaxq2](https://avatars.discourse-cdn.com/v4/letter/c/8edcca/32.png) [@cresto.pgaxq2](https://community.thunkable.com/u/cresto.pgaxq2)\
**Post date:** [December 25, 2023, 6:00pm UTC](https://community.thunkable.com/t/haversine-formulas-or-acos-cos-sinor-sqt-not-functioning-with-sensor-location/2753592/22 "2023-12-25T18:00:23Z")

</div>

Is there a formula that would give higher accuracy

---

<div class="post-metadata">

**Author:** ![manyone](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@manyone](https://community.thunkable.com/u/manyone)\
**Post date:** [December 25, 2023, 6:05pm UTC](https://community.thunkable.com/t/haversine-formulas-or-acos-cos-sinor-sqt-not-functioning-with-sensor-location/2753592/23 "2023-12-25T18:05:27Z")

</div>

You can look it up, Maye you might find one. However if you like the figures that excel gives you, you might want to change your program so it uses excel to perform the computation. Readthe excel file, then provide the lat-longs into 4 cells, run it through excel. Then pick up the value from the result cell.

If you have time to pursue it, you might try the vincenty formula. I haven’t tried it. You will probably find it working in excel but maybe off after you transcribe to thunkable.

---

<div class="post-metadata">

**Author:** ![cresto.pgaxq2](https://avatars.discourse-cdn.com/v4/letter/c/8edcca/32.png) [@cresto.pgaxq2](https://community.thunkable.com/u/cresto.pgaxq2)\
**Post date:** [December 25, 2023, 6:39pm UTC](https://community.thunkable.com/t/haversine-formulas-or-acos-cos-sinor-sqt-not-functioning-with-sensor-location/2753592/24 "2023-12-25T18:39:20Z")

</div>

I had started doing that a day ago.

That’s what I thought.

My thought is probably need to have a user id loading in background

When push data to sheets , returns all associated with user id

I know sheets weren’t live updates

Has Thunkable fixed that

---

<div class="post-metadata">

**Author:** ![cresto.pgaxq2](https://avatars.discourse-cdn.com/v4/letter/c/8edcca/32.png) [@cresto.pgaxq2](https://community.thunkable.com/u/cresto.pgaxq2)\
**Post date:** [December 25, 2023, 6:39pm UTC](https://community.thunkable.com/t/haversine-formulas-or-acos-cos-sinor-sqt-not-functioning-with-sensor-location/2753592/25 "2023-12-25T18:39:31Z")

</div>

Thanks for the help

---

<div class="post-metadata">

**Author:** ![cresto.pgaxq2](https://avatars.discourse-cdn.com/v4/letter/c/8edcca/32.png) [@cresto.pgaxq2](https://community.thunkable.com/u/cresto.pgaxq2)\
**Post date:** [December 25, 2023, 8:42pm UTC](https://community.thunkable.com/t/haversine-formulas-or-acos-cos-sinor-sqt-not-functioning-with-sensor-location/2753592/26 "2023-12-25T20:42:18Z")

</div>

Was able to get the results of sin1, cos1, cos 2, sin2

They match excel

Thinkable won’t compute sin1+cos1xcos2xsin2

---

<div class="post-metadata">

**Author:** ![cresto.pgaxq2](https://avatars.discourse-cdn.com/v4/letter/c/8edcca/32.png) [@cresto.pgaxq2](https://community.thunkable.com/u/cresto.pgaxq2)\
**Post date:** [December 25, 2023, 8:43pm UTC](https://community.thunkable.com/t/haversine-formulas-or-acos-cos-sinor-sqt-not-functioning-with-sensor-location/2753592/27 "2023-12-25T20:43:21Z")

</div>

In the Vincenty formula

---

<div class="post-metadata">

**Author:** ![manyone](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@manyone](https://community.thunkable.com/u/manyone)\
**Post date:** [December 26, 2023, 8:45am UTC](https://community.thunkable.com/t/haversine-formulas-or-acos-cos-sinor-sqt-not-functioning-with-sensor-location/2753592/28 "2023-12-26T08:45:41Z")

</div>

Can you send me the link to the vincenty formula you’re trying to transcribe to thinkable. thanks

---

<div class="post-metadata">

**Author:** ![cresto.pgaxq2](https://avatars.discourse-cdn.com/v4/letter/c/8edcca/32.png) [@cresto.pgaxq2](https://community.thunkable.com/u/cresto.pgaxq2)\
**Post date:** [December 26, 2023, 7:15pm UTC](https://community.thunkable.com/t/haversine-formulas-or-acos-cos-sinor-sqt-not-functioning-with-sensor-location/2753592/29 "2023-12-26T19:15:45Z")

</div>

[https://x.thunkable.com/projects/6587784c856ddf4fb5cabc7d/a1d0388b-3667-4498-b7bd-bbbbcea516d4/blocks](https://x.thunkable.com/projects/6587784c856ddf4fb5cabc7d/a1d0388b-3667-4498-b7bd-bbbbcea516d4/blocks)

---

<div class="post-metadata">

**Author:** ![manyone](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@manyone](https://community.thunkable.com/u/manyone)\
**Post date:** [December 26, 2023, 10:08pm UTC](https://community.thunkable.com/t/haversine-formulas-or-acos-cos-sinor-sqt-not-functioning-with-sensor-location/2753592/30 "2023-12-26T22:08:10Z")

</div>

Can you give me a link to the vincenty formula you Are trying to use? I got your thunkable program but i want to see where you’re copying from

---

<div class="post-metadata">

**Author:** ![cresto.pgaxq2](https://avatars.discourse-cdn.com/v4/letter/c/8edcca/32.png) [@cresto.pgaxq2](https://community.thunkable.com/u/cresto.pgaxq2)\
**Post date:** [December 27, 2023, 12:32am UTC](https://community.thunkable.com/t/haversine-formulas-or-acos-cos-sinor-sqt-not-functioning-with-sensor-location/2753592/31 "2023-12-27T00:32:02Z")

</div>

You had posted a Google sheet spreadsheet a couple years ago.

Some of it is relevant in regards to the vencinty formula.

I adjusted some of the formulas to find specific answers.

But really I was trying to copy the picture above

---

<div class="post-metadata">

**Author:** ![cresto.pgaxq2](https://avatars.discourse-cdn.com/v4/letter/c/8edcca/32.png) [@cresto.pgaxq2](https://community.thunkable.com/u/cresto.pgaxq2)\
**Post date:** [December 27, 2023, 12:35am UTC](https://community.thunkable.com/t/haversine-formulas-or-acos-cos-sinor-sqt-not-functioning-with-sensor-location/2753592/32 "2023-12-27T00:35:43Z")

</div>

I’m thinking through the Google sheet data source.

Couple issues

Everyone who uses the app would be pushing data to the sheet

1. if it was only going to one cell line , would everyone’s data be updating every time a person was using.

2. if inputs were added, how would it know the latest input from a specific user. I had thought about creating unique user ids.

But, upon an input , how can it just update a current input from the user.

Instead of making multiple inputs

Just thoughts

---

<div class="post-metadata">

**Author:** ![cresto.pgaxq2](https://avatars.discourse-cdn.com/v4/letter/c/8edcca/32.png) [@cresto.pgaxq2](https://community.thunkable.com/u/cresto.pgaxq2)\
**Post date:** [December 27, 2023, 12:41am UTC](https://community.thunkable.com/t/haversine-formulas-or-acos-cos-sinor-sqt-not-functioning-with-sensor-location/2753592/33 "2023-12-27T00:41:46Z")

</div>

Google sheet math and return is fairly quick.

I have concerns with it not being local logic

But, trying to make it work

---

<div class="post-metadata">

**Author:** ![manyone](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@manyone](https://community.thunkable.com/u/manyone)\
**Post date:** [December 27, 2023, 2:56am UTC](https://community.thunkable.com/t/haversine-formulas-or-acos-cos-sinor-sqt-not-functioning-with-sensor-location/2753592/34 "2023-12-27T02:56:01Z")

</div>

i’m attaching my google sheet again

> **[haversine.xlsx](https://docs.google.com/spreadsheets/d/1pIQiZrkOpZ_3t5jHg_9V2bG8By1xkdac/edit?usp=sharing&ouid=117253279252568248924&rtpof=true&sd=true)**
>
> demo
> 
> LAT,LONG,https://www.geeksforgeeks.org/haversine-formula-to-find-distance-between-two-points-on-a-sphere/
> 41.507483,-99.436554,https://notunreasonable.com/2011/09/19/latlon-distance-formula-in-excel-haversine-and-spherical-law-of-cosines/
> 38.50...

there is no mention of vincenty - the sheet has always been about haversine.

in demo, i included calculations for a,c d (original haversine formulas) along with C\_reduced (which is the reduction of a,c,d into a single formula) - but demo thunkable program uses only the formula of C\_reduced.  
so there’s no point in recoding formulas for a and c - it’s already reduced to the single formula in c\_reduced. the value of c is the same as the value of c\_reduce.

i haven’t found any vincenty formula that i could transfer to excel form for testing.

i am not the right person to ask about how thunkable can effectively use a single sheet for multi-user. i have no experience in that area.

however i’ve included in the attached , sheet named rowcalc that shows how you can rewrite the formula to one row per user. presumably you provide (valid) value for unit, and the lat and lon values for the 2 points and the distance is automatically compuited.

---

<div class="post-metadata">

**Author:** ![cresto.pgaxq2](https://avatars.discourse-cdn.com/v4/letter/c/8edcca/32.png) [@cresto.pgaxq2](https://community.thunkable.com/u/cresto.pgaxq2)\
**Post date:** [January 15, 2024, 3:28pm UTC](https://community.thunkable.com/t/haversine-formulas-or-acos-cos-sinor-sqt-not-functioning-with-sensor-location/2753592/35 "2024-01-15T15:28:26Z")

</div>

Hey manyone,

So I have toyed around with some other logic. The decimals do go longer than a certain point than we thought. Shown in the red logic. But orange for some reason it is auto rounding even though I dont have a round block in there.

So the ACOS is fine. Seems like a glitch. It is the exact same code for both.

Not sure if someone from Thunkable can research this.

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/5/2/525af5eaed8813071a9ed9a8c5414e56b5287e78.jpeg)

---

<div class="post-metadata">

**Author:** ![cresto.pgaxq2](https://avatars.discourse-cdn.com/v4/letter/c/8edcca/32.png) [@cresto.pgaxq2](https://community.thunkable.com/u/cresto.pgaxq2)\
**Post date:** [January 15, 2024, 3:35pm UTC](https://community.thunkable.com/t/haversine-formulas-or-acos-cos-sinor-sqt-not-functioning-with-sensor-location/2753592/37 "2024-01-15T15:35:07Z")

</div>

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/c/3/c372d03b04a04844f1e41e1bec19c3a6bc45406c.png)

Numbers for red. Not exact but end result is the same.

---

<div class="post-metadata">

**Author:** ![cresto.pgaxq2](https://avatars.discourse-cdn.com/v4/letter/c/8edcca/32.png) [@cresto.pgaxq2](https://community.thunkable.com/u/cresto.pgaxq2)\
**Post date:** [January 15, 2024, 3:38pm UTC](https://community.thunkable.com/t/haversine-formulas-or-acos-cos-sinor-sqt-not-functioning-with-sensor-location/2753592/38 "2024-01-15T15:38:04Z")

</div>

Orange D Long

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/a/3a5cd58e802eb1f4aa1a3c8810720f6e920bdbb0.png)

---

<div class="post-metadata">

**Author:** ![cresto.pgaxq2](https://avatars.discourse-cdn.com/v4/letter/c/8edcca/32.png) [@cresto.pgaxq2](https://community.thunkable.com/u/cresto.pgaxq2)\
**Post date:** [January 15, 2024, 3:39pm UTC](https://community.thunkable.com/t/haversine-formulas-or-acos-cos-sinor-sqt-not-functioning-with-sensor-location/2753592/39 "2024-01-15T15:39:58Z")

</div>

Not sure why on the second it is rounding to .0000200000000 but the other is fine

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [November 8, 2024, 1:33pm UTC](https://community.thunkable.com/t/haversine-formulas-or-acos-cos-sinor-sqt-not-functioning-with-sensor-location/2753592/40 "2024-11-08T13:33:13Z")

</div>



[Previous page](https://community.thunkable.com/t/haversine-formulas-or-acos-cos-sinor-sqt-not-functioning-with-sensor-location/2753592.md?page=1)
