Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSDecimal.d @ 0:380af2bdd8e5
Upload of whole dwt tree
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Sat, 09 Aug 2008 17:00:02 +0200 |
parents | |
children | 8b48be5454ce |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:380af2bdd8e5 |
---|---|
1 /******************************************************************************* | |
2 * Copyright (c) 2007 IBM Corporation and others. | |
3 * All rights reserved. This program and the accompanying materials | |
4 * are made available under the terms of the Eclipse Public License v1.0 | |
5 * which accompanies this distribution, and is available at | |
6 * http://www.eclipse.org/legal/epl-v10.html | |
7 * | |
8 * Contributors: | |
9 * IBM Corporation - initial API and implementation | |
10 * | |
11 * Port to the D Programming language: | |
12 * Jacob Carlborg <jacob.carlborg@gmail.com> | |
13 *******************************************************************************/ | |
14 module dwt.internal.cocoa.NSDecimal; | |
15 | |
16 //import dwt.internal.cocoa.OS; | |
17 import dwt.internal.cocoa.NSInteger; | |
18 | |
19 struct NSDecimal | |
20 { | |
21 uint _exponent; | |
22 uint _length; | |
23 uint _isNegative; | |
24 uint _isCompact; | |
25 uint _reserved; | |
26 /*ushort[OS.NSDecimalMaxSize]*/ushort* _mantissa; | |
27 } | |
28 | |
29 enum NSCalculationError : NSUInteger | |
30 { | |
31 NSCalculationNoError = 0, | |
32 NSCalculationLossOfPrecision, // Result lost precision | |
33 NSCalculationUnderflow, // Result became 0 | |
34 NSCalculationOverflow, // Result exceeds possible representation | |
35 NSCalculationDivideByZero | |
36 } | |
37 | |
38 alias NSCalculationError.NSCalculationNoError NSCalculationNoError; | |
39 alias NSCalculationError.NSCalculationLossOfPrecision NSCalculationLossOfPrecision; | |
40 alias NSCalculationError.NSCalculationUnderflow NSCalculationUnderflow; | |
41 alias NSCalculationError.NSCalculationOverflow NSCalculationOverflow; | |
42 alias NSCalculationError.NSCalculationDivideByZero NSCalculationDivideByZero; | |
43 | |
44 enum NSRoundingMode : NSUInteger | |
45 { | |
46 NSRoundPlain, // Round up on a tie | |
47 NSRoundDown, // Always down == truncate | |
48 NSRoundUp, // Always up | |
49 NSRoundBankers // on a tie round so last digit is even | |
50 } | |
51 | |
52 alias NSRoundingMode.NSRoundPlain NSRoundPlain; | |
53 alias NSRoundingMode.NSRoundDown NSRoundDown; | |
54 alias NSRoundingMode.NSRoundUp NSRoundUp; | |
55 alias NSRoundingMode.NSRoundBankers NSRoundBankers; |