# Maths function help

I've created an app that uses the maths function (i'm a first time user). The two functions i've created are to convert from x to y and then the reverse of y to x.

function xtoy(x:real;center:tpoint;rad:real):real;

var
answer:real;

begin;
answer:=x;
answer:=centerpoint.y-answer;
answer:=answer/(rad*0.5);
answer:=math.Power(2.718281828459045,answer);
answer:=math.ArcSin( (answer-1)/(answer+1) );
answer:=answer*180/3.141592654;

result:=answer;
end;

function ytox(y:double;center:tpoint;rad:double):double;

var
answer:double;
checkout:integer;
min,diff:real;

begin;
answer:=y;

answer:=answer*((22/7)/180);

answer:=math.LogN(2.718281828459045,(1+Sin(answer))/ (1-sin(answer)));
answer:=answer*0.5*rad;
answer:=centerpoint.y-answer;

result:=answer;
end;

These functions are the reverse of each other and technically, if you were to use them in xty(ytox(10,1,1),1,1) should return the answer 10 but when centerpoint and rad become larger in value, there is an increasing differnece between what i should get and what i do. ie ytox(10,100000,100000)=4 and xtoy(4,100000,100000)=21? Obviously they are approximately opposite but deviate at large values but i've looked at this 100 times and i can't see the error. If anything jumps out as obviously wrong, could you please drop me a message.

Thanks in advance
Clinton
Sign In or Register to comment.

#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!