• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2004, Hewlett-Packard Development Company, L.P.
2 //
3 // Permission is granted free of charge to copy, modify, use and distribute
4 // this software  provided you include the entirety of this notice in all
5 // copies made.
6 //
7 // THIS SOFTWARE IS PROVIDED ON AN AS IS BASIS, WITHOUT WARRANTY OF ANY
8 // KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION,
9 // WARRANTIES THAT THE SUBJECT SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT
10 // FOR A PARTICULAR PURPOSE OR NON-INFRINGING.   HEWLETT-PACKARD ASSUMES
11 // NO RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE.
12 // SHOULD THE SOFTWARE PROVE DEFECTIVE IN ANY RESPECT,
13 // HEWLETT-PACKARD ASSUMES NO COST OR LIABILITY FOR ANY
14 // SERVICING, REPAIR OR CORRECTION.  THIS DISCLAIMER OF WARRANTY CONSTITUTES
15 // AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY SUBJECT SOFTWARE IS
16 // AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
17 //
18 // UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING,
19 // WITHOUT LIMITATION, NEGLIGENCE OR STRICT LIABILITY), CONTRACT, OR
20 // OTHERWISE, SHALL HEWLETT-PACKARD BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL,
21 // INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER WITH RESPECT TO THE
22 // SOFTWARE INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK
23 // STOPPAGE, LOSS OF DATA, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL
24 // OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF HEWLETT-PACKARD SHALL
25 // HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES.
26 // THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY RESULTING
27 // FROM HEWLETT-PACKARD's NEGLIGENCE TO THE EXTENT APPLICABLE
28 // LAW PROHIBITS SUCH LIMITATION.  SOME JURISDICTIONS DO NOT ALLOW THE
29 // EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THAT
30 // EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
31 //
32 
33 package com.hp.creals;
34 
35 /**
36 * A scientific notation representation of an approximation to a constructive
37 * real.
38 * Generated by CR.toStringFloatRep.
39 */
40 public class StringFloatRep {
StringFloatRep(int s, String m, int r, int e)41     StringFloatRep(int s, String m, int r, int e) {
42 	sign = s;
43 	mantissa = m;
44 	radix = r;
45 	exponent = e;
46     }
47 /**
48 * The sign associated with this approximation.  May be -1, _1, or zero.
49 */
50     public int sign;
51 /**
52 * A string representation of the mantissa.  The decimal point is implicitly
53 * to the left of the string of digits, and is not explicitly represented.
54 */
55     public String mantissa;
56 /**
57 * The radix of the representation.  Also the base of the exponent field.
58 */
59     public int radix;
60 /**
61 * The mantissa is scaled by radix**exponent.
62 */
63     public int exponent;
64 
65 /**
66 * Produce a textual representation including the sign and exponent.
67 */
toString()68     public String toString() {
69       return
70 	(sign < 0? "-" : "") + mantissa + "E" + Integer.toString(exponent)
71 	+ (radix == 10? "" : "(radix " + radix + ")");
72     }
73 }
74