src/share/vm/runtime/sharedRuntimeTrig.cpp

changeset 7000
631c3a4ea10c
parent 6461
bdd155477289
child 7002
a073be2ce5c2
     1.1 --- a/src/share/vm/runtime/sharedRuntimeTrig.cpp	Mon Aug 11 19:19:47 2014 +0400
     1.2 +++ b/src/share/vm/runtime/sharedRuntimeTrig.cpp	Thu May 22 11:36:23 2014 -0400
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -63,63 +63,7 @@
    1.11  #define SAFEBUF
    1.12  #endif
    1.13  
    1.14 -#include <math.h>
    1.15 -
    1.16 -// VM_LITTLE_ENDIAN is #defined appropriately in the Makefiles
    1.17 -// [jk] this is not 100% correct because the float word order may different
    1.18 -// from the byte order (e.g. on ARM)
    1.19 -#ifdef VM_LITTLE_ENDIAN
    1.20 -# define __HI(x) *(1+(int*)&x)
    1.21 -# define __LO(x) *(int*)&x
    1.22 -#else
    1.23 -# define __HI(x) *(int*)&x
    1.24 -# define __LO(x) *(1+(int*)&x)
    1.25 -#endif
    1.26 -
    1.27 -static double copysignA(double x, double y) {
    1.28 -  __HI(x) = (__HI(x)&0x7fffffff)|(__HI(y)&0x80000000);
    1.29 -  return x;
    1.30 -}
    1.31 -
    1.32 -/*
    1.33 - * scalbn (double x, int n)
    1.34 - * scalbn(x,n) returns x* 2**n  computed by  exponent
    1.35 - * manipulation rather than by actually performing an
    1.36 - * exponentiation or a multiplication.
    1.37 - */
    1.38 -
    1.39 -static const double
    1.40 -two54   =  1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */
    1.41 -twom54  =  5.55111512312578270212e-17, /* 0x3C900000, 0x00000000 */
    1.42 -hugeX  = 1.0e+300,
    1.43 -tiny   = 1.0e-300;
    1.44 -
    1.45 -static double scalbnA (double x, int n) {
    1.46 -  int  k,hx,lx;
    1.47 -  hx = __HI(x);
    1.48 -  lx = __LO(x);
    1.49 -  k = (hx&0x7ff00000)>>20;              /* extract exponent */
    1.50 -  if (k==0) {                           /* 0 or subnormal x */
    1.51 -    if ((lx|(hx&0x7fffffff))==0) return x; /* +-0 */
    1.52 -    x *= two54;
    1.53 -    hx = __HI(x);
    1.54 -    k = ((hx&0x7ff00000)>>20) - 54;
    1.55 -    if (n< -50000) return tiny*x;       /*underflow*/
    1.56 -  }
    1.57 -  if (k==0x7ff) return x+x;             /* NaN or Inf */
    1.58 -  k = k+n;
    1.59 -  if (k >  0x7fe) return hugeX*copysignA(hugeX,x); /* overflow  */
    1.60 -  if (k > 0)                            /* normal result */
    1.61 -    {__HI(x) = (hx&0x800fffff)|(k<<20); return x;}
    1.62 -  if (k <= -54) {
    1.63 -    if (n > 50000)      /* in case integer overflow in n+k */
    1.64 -      return hugeX*copysignA(hugeX,x);  /*overflow*/
    1.65 -    else return tiny*copysignA(tiny,x); /*underflow*/
    1.66 -  }
    1.67 -  k += 54;                              /* subnormal result */
    1.68 -  __HI(x) = (hx&0x800fffff)|(k<<20);
    1.69 -  return x*twom54;
    1.70 -}
    1.71 +#include "runtime/sharedRuntimeMath.hpp"
    1.72  
    1.73  /*
    1.74   * __kernel_rem_pio2(x,y,e0,nx,prec,ipio2)

mercurial