[Lazarus] help in maths

Terry A. Haimann terry at HaimannOnline.com
Sat May 30 00:29:51 CEST 2009


Terry A. Haimann wrote:
> Héctor Fiandor Rosario wrote:
>> Dear Mr. Coppola:
>>
>> really I solve using this:
>>
>> var valor1,valor2,valor3:integer;
>>
>> valor3:=round(power(valor1,valor2));
>>
>> and declaring the unit "math" in uses.
>>
>> Thanks very much
>>
>> Ing. Héctor F. Fiandor
>> hfiandor at infomed.sld.cu
>>
>>
>> ---------------------------------------
>>    Red Telematica de Salud - Cuba
>>          CNICM - Infomed
>>
>> _______________________________________________
>> Lazarus mailing list
>> Lazarus at lists.lazarus.freepascal.org
>> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>>
> That is fine if raising to an integer power, but if not:
>
> Result := exp((ln(x) * y);
>
> Will give you the correct value for non integer powers.  Ok, there is 
> a small error which is insignificant for all practical purposes.
>
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>
I guess I am wrong, both ways can raise to a non integer power.




More information about the Lazarus mailing list