I wrote a function which performs "common rounding" on an extended precision value:
Do you see any obvious optimization potential (apart from writing this code in assembly language)?
Thank you for any suggestions!
Heinz Salomon
Code:
FUNCTION RoundCommon##(rdVal##, BYVAL rlDec&) LOCAL lShift&, lSign&, qCalc&& lShift& = CHOOSE&(rlDec&, 100, 1000, 10000, 100000, 1000000) lSign& = SGN(rdVal##) qCalc&& = CQUD(FIX(rdVal## * lShift&)) qCalc&& = ABS(qCalc&&) qCalc&& = qCalc&& + 5 qCalc&& = qCalc&& * lSign& qCalc&& = qCalc&& \ 10 lShift& = CHOOSE&(rlDec&, 10, 100, 1000, 10000, 100000) FUNCTION = CEXT(qCalc&& / lShift&) END FUNCTION
Thank you for any suggestions!
Heinz Salomon
Comment