Lines Matching refs:CR
153 * and <TT>get_appr</tt>. Such applications will treat <TT>CR</tt> as
155 * <TT>java.math.BigInteger</tt>. No subclasses of <TT>CR</tt>
163 * The requires the construction of a subclass of <TT>CR</tt> with
171 * cannot be used for this purpose, since CR inherits from <TT>Number</tt>.)
179 public abstract class CR extends Number {
180 // CR is the basic representation of a number.
232 * Must be defined in subclasses of <TT>CR</tt>.
234 * not ever need to define a <TT>CR</tt> subclass.
241 * Called only with the lock on the <TT>CR</tt> object
279 public static CR valueOf(BigInteger n) {
287 public static CR valueOf(int n) {
295 public static CR valueOf(long n) {
304 public static CR valueOf(double n) {
319 CR result = valueOf(mantissa).shiftLeft(exp);
329 public static CR valueOf(float n) {
333 public static CR ZERO = valueOf(0);
334 public static CR ONE = valueOf(1);
446 CR simple_ln() {
449 static CR ten_ninths = valueOf(10).divide(valueOf(9));
450 static CR twentyfive_twentyfourths = valueOf(25).divide(valueOf(24));
451 static CR eightyone_eightyeths = valueOf(81).divide(valueOf(80));
452 static CR ln2_1 = valueOf(7).multiply(ten_ninths.simple_ln());
453 static CR ln2_2 =
455 static CR ln2_3 = valueOf(3).multiply(eightyone_eightyeths.simple_ln());
456 static CR ln2 = ln2_1.subtract(ln2_2).add(ln2_3);
460 static CR atan_reciprocal(int n) {
464 static CR four = valueOf(4);
478 public int compareTo(CR x, int r, int a) {
501 public int compareTo(CR x, int a) {
520 public int compareTo(CR x) {
532 * Equivalent to <TT>compareTo(CR.valueOf(0), a)</tt>
571 public static CR valueOf(String s, int radix)
588 return CR.valueOf(scaled_result).divide(CR.valueOf(divisor));
599 CR scaled_CR;
677 CR scale;
679 scale = CR.valueOf(big_radix.pow(scale_exp)).inverse();
681 scale = CR.valueOf(big_radix.pow(-scale_exp));
683 CR scaled_res = multiply(scale);
689 scaled_res = scaled_res.multiply(CR.valueOf(big_radix));
783 public CR add(CR x) {
791 public CR shiftLeft(int n) {
800 public CR shiftRight(int n) {
811 public CR assumeInt() {
818 public CR negate() {
825 public CR subtract(CR x) {
832 public CR multiply(CR x) {
838 * <TT>x.inverse()</tt> is equivalent to <TT>CR.valueOf(1).divide(x)</tt>.
840 public CR inverse() {
847 public CR divide(CR x) {
857 public CR select(CR x, CR y) {
864 public CR max(CR x) {
871 public CR min(CR x) {
879 public CR abs() {
886 public CR exp() {
892 CR square_root = shiftRight(1).exp();
902 public static CR PI = new gl_pi_CR();
911 public static CR atan_PI = four.multiply(four.multiply(atan_reciprocal(5))
914 static CR half_pi = PI.shiftRight(1);
919 public CR cos() {
925 CR adjustment = PI.multiply(CR.valueOf(pi_multiples));
933 CR cos_half = shiftRight(1).cos();
943 public CR sin() {
950 public CR asin() {
953 CR new_arg = ONE.subtract(multiply(this)).sqrt();
965 public CR acos() {
978 public CR ln() {
989 CR quarter = sqrt().sqrt().ln();
993 CR scaled_result = shiftRight(extra_bits).ln();
994 return scaled_result.add(CR.valueOf(extra_bits).multiply(ln2));
1003 public CR sqrt() {
1007 } // end of CR
1011 // A specialization of CR for cases in which approximate() calls
1020 abstract class slow_CR extends CR {
1041 class int_CR extends CR {
1054 class assumed_int_CR extends CR {
1055 CR value;
1056 assumed_int_CR(CR x) {
1069 class add_CR extends CR {
1070 CR op1;
1071 CR op2;
1072 add_CR(CR x, CR y) {
1084 // Representation of a CR multiplied by 2**n
1085 class shifted_CR extends CR {
1086 CR op;
1088 shifted_CR(CR x, int n) {
1098 class neg_CR extends CR {
1099 CR op;
1100 neg_CR(CR x) {
1112 class select_CR extends CR {
1113 CR selector;
1115 CR op1;
1116 CR op2;
1117 select_CR(CR s, CR x, CR y) {
1146 class mult_CR extends CR {
1147 CR op1;
1148 CR op2;
1149 mult_CR(CR x, CR y) {
1167 CR tmp;
1193 class inv_CR extends CR {
1194 CR op;
1195 inv_CR(CR x) { op = x; }
1237 class prescaled_exp_CR extends CR {
1238 CR op;
1239 prescaled_exp_CR(CR x) { op = x; }
1278 CR op;
1279 prescaled_cos_CR(CR x) {
1368 CR op;
1369 prescaled_ln_CR(CR x) { op = x; }
1413 CR op;
1414 prescaled_asin_CR(CR x) {
1494 class sqrt_CR extends CR {
1495 CR op;
1496 sqrt_CR(CR x) { op = x; }
1500 sqrt_CR(CR x, int min_p, BigInteger max_a) {
1566 // In addition to the best approximation kept by the CR base class, we keep
1579 private static CR SQRT_HALF = new sqrt_CR(ONE.shiftRight(1));
1609 // temporary CR computation, to avoid implementing BigInteger
1611 final CR b_prod_as_CR = CR.valueOf(b_prod).shiftRight(-eval_prec);
1617 final CR next_b_as_CR = b_prod_as_CR.sqrt();
1625 final CR next_b_as_CR =