1 module etc.d.sapdecf; 2 3 import etc.c.sapucx; 4 5 extern(C): 6 @nogc: 7 8 enum DECF_RETURN 9 { 10 DECF_NOT_SUPPORTED = -2, 11 DECF_WRONG_VERSION = -1, 12 DECF_OK = 0, 13 DECF_INEXACT = 1, 14 DECF_UNDERFLOW = 2, 15 DECF_OVERFLOW = 3, 16 DECF_CONV_SYNTAX = 4, 17 DECF_DIV_ZERO = 5, 18 DECF_INVALID_OP = 6, 19 DECF_NO_MEMORY = 7, 20 } 21 22 enum DecFRounding 23 { 24 DECF_ROUND_CEILING = 0, 25 DECF_ROUND_UP = 1, 26 DECF_ROUND_HALF_UP = 2, 27 DECF_ROUND_HALF_EVEN = 3, 28 DECF_ROUND_HALF_DOWN = 4, 29 DECF_ROUND_DOWN = 5, 30 DECF_ROUND_FLOOR = 6, 31 DECF_ROUND_MAX = 7, 32 } 33 34 version(LittleEndian) 35 { 36 // immutable DecFloat16 DecFloat16NegInf = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8 }; 37 // immutable DecFloat34 DecFloat34NegInf = { 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0xf8 }; 38 } 39 else 40 { 41 // immutable DecFloat16 DecFloat16NegInf = { 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; 42 // immutable DecFloat34 DecFloat34NegInf = { 0xf8, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; 43 } 44 45 void decf_mutex_lock(); 46 void decf_mutex_unlock(); 47 DECF_RETURN InitDecFloatLib(); 48 DECF_RETURN DecFloat16ToString(DecFloat16, DecFloat16Buff*); 49 DECF_RETURN DecFloat34ToString(DecFloat34, DecFloat34Buff*); 50 DECF_RETURN StringToDecFloat16(const(SAP_UC)*, DecFloat16*); 51 DECF_RETURN StringToDecFloat34(const(SAP_UC)*, DecFloat34*); 52 DECF_RETURN DecFloat16ToDecFloat34(DecFloat34*, DecFloat16); 53 DECF_RETURN DecFloat34ToDecFloat16(DecFloat16*, DecFloat34); 54 DECF_RETURN DecFloat16ToDecFloat16Raw(DecFloat16Raw*, SAP_SHORT*, DecFloat16); 55 DECF_RETURN DecFloat16RawToDecFloat16(DecFloat16*, DecFloat16Raw, SAP_SHORT); 56 DECF_RETURN DecFloat34ToDecFloat34Raw(DecFloat34Raw*, SAP_SHORT*, DecFloat34); 57 DECF_RETURN DecFloat34RawToDecFloat34(DecFloat34*, DecFloat34Raw, SAP_SHORT); 58 DECF_RETURN DecFloat16ToDecFloat16RawDB(DecFloat16Raw*, SAP_SHORT*, DecFloat16); 59 DECF_RETURN DecFloat16RawToDecFloat16DB(DecFloat16*, DecFloat16Raw, SAP_SHORT); 60 DECF_RETURN DecFloat34ToDecFloat34RawDB(DecFloat34Raw*, SAP_SHORT*, DecFloat34); 61 DECF_RETURN DecFloat34RawToDecFloat34DB(DecFloat34*, DecFloat34Raw dfp34raw, SAP_SHORT); 62 DECF_RETURN NormDecFloat16ToDecFloat16Raw(DecFloat16Raw* dfp16raw_res, DecFloat16); 63 DECF_RETURN DecFloat16RawToNormDecFloat16(DecFloat16*, DecFloat16Raw); 64 DECF_RETURN NormDecFloat34ToDecFloat34Raw(DecFloat34Raw* dfp34raw_res, DecFloat34); 65 DECF_RETURN DecFloat34RawToNormDecFloat34(DecFloat34*, DecFloat34Raw dfp34raw); 66 DECF_RETURN DecFloat16ToSAP_INT(SAP_INT*, DecFloat16); 67 DECF_RETURN SAP_INTToDecFloat16(DecFloat16*, SAP_INT); 68 DECF_RETURN DecFloat34ToSAP_INT(SAP_INT*, DecFloat34); 69 DECF_RETURN SAP_INTToDecFloat34(DecFloat34*, SAP_INT); 70 DECF_RETURN DecFloat16ToSAP_DOUBLE(SAP_DOUBLE*, DecFloat16); 71 DECF_RETURN SAP_DOUBLEToDecFloat16(DecFloat16*, SAP_DOUBLE); 72 DECF_RETURN DecFloat34ToSAP_DOUBLE(SAP_DOUBLE*, DecFloat34); 73 DECF_RETURN SAP_DOUBLEToDecFloat34(DecFloat34*, SAP_DOUBLE); 74 DECF_RETURN DecFloat16ToBCD(SAP_RAW*, DecFloat16, intR, intR); 75 DECF_RETURN DecFloat16RoundForDEC(DecFloat16*, intR, intR); 76 SAP_INT DecFloat16CompareForDEC(DecFloat16, DecFloat16, intR, DECF_RETURN*); 77 DECF_RETURN BCDToDecFloat16(DecFloat16*, SAP_RAW*, intR, intR); 78 DECF_RETURN DecFloat34ToBCD(SAP_RAW*, DecFloat34, intR, intR); 79 DECF_RETURN DecFloat34RoundForDEC(DecFloat34*, intR, intR); 80 SAP_INT DecFloat34CompareForDEC(DecFloat34, DecFloat34, intR, DECF_RETURN*); 81 DECF_RETURN BCDToDecFloat34(DecFloat34*, SAP_RAW*, intR, intR); 82 DECF_RETURN DecFloat16_Add(DecFloat16*, DecFloat16, DecFloat16); 83 DECF_RETURN DecFloat34_Add(DecFloat34*, DecFloat34, DecFloat34); 84 DECF_RETURN DecFloat16_Sub(DecFloat16*, DecFloat16, DecFloat16); 85 DECF_RETURN DecFloat34_Sub(DecFloat34*, DecFloat34, DecFloat34); 86 DECF_RETURN DecFloat16_Mult(DecFloat16*, DecFloat16, DecFloat16); 87 DECF_RETURN DecFloat34_Mult(DecFloat34*, DecFloat34, DecFloat34); 88 DECF_RETURN DecFloat16_Div(DecFloat16*, DecFloat16, DecFloat16); 89 DECF_RETURN DecFloat34_Div(DecFloat34*, DecFloat34, DecFloat34); 90 DECF_RETURN DecFloat16_DIV(DecFloat16*, DecFloat16, DecFloat16); 91 DECF_RETURN DecFloat34_DIV(DecFloat34*, DecFloat34, DecFloat34); 92 DECF_RETURN DecFloat16_MOD(DecFloat16*, DecFloat16, DecFloat16); 93 DECF_RETURN DecFloat34_MOD(DecFloat34*, DecFloat34, DecFloat34); 94 SAP_BOOL DecFloat16_EQ(DecFloat16, DecFloat16, DECF_RETURN*); 95 SAP_BOOL DecFloat34_EQ(DecFloat34, DecFloat34, DECF_RETURN*); 96 SAP_BOOL DecFloat16_GT(DecFloat16, DecFloat16, DECF_RETURN*); 97 SAP_BOOL DecFloat34_GT(DecFloat34, DecFloat34, DECF_RETURN*); 98 SAP_BOOL DecFloat16_LT(DecFloat16, DecFloat16, DECF_RETURN*); 99 SAP_BOOL DecFloat34_LT(DecFloat34, DecFloat34, DECF_RETURN*); 100 SAP_INT DecFloat16Compare(DecFloat16, DecFloat16, DECF_RETURN*); 101 SAP_INT DecFloat34Compare(DecFloat34, DecFloat34, DECF_RETURN*); 102 DECF_RETURN DecFloat16RoundDec(DecFloat16*, SAP_INT, DecFRounding); 103 DECF_RETURN DecFloat16RoundPrec(DecFloat16*, SAP_INT, DecFRounding); 104 DECF_RETURN DecFloat34RoundDec(DecFloat34*, SAP_INT, DecFRounding); 105 DECF_RETURN DecFloat34RoundPrec(DecFloat34*, SAP_INT, DecFRounding); 106 DECF_RETURN DecFloat16RescaleDec(DecFloat16*, SAP_INT, DecFRounding); 107 DECF_RETURN DecFloat16RescalePrec(DecFloat16*, SAP_INT, DecFRounding); 108 DECF_RETURN DecFloat34RescaleDec(DecFloat34*, SAP_INT, DecFRounding); 109 DECF_RETURN DecFloat34RescalePrec(DecFloat34*, SAP_INT, DecFRounding); 110 SAP_BOOL DecFloat16IsInfinite(DecFloat16); 111 SAP_BOOL DecFloat34IsInfinite(DecFloat34); 112 SAP_BOOL DecFloat16IsFinite(DecFloat16); 113 SAP_BOOL DecFloat34IsFinite(DecFloat34); 114 SAP_BOOL DecFloat16IsNaN(DecFloat16); 115 SAP_BOOL DecFloat34IsNaN(DecFloat34); 116 DecFloat16* DecFloat16Zero(DecFloat16*); 117 DecFloat34* DecFloat34Zero(DecFloat34*); 118 DecFloat16 DecFloat16Ceil(DecFloat16, DECF_RETURN*); 119 DecFloat34 DecFloat34Ceil(DecFloat34, DECF_RETURN*); 120 DecFloat16 DecFloat16Floor(DecFloat16, DECF_RETURN*); 121 DecFloat34 DecFloat34Floor(DecFloat34, DECF_RETURN*); 122 DecFloat16 GetMinDecFloat16(); 123 DecFloat34 GetMinDecFloat34(); 124 DECF_RETURN DecFloat16GetExponent(SAP_INT*, DecFloat16); 125 DECF_RETURN DecFloat34GetExponent(SAP_INT*, DecFloat34); 126 DECF_RETURN DecFloat16GetNumOfDigits(SAP_INT*, DecFloat16); 127 DECF_RETURN DecFloat34GetNumOfDigits(SAP_INT*, DecFloat34); 128 DECF_RETURN DecFloat16ToDecFloat16Neutral(DecFloat16*, DecFloat16); 129 DECF_RETURN DecFloat16NeutralToDecFloat16(DecFloat16*, DecFloat16); 130 DECF_RETURN DecFloat34ToDecFloat34Neutral(DecFloat34*, DecFloat34); 131 DECF_RETURN DecFloat34NeutralToDecFloat34(DecFloat34*, DecFloat34); 132 DECF_RETURN DecFloat16Normalize(DecFloat16*); 133 DECF_RETURN DecFloat34Normalize(DecFloat34*); 134 DECF_RETURN DecFloat16ToNormDecFloat16(DecFloat16*, DecFloat16); 135 DECF_RETURN DecFloat34ToNormDecFloat34(DecFloat34*, DecFloat34); 136 DECF_RETURN DecFloat16_Pow(DecFloat16*, DecFloat16, SAP_INT); 137 DECF_RETURN DecFloat34_Pow(DecFloat34*, DecFloat34, SAP_INT); 138 DECF_RETURN DecFloat16_fPow(DecFloat16*, DecFloat16, DecFloat16); 139 DECF_RETURN DecFloat34_fPow(DecFloat34*, DecFloat34, DecFloat34); 140 DECF_RETURN DecFloat16_Sqrt(DecFloat16*, DecFloat16); 141 DECF_RETURN DecFloat34_Sqrt(DecFloat34*, DecFloat34); 142 DECF_RETURN DecFloat16_Exp(DecFloat16*, DecFloat16); 143 DECF_RETURN DecFloat34_Exp(DecFloat34*, DecFloat34); 144 DECF_RETURN DecFloat16_Ln(DecFloat16*, DecFloat16); 145 DECF_RETURN DecFloat34_Ln(DecFloat34*, DecFloat34); 146 DECF_RETURN DecFloat16_Log10(DecFloat16*, DecFloat16); 147 DECF_RETURN DecFloat34_Log10(DecFloat34*, DecFloat34); 148 DECF_RETURN DecFloat16NextMinus(DecFloat16*, DecFloat16); 149 DECF_RETURN DecFloat16NextPlus(DecFloat16*, DecFloat16); 150 DECF_RETURN DecFloat34NextMinus(DecFloat34*, DecFloat34); 151 DECF_RETURN DecFloat34NextPlus(DecFloat34*, DecFloat34);