summaryrefslogtreecommitdiff
path: root/src/classlibnative/bcltype/decimal.h
blob: f037fd3acb2a0155e53b1d2d19ab574e9b0df855 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
//
// File: Decimal.h
//

//

#ifndef _DECIMAL_H_
#define _DECIMAL_H_

#include <oleauto.h>

#include <pshpack1.h>

#include "number.h"

#define DECIMAL_PRECISION 29

class COMDecimal {
public:
    static FCDECL2_IV(void, InitSingle, DECIMAL *_this, float value);
    static FCDECL2_IV(void, InitDouble, DECIMAL *_this, double value);
    static FCDECL2(INT32, DoCompare, DECIMAL * d1, DECIMAL * d2);

    static FCDECL3(void, DoAddSubThrow, DECIMAL * d1, DECIMAL * d2, UINT8 bSign);
    static FCDECL2(void, DoDivideThrow, DECIMAL * d1, DECIMAL * d2);
    static FCDECL2(void, DoMultiplyThrow, DECIMAL * d1, DECIMAL * d2);

    static FCDECL4(void, DoAddSub, DECIMAL * d1, DECIMAL * d2, UINT8 bSign, CLR_BOOL * overflowed);
    static FCDECL3(void, DoDivide, DECIMAL * d1, DECIMAL * d2, CLR_BOOL * overflowed);
    static FCDECL3(void, DoMultiply, DECIMAL * d1, DECIMAL * d2, CLR_BOOL * overflowed);

    static FCDECL2(void, DoRound, DECIMAL * d1, INT32 decimals);
    static FCDECL2_IV(void, DoToCurrency, CY * result, DECIMAL d);
    static FCDECL1(void, DoTruncate, DECIMAL * d);
    static FCDECL1(void, DoFloor, DECIMAL * d);

    static FCDECL1(double, ToDouble, FC_DECIMAL d);
    static FCDECL1(float, ToSingle, FC_DECIMAL d);
    static FCDECL1(INT32, ToInt32, FC_DECIMAL d);	
    static FCDECL1(Object*, ToString, FC_DECIMAL d);
    
    static int NumberToDecimal(NUMBER* number, DECIMAL* value);
    

};

#include <poppack.h>

#endif // _DECIMAL_H_