Thanks Sir.

Please maybe I am not clear,

The formula I am using impose the use of RAD as input. This is the contrary when I use sin, cos or tan in Thunkable. The functions return the value in degree as it is stated in the help pannel.

But, I have used the calculator, inputting the value (using RAD mode) and get the accurate solution. When I conceive the algorithm in Thunkable, the result is false (and it is the same if I put the calculator in DEG mode). Thatâs where my problem is.

This are prooves :

This is the java code used in Thunkable

// developed by Brenor Brophy - comments removed to save space

define (âmeter2nmâ, (1/1852));

define (ânm2meterâ, 1852);

class gPoint

{

var $ellipsoid = array(//Ellipsoid name, Equatorial Radius, square of eccentricity

âAiryâ =>array (6377563, 0.00667054),

âAustralian Nationalâ =>array (6378160, 0.006694542),

âBessel 1841â =>array (6377397, 0.006674372),

âBessel 1841 Nambiaâ =>array (6377484, 0.006674372),

âClarke 1866â =>array (6378206, 0.006768658),

âClarke 1880â =>array (6378249, 0.006803511),

âEverestâ =>array (6377276, 0.006637847),

âFischer 1960 Mercuryâ =>array (6378166, 0.006693422),

âFischer 1968â =>array (6378150, 0.006693422),

âGRS 1967â =>array (6378160, 0.006694605),

âGRS 1980â =>array (6378137, 0.00669438),

âHelmert 1906â =>array (6378200, 0.006693422),

âHoughâ =>array (6378270, 0.00672267),

âInternationalâ =>array (6378388, 0.00672267),

âKrassovskyâ =>array (6378245, 0.006693422),

âModified Airyâ =>array (6377340, 0.00667054),

âModified Everestâ =>array (6377304, 0.006637847),

âModified Fischer 1960â =>array (6378155, 0.006693422),

âSouth American 1969â =>array (6378160, 0.006694542),

âWGS 60â =>array (6378165, 0.006693422),

âWGS 66â =>array (6378145, 0.006694542),

âWGS 72â =>array (6378135, 0.006694318),

âWGS 84â =>array (6378137, 0.00669438));

```
var $a; // Equatorial Radius
var $e2; // Square of eccentricity
var $datum; // Selected datum
var $Xp, $Yp; // X,Y pixel location
var $lat, $long; // Latitude & Longitude of the point
var $utmNorthing, $utmEasting, $utmZone; // UTM Coordinates of the point
var $lccNorthing, $lccEasting; // Lambert coordinates of the point
var $falseNorthing, $falseEasting; // Origin coordinates for Lambert Projection
var $latOfOrigin; // For Lambert Projection
var $longOfOrigin; // For Lambert Projection
var $firstStdParallel; // For lambert Projection
var $secondStdParallel; // For lambert Projection
function gPoint($datum='WGS 84') // Default datum is WGS 84
{
$this->a = $this->ellipsoid[$datum][0]; // Set datum Equatorial Radius
$this->e2 = $this->ellipsoid[$datum][1]; // Set datum Square of eccentricity
$this->datum = $datum; // Save the datum
}
function setXY($x, $y)
{
$this->Xp = $x; $this->Yp = $y;
}
function Xp() { return $this->Xp; }
function Yp() { return $this->Yp; }
function setLongLat($long, $lat)
{
$this->long = $long; $this->lat = $lat;
}
function Lat() { return $this->lat; }
function Long() { return $this->long; }
function printLatLong() { printf("Latitude: %1.5f Longitude: %1.5f",$this->lat, $this->long); }
function setUTM($easting, $northing, $zone='') // Zone is optional
{
$this->utmNorthing = $northing;
$this->utmEasting = $easting;
$this->utmZone = $zone;
}
function N() { return $this->utmNorthing; }
function E() { return $this->utmEasting; }
function Z() { return $this->utmZone; }
function printUTM() { print( "Northing: ".(int)$this->utmNorthing.", Easting: ".(int)$this->utmEasting.", Zone: ".$this->utmZone); }
function setLambert($easting, $northing)
{
$this->lccNorthing = $northing;
$this->lccEasting = $easting;
}
function lccN() { return $this->lccNorthing; }
function lccE() { return $this->lccEasting; }
function printLambert() { print( "Northing: ".(int)$this->lccNorthing.", Easting: ".(int)$this->lccEasting); }
function convertLLtoTM($LongOrigin = NULL)
{
$k0 = 0.9996;
$falseEasting = 0.0;
//Make sure the longitude is between -180.00 .. 179.9
$LongTemp = ($this->long+180)-(integer)(($this->long+180)/360)*360-180; // -180.00 .. 179.9;
$LatRad = deg2rad($this->lat);
$LongRad = deg2rad($LongTemp);
if (!$LongOrigin)
{ // Do a standard UTM conversion - so findout what zone the point is in
$ZoneNumber = (integer)(($LongTemp + 180)/6) + 1;
// Special zone for South Norway
if( $this->lat >= 56.0 && $this->lat < 64.0 && $LongTemp >= 3.0 && $LongTemp < 12.0 ) // Fixed 1.1
$ZoneNumber = 32;
// Special zones for Svalbard
if( $this->lat >= 72.0 && $this->lat < 84.0 )
{
if( $LongTemp >= 0.0 && $LongTemp < 9.0 ) $ZoneNumber = 31;
else if( $LongTemp >= 9.0 && $LongTemp < 21.0 ) $ZoneNumber = 33;
else if( $LongTemp >= 21.0 && $LongTemp < 33.0 ) $ZoneNumber = 35;
else if( $LongTemp >= 33.0 && $LongTemp < 42.0 ) $ZoneNumber = 37;
}
$LongOrigin = ($ZoneNumber - 1)*6 - 180 + 3; //+3 puts origin in middle of zone
//compute the UTM Zone from the latitude and longitude
$this->utmZone = sprintf("%d%s", $ZoneNumber, $this->UTMLetterDesignator());
// We also need to set the false Easting value adjust the UTM easting coordinate
$falseEasting = 500000.0
;
}
$LongOriginRad = deg2rad($LongOrigin);
$eccPrimeSquared = ($this->e2)/(1-$this->e2);
$N = $this->a/sqrt(1-$this->e2*sin($LatRad)*sin($LatRad));
$T = tan($LatRad)*tan($LatRad);
$C = $eccPrimeSquared*cos($LatRad)*cos($LatRad);
$A = cos($LatRad)*($LongRad-$LongOriginRad);
$M = $this->a*((1 - $this->e2/4-3*$this->e2*$this->e2/64-5*$this->e2*$this->e2*$this->e2/256)*$LatRad
- (3*$this->e2/8+3*$this->e2*$this->e2/32+45*$this->e2*$this->e2*$this->e2/1024)*sin(2*$LatRad)
+ (15*$this->e2*$this->e2/256 + 45*$this->e2*$this->e2*$this->e2/1024)*sin(4*$LatRad)
- (35*$this->e2*$this->e2*$this->e2/3072)*sin(6*$LatRad));
$this->utmEasting = ($k0*$N*($A+(1-$T+$C)*$A*$A*$A/6
+ (5-18*$T+$T*$T+72*$C-58*$eccPrimeSquared)*$A*$A*$A*$A*$A/120)
+ $falseEasting);
$this->utmNorthing = ($k0*($M+$N*tan($LatRad)*($A*$A/2+(5-$T+9*$C+4*$C*$C)*$A*$A*$A*$A/24
+ (61-58*$T+$T*$T+600*$C-330*$eccPrimeSquared)*$A*$A*$A*$A*$A*$A/720)));
if($this->lat < 0)
$this->utmNorthing += 10000000.0; //10000000 meter offset for southern hemisphere
}
```