/[classpath]/classpath/native/jni/java-lang/java_lang_Double.c
ViewVC logotype

Diff of /classpath/native/jni/java-lang/java_lang_Double.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by tromey, Sat Nov 10 20:53:11 2001 UTC revision 1.4 by cbj, Mon Nov 12 23:37:03 2001 UTC
# Line 27  executable file might be covered by the Line 27  executable file might be covered by the
27    
28  #include <config.h>  #include <config.h>
29  #include <stdlib.h>  #include <stdlib.h>
30    #include <stdio.h>
31  #include <string.h>  #include <string.h>
32    
33  #include "mprec.h"  #include "mprec.h"
# Line 35  executable file might be covered by the Line 36  executable file might be covered by the
36    
37  #include "java_lang_Double.h"  #include "java_lang_Double.h"
38    
39    static jmethodID isNaNID;
40    static jdouble NEGATIVE_INFINITY;
41    static jdouble POSITIVE_INFINITY;
42    
43  /*  /*
44   * Class:     java_lang_Double   * Class:     java_lang_Double
45   * Method:    initIDs   * Method:    initIDs
46   * Signature: ()   * Signature: ()
47   */   */
 jmethodID isNaNID;  
 jdouble NEGATIVE_INFINITY;  
 jdouble POSITIVE_INFINITY;  
   
48  JNIEXPORT void JNICALL Java_java_lang_Double_initIDs  JNIEXPORT void JNICALL Java_java_lang_Double_initIDs
49    (JNIEnv *env, jclass cls)    (JNIEnv *env, jclass cls)
50  {  {
# Line 71  JNIEXPORT void JNICALL Java_java_lang_Do Line 71  JNIEXPORT void JNICALL Java_java_lang_Do
71      }      }
72    POSITIVE_INFINITY = (*env)->GetStaticDoubleField(env, cls, posInfID);    POSITIVE_INFINITY = (*env)->GetStaticDoubleField(env, cls, posInfID);
73    NEGATIVE_INFINITY = (*env)->GetStaticDoubleField(env, cls, negInfID);    NEGATIVE_INFINITY = (*env)->GetStaticDoubleField(env, cls, negInfID);
74    
75    #ifdef DEBUG
76      fprintf(stderr, "java.lang.Double.initIDs() POSITIVE_INFINITY = %g\n", POSITIVE_INFINITY);
77      fprintf(stderr, "java.lang.Double.initIDs() NEGATIVE_INFINITY = %g\n", NEGATIVE_INFINITY);
78    #endif
79  }  }
80    
81  /*  /*
# Line 133  JNIEXPORT jstring JNICALL Java_java_lang Line 138  JNIEXPORT jstring JNICALL Java_java_lang
138    char *s, *d;    char *s, *d;
139    int i;    int i;
140    
141    #ifdef DEBUG
142      fprintf (stderr, "java.lang.Double.toString (%g)\n", value);
143    #endif
144    
145    if ((*env)->CallStaticBooleanMethod(env, cls, isNaNID, value))    if ((*env)->CallStaticBooleanMethod(env, cls, isNaNID, value))
146      return (*env)->NewStringUTF(env, "NaN");      return (*env)->NewStringUTF(env, "NaN");
147        
148    if ( ((jlong) value) == ((jlong)POSITIVE_INFINITY))    if (value == POSITIVE_INFINITY)
149      return (*env)->NewStringUTF(env, "Infinity");      return (*env)->NewStringUTF(env, "Infinity");
150    
151    if (value == NEGATIVE_INFINITY)    if (value == NEGATIVE_INFINITY)

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26