Lines Matching +full:max +full:- +full:functions

27 …hange this value to change the number of decimal places in the final output - 5 is a good default …
30 #define MAX (1 << (SHIFT_AMOUNT - 1)) - 1 /* 32767 - Might change in the future */ macro
32 /* -------------------------------------------------------------------------------
33 * NEW TYPE - fINT
34 * -------------------------------------------------------------------------------
45 int real: 32 - SHIFT_AMOUNT;
49 /* -------------------------------------------------------------------------------
51 * -------------------------------------------------------------------------------
58 static fInt fNegate(fInt); /* Returns -1 * input fInt value */
60 static fInt fSubtract (fInt A, fInt B); /* Returns A-B - Sometimes easier than Ad…
76 /* Fuse decoding functions
77 * -------------------------------------------------------------------------------------
83 /* Internal Support Functions - Use these ONLY for testing or adding to internal functions
84 * -------------------------------------------------------------------------------------
85 …* Some of the following functions take two INTs as their input - This is unsafe for a variety of r…
93 /* -------------------------------------------------------------------------------------
95 * -------------------------------------------------------------------------------------
96 …* 1) ConvertToFraction - InputOutOfRangeException: Only accepts numbers smaller than MAX (default:…
97 * 2) fAdd - OutputOutOfRangeException: Output bigger than MAX (default: 32767)
98 * 3) fMultiply - OutputOutOfRangeException:
99 * 4) fGetSquare - OutputOutOfRangeException:
100 * 5) fDivide - DivideByZeroException
101 * 6) fSqrt - NegativeSquareRootException: Input cannot be a negative number
104 /* -------------------------------------------------------------------------------------
106 * -------------------------------------------------------------------------------------
151 fInt fNegativeOne = ConvertToFraction(-1); in fNaturalLog()
175 fInt f_bit_max_value = Convert_ULONG_ToFraction((uPow(2, bitlength)) - 1); in fDecodeLinearFuse()
190 fInt f_bit_max_value = Convert_ULONG_ToFraction((uPow(2, bitlength)) - 1); in fDecodeLogisticFuse()
192 fInt f_CONSTANT_NEG13 = ConvertToFraction(-13); in fDecodeLogisticFuse()
208 fInt f_bit_max_value = Convert_ULONG_ToFraction((uPow(2, bitlength)) - 1); in fDecodeLeakageID()
222 if (X <= MAX) in ConvertToFraction()
232 fInt CONSTANT_NEGONE = ConvertToFraction(-1); in fNegate()
240 if (X <= MAX) in Convert_ULONG_ToFraction()
259 X = -1*X; in GetScaledFraction()
264 factor = -1*factor; in GetScaledFraction()
268 if ((X > MAX) || factor > MAX) { in GetScaledFraction()
269 if ((X/factor) <= MAX) { in GetScaledFraction()
270 while (X > MAX) { in GetScaledFraction()
275 while (factor > MAX) { in GetScaledFraction()
288 fValue = fDivide(ConvertToFraction(X * uPow(-1, bNEGATED)), ConvertToFraction(factor)); in GetScaledFraction()
311 Difference.full = X.full - Y.full; in fSubtract()
332 static fInt fMultiply (fInt X, fInt Y) /* Uses 64-bit integers (int64_t) */ in fMultiply()
337 /*The following is for a very specific common case: Non-zero number with ONLY fractional portion*/ in fMultiply()
338 /* TEMPORARILY DISABLED - CAN BE USED TO IMPROVE PRECISION in fMultiply()
349 …tempProduct = ((int64_t)X.full) * ((int64_t)Y.full); /*Q(16,16)*Q(16,16) = Q(32, 32) - Might becom… in fMultiply()
350 …tempProduct = tempProduct >> 16; /*Remove lagging 16 bits - Will lose some precision from decimal;… in fMultiply()
369 longlongX = longlongX << 16; /*Q(16,16) -> Q(32,32) */ in fDivide()
381 scaledReal.full = GetReal(A) * uPow(10, PRECISION-1); /* DOUBLE CHECK THISSSS!!! */ in ConvertBackToInteger()
395 /* x_new = x_old - (x_old^2 - C) / (2 * x_old) */
436 y = fSubtract(test, C); /*y = f(x) = x^2 - C; */ in fSqrt()
443 error = ConvertBackToInteger(x_new) - ConvertBackToInteger(x_old); in fSqrt()
470 temp = fSubtract(fGetSquare(B), temp); /* root = b^2 - 4AC */ in SolveQuadracticEqn()
471 temp = fSqrt(temp); /*root = Sqrt (b^2 - 4AC); */ in SolveQuadracticEqn()
473 root_first = fSubtract(fNegate(B), temp); /* b - Sqrt(b^2 - 4AC) */ in SolveQuadracticEqn()
474 root_second = fAdd(fNegate(B), temp); /* b + Sqrt(b^2 - 4AC) */ in SolveQuadracticEqn()
476 root_first = fDivide(root_first, ConvertToFraction(2)); /* [b +- Sqrt(b^2 - 4AC)]/[2] */ in SolveQuadracticEqn()
477 root_first = fDivide(root_first, A); /*[b +- Sqrt(b^2 - 4AC)]/[2*A] */ in SolveQuadracticEqn()
479 root_second = fDivide(root_second, ConvertToFraction(2)); /* [b +- Sqrt(b^2 - 4AC)]/[2] */ in SolveQuadracticEqn()
480 root_second = fDivide(root_second, A); /*[b +- Sqrt(b^2 - 4AC)]/[2*A] */ in SolveQuadracticEqn()
486 /* -----------------------------------------------------------------------------
487 * SUPPORT FUNCTIONS
488 * -----------------------------------------------------------------------------
491 /* Conversion Functions */
509 static int uGetScaledDecimal (fInt A) /*Converts the fractional portion to whole integers - Costly … in uGetScaledDecimal()
516 tmp = tmp - ((1 << SHIFT_AMOUNT)*dec[i]); in uGetScaledDecimal()
518 scaledDecimal = scaledDecimal + dec[i]*uPow(10, PRECISION - 1 - i); in uGetScaledDecimal()
529 return (base)*uPow(base, power - 1); in uPow()
535 return (X * -1); in uAbs()