The problem with those values is the lon2 seems to be messing it up.
If I reduce that value then it works, so it is somehow throwing it out of range?
I am not good with the cos and sin formulas..
Sorry I couldn't help.
I used whole numbers on the lon's and lat's and reduced the length of the rad's digits and got better results
So maybe the length of those is what is throwing it our of range... not sure why if the lengths are fixed for floats, but it did not give the "-nan(ind)" result
Tried it again with the full length rad using whole numbers for long and lat and didn't get the " -nan(ind)"
I tried once again leaving the full length of all numbers, but removed the decimal thus making the longs and lats huge and it still did not give the "-nan(ind)" result
So, you may want to use whole numbers to keep this in range of the math capabilities then place those decimals yourself afterwards
Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1