unit gmpextras; {$mode objfpc}{$H+} interface uses Classes, SysUtils, gmp; function mpfToStr(f: mpf_t): string; function mpfMyRoot(rad: mpf_t; wzlExp: int64): extended; implementation uses math; // allgemeine Funktionen ******************************************************* function mpfToStr(f: mpf_t): string; var ex: mp_exp_t; off: byte; begin result:=mpf_get_str(nil,ex,10,0,f); off:=1+byte(pos('-',result)=1); if result='' then result:='0' else if ex=1 then result:=copy(result,1,off)+','+copy(result,off+1,length(result)-off) else result:=copy(result,1,off)+','+copy(result,off+1,length(result)-off)+' * 10^'+intToStr(ex-1); end; function mpfMyRoot(rad: mpf_t; wzlExp: int64): extended; var ex: mp_exp_t; begin result:=power(mpf_get_d_2exp(ex,rad),1/wzlExp); result:=result*power(2,ex/wzlExp); end; end.