comparison base/src/java/lang/Float.d @ 84:fcf926c91ca4

Added base classes
author Frank Benoit <benoit@tionex.de>
date Sat, 18 Apr 2009 09:25:29 +0200
parents 1bf55a6eb092
children 9e0ab372d5d8
comparison
equal deleted inserted replaced
83:0628aaa2996c 84:fcf926c91ca4
1 module java.lang.Float; 1 module java.lang.Float;
2 2
3 import java.lang.util; 3 import java.lang.util;
4 import java.lang.exceptions; 4 import java.lang.exceptions;
5 import java.lang.Number;
5 6
6 class Float : ValueWrapperT!(float) { 7 class Float : Number {
7 8
8 public static float POSITIVE_INFINITY = (1.0f / 0.0f); 9 public static float POSITIVE_INFINITY = (1.0f / 0.0f);
9 public static float NEGATIVE_INFINITY = ((-1.0f) / 0.0f); 10 public static float NEGATIVE_INFINITY = ((-1.0f) / 0.0f);
10 public static float NaN = (0.0f / 0.0f); 11 public static float NaN = (0.0f / 0.0f);
11 public static float MAX_VALUE = 3.4028235e+38f; 12 public static float MAX_VALUE = 3.4028235e+38f;
12 public static float MIN_VALUE = 1.4e-45f; 13 public static float MIN_VALUE = 1.4e-45f;
13 public static int SIZE = 32; 14 public static int SIZE = 32;
15 private float value;
14 16
15 this( float value ){ 17 this( float value ){
16 super(value); 18 super();
19 this.value = value;
17 } 20 }
18 this( String str ){ 21 this( String str ){
19 implMissing( __FILE__, __LINE__ ); 22 implMissing( __FILE__, __LINE__ );
20 super(0.0); 23 super();
21 }
22 public float floatValue(){
23 return value;
24 } 24 }
25 public static String toString( float value ){ 25 public static String toString( float value ){
26 implMissing( __FILE__, __LINE__ ); 26 implMissing( __FILE__, __LINE__ );
27 return null; 27 return null;
28 } 28 }
38 implMissing( __FILE__, __LINE__ ); 38 implMissing( __FILE__, __LINE__ );
39 return 0.0f; 39 return 0.0f;
40 } 40 }
41 } 41 }
42 42
43 private static TypeInfo TYPE_;
44 public static TypeInfo TYPE(){
45 if( TYPE_ is null ){
46 TYPE_ = typeid(float);
47 }
48 return TYPE_;
49 }
50
51 public byte byteValue(){
52 return cast(byte)value;
53 }
54
55 public short shortValue(){
56 return cast(short)value;
57 }
58
59 public int intValue(){
60 return cast(int)value;
61 }
62
63 public long longValue(){
64 return cast(long)value;
65 }
66
67 public float floatValue(){
68 return cast(float)value;
69 }
70
71 public double doubleValue(){
72 return cast(double)value;
73 }
43 } 74 }
75
76