# Finding the antilogarithm with Delphi

[ Delphi Forum ]

Posted by Lionel Joyner *DClub* on February 19, 2004

I have looked everywhere for a algorithm which would show me how to handle common logarithms. I am currently using the (Log10(X)) math components to greate a Common Log and the (Power(10,X) to inverse or solve for the antilog. Both of these functions work very well but Logarithms are made up with two parts, an integer and a decimal fraction with the integral part being called the characteristic and it can be positive or negative, and the second part is called the mantissa and is always positive.

The problem is that when I use the (Log10(X)) the results is the mantissa and when I inverse using (Power(10,X)) I get the mantissa.

How does one handle the +/- charactrtistic in this perplexing situation so they get the real number?

This is the test code I am working with.

```procedure TForm1.Button1Click(Sender: TObject);
VAR
N1,
C1,
M1,
Ans : Variant;
begin
//-------------------
//    Input Variables
N1:=Edit1.Text;
C1:=Edit2.Text;
M1:=Edit3.Text;
//--------------------
//    Compute
Ans:=FloatToStr(Log10(M1));
//---------------------
Edit4.Text:=FloatToStrF(Ans,ffFixed,10,10);
Edit5.Text:=FloatToStr(C1);
end;```
```procedure TForm1.Button5Click(Sender: TObject);
Var
M1,
C1,
R,
L,
X,
Ans : Variant;
begin
//---------------------
//        Input
//C1:=Edit6.Text;
L:=Edit7.Text;```
```  //-----------------------
//        Compute
X:=(L);
Ans:=Power(10,X);```
```  //-------------------------
//        Display Results
Edit9.Text:=FloatToStrF(Ans,ffFixed,10,10);
//Edit8.Text:=FloatToStr(x);```
``` end;

```

Forgive the sloppy code but is only sent to give you an idea of what I am trying to do.

[ Delphi Forum ] [ Post Followup ]