Unit RRMath |
*********************************************************************** Author: Robert Rossmair Wagelwitz, Rodaer Str. 6 04688 Mutzschen Germany e-mail: Robert.Rossmair@t-online.de Module: RRMath Version: 02-OCT-1997 Description: 32-bit (not at all!) math routines Copyright (C) 1997 Robert Rossmair This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program (file COPYING); if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Classes |
Functions |
Average - uses ExpData; (*
const
{ atanRadix[k] := Round($2000000 * (1 shl k) * ArcTan(1/(1 shl k))); }
atanRadix: array[0.
BitCount -
ClipInteger - binaere Quersumme
ConvCartesian -
ConvPolar -
DivComplex -
exp2 -
Factorial - 2^X
function exp2scale(P: byte; X: Smallint): Integer; assembler;
{ computes 2^(2^P * X/32768) * 32768 }
asm
push ebx
movzx ebx, X
mov al, bh
mov cl, 7
sub cl, P
sar al, cl
sub cl, 3
shr bx, cl
mov cl, al
and bx, 2047
shl bx, 1
mov ax, WORD PTR ExpTable[ebx]
dec cl
js @2
mov dx, 1 { MSBit substituieren }
mov ch, 0
jcxz @exit
@1: shl ax, 1
rcl dx, 1
loop @1
jmp @exit
@2: not cl
stc
rcr ax, 1
shr ax, cl
adc ax, 0 { Runden }
mov dx, 0
@exit: pop ebx
end;
FPU_RoundMethod - X!
berechnet X!
I0 - clear pending exceptions
IMax -
IMin -
IMulDiv - Round(Min(Max(X, LongMin), LongMax)
Interpolate - berechnet modifizierte Besselfunktion 1.
Interpolate_F -
Long - ========================================
aus c't 2/92, berechnet Normalverteilung
========================================
Max -
MaxD -
MaxS - Interpolate_F := y1 + (y2 - y1) * (x - x1) / (x2 - x1);
Min -
MinD -
MinS -
MulComplex -
NextMultipleTo -
NormDistribution - idiv Y
Sign - Die Matisse von single ist bloss 23 bit lang, so dass
Werte >= $7FFFFFC0 auf $80000000 gerundet werden.
SqrFixed -
tan - Result in edx:eax
UMax -
UMin -
UMulDiv -
Types |
Coordinates
IntFraction
NaturalNumber
PComplex
PComplexArray
PComplexL
PComplexLArray
PFixed
PFixedArray
T3DVector
TComplex
TComplexArray
TComplexL
TComplexLArray
TFixedArray
WordFraction
Constants |
divSqrt2Pi
exDenorm
exErrorSum
exInvOp
exOverflow
exPrecision
exStackFault
exUnderflow
exZeroDiv
ld_10
ld_e
lg_2
ln_2
M_1_PI
M_1_SQRTPI
M_2_PI
M_2_SQRTPI
M_E
M_LN10
M_LN2
M_LOG10E
M_LOG2E
M_PI
M_PI_2
M_PI_4
M_SQRT2
M_SQRT_2
prDouble
prExtended
prSingle
rcChop
rcDown
rcNearOrEven
rcUp
RC_Mask
stBusy
stC0
stC1
stC2
stC3
stTOP
TwoExp31
TwoExp32
Variables |
Functions |
function exp2scale(P: byte; X: Smallint): Integer; assembler; { computes 2^(2^P * X/32768) * 32768 } asm push ebx movzx ebx, X mov al, bh mov cl, 7 sub cl, P sar al, cl sub cl, 3 shr bx, cl mov cl, al and bx, 2047 shl bx, 1 mov ax, WORD PTR ExpTable[ebx] dec cl js @2 mov dx, 1 { MSBit substituieren } mov ch, 0 jcxz @exit @1: shl ax, 1 rcl dx, 1 loop @1 jmp @exit @2: not cl stc rcr ax, 1 shr ax, cl adc ax, 0 { Runden } mov dx, 0 @exit: pop ebx end;
berechnet modifizierte Besselfunktion 1. Gattung, 0. Ordnung. Quelle: Oppenheim / Schafer: Zeitdiskrete Signalverarbeitung, 7.4.3 (S. 519), Oldenburg 1992
Types |
Coordinates = (Cartesian, Polar);Nenner
IntFraction = recordBruch
Numerator : Smallint;
Denominator : Smallint;
end;
NaturalNumber = 1..High(Integer)
PComplex = ^TComplex
PComplexArray = ^TComplexArray
PComplexL = ^TComplexL
PComplexLArray = ^TComplexLArray
PFixed = ^TFixed
PFixedArray = ^TFixedArray
T3DVector = array[0..2] of Double;
TComplex = record
end;
TComplexArray = array[Word] of TComplex;
TComplexL = record
end;
TComplexLArray = array[Word] of TComplexL;
TFixedArray = array[Word] of TFixed;
WordFraction = recordNenner
Numerator : word;
Denominator : word;
end;
Constants |
Variables |