Thema: Delphi W.Erhardt aMath

Einzelnen Beitrag anzeigen

Rollo62

Registriert seit: 15. Mär 2007
3.908 Beiträge
 
Delphi 12 Athens
 
#3

AW: W.Erhardt aMath

  Alt 18. Apr 2019, 12:13
Wie man die nutzt, ich denke 1:1, wie DeddyH schon geschrieben hat.

Zitat:
{---------------------------------------------------------------------------}
function exp(x: extended): extended; assembler; {&Frame-} {&Uses none}
{-Accurate exp, result good to extended precision}
asm
{This version of Norbert Juffa's exp is from the VirtualPascal RTL source,}
{discussed and explained in the VP Bugtracker system. Quote: }
{ }
{ ... "since the 387, F2XM1 can accecpt arguments in [-1, 1]. }
{ }
{ So, we can split the argument into an integer and a fraction part using }
{ FRNDINT and the fraction part will always be -1 <= f <= 1 no matter what}
{ rounding control. This means we don't have to load/restore the FPU }
{ control word (CW) which is slow on modern OOO FPUs (since FLDCW is a }
{ serializing instruction). }
{ }
{ Note that precision is lost in doing exponentation when the fraction is }
{ subtracted from the integer part of the argument. The "naive" code can }
{ loose up to 11 (or 15) bits of the extended precision format for large }
{ DP or EP arguments, yielding a result good to double precision. To get a}
{ function accurate to full extended precision, we need to simulate higher}
{ precision intermediate arithmetic." }
{ Ref: [Virtual Pascal 0000056]: More accurate Exp() function. URL (Oct.2009):}
{ https://admin.topica.com/lists/virtualpascal@topica.com/read/message.html?sort=a&mid=908867704&start=7}
Die exp() Funktion in Delphi und AMath machen beide stark von Assembler Gebrauch,
ist nicht so mein Spezialgebiet, dehalb würde ich dem Wolfgang Erhardt da blind vertrauen.
Der kannte jedes seiner Bits einzeln.

Allerdings gebe ich zu Bedenken das sein Code nur für Windows kompatibel war,
also müsste man bei iOS/Android/Linux nach Alternativen suchen, oder mit Delphi-Code leben.
  Mit Zitat antworten Zitat