Exemplo n.º 1
0
  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  THE POSSIBILITY OF SUCH DAMAGE.
******************************************************************************/

#include "bid_trans.h"

// 2-part conversion.

BID_EXTERN_C void bid128_to_binary128_2part(BID_F128_TYPE *,BID_F128_TYPE *,BID_UINT128);

// Standard NaN
static BID_UINT128 BID128_NAN =
  {BID128_LH_INIT( 0x0000000000000000ull, 0x7c00000000000000ull )};

// +Infinity
static BID_UINT128 BID128_INF =
  {BID128_LH_INIT( 0x0000000000000000ull, 0x7800000000000000ull )};

// 1/2
static BID_UINT128 BID128_HALF =
  {BID128_LH_INIT( 0x0000000000000005ull, 0x303e000000000000ull )};

// log(2 pi) / 2
static BID_UINT128 BID128_LOG_2PI_OVER_2 =
  {BID128_LH_INIT( 0x8512e0b1f71b1870ull, 0x2ffdc512596bf2beull )};

BID_F128_CONST_DEF(c_m1e34,      c06fed09defd561e, 75b290c510000000); // -1.000001e34Q
BID_F128_CONST_DEF(c_1e34,       406fed09defd561e, 75b290c510000000); // 1.000001e34Q
Exemplo n.º 2
0
  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  THE POSSIBILITY OF SUCH DAMAGE.
******************************************************************************/

#include "bid_trans.h"

static BID_UINT128 BID128_MINUS_HALF =
  {BID128_LH_INIT( 0x0000000000000005ull, 0xb03e000000000000ull )};

static BID_UINT128 BID128_1 =
  {BID128_LH_INIT( 0x0000000000000001ull, 0x3040000000000000ull )};

static BID_UINT128 BID128_10POW4464 =
  { BID128_LH_INIT( 0x0000000000000001ull, 0x5320000000000000ull ) };
static BID_UINT128 BID128_10POWN4464 =
  { BID128_LH_INIT( 0x0000000000000001ull, 0x0d60000000000000ull ) };

static BID_UINT128 BID128_NAN = 
  { BID128_LH_INIT( 0x0000000000000000ull, 0x7c00000000000000ull ) };

BID_F128_CONST_DEF( c_4464_ln_10, 400c4135eb3929fb, a719f2c946d2d728); // 4454*ln(10)

BID128_FUNCTION_ARG1 (bid128_log1p, x)
Exemplo n.º 3
0
  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  THE POSSIBILITY OF SUCH DAMAGE.
******************************************************************************/
#include "bid_trans.h"

// -1, used in sqrt(1 - x^2) computation

static BID_UINT128 BID128_MINUS1 =
  {BID128_LH_INIT( 0x0000000000000001ull, 0xb040000000000000ull )};

// 2-part pi, used in trivial path.

static BID_UINT128 BID128_PI2HI =
{BID128_LH_INIT( 0xdd5f2ab27379cfc7ull, 0x2ffe4d723cabcb53ull )};
static BID_UINT128 BID128_PI2LO =
{BID128_LH_INIT( 0x0492b4138a162883ull, 0x2fbad9f8afb501d4ull )};

// Zero with minimal exponent, as return for acos(1)

static BID_UINT128 BID128_0 =
  {BID128_LH_INIT( 0x0000000000000000ull, 0x0000000000000000ull )};

// NaN for inputs |x| > 1
Exemplo n.º 4
0
  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  THE POSSIBILITY OF SUCH DAMAGE.
******************************************************************************/

#include "bid_trans.h"

static BID_UINT128 BID128_1 =
  {BID128_LH_INIT( 0x0000000000000001ull, 0x3040000000000000ull )};
static BID_UINT128 BID128_10POW4464 =
  {BID128_LH_INIT( 0x0000000000000001ull, 0x5320000000000000ull )};
static BID_UINT128 BID128_10POWN4464 =
  {BID128_LH_INIT( 0x0000000000000001ull, 0x0d60000000000000ull )};

BID_F128_CONST_DEF( c_4464_log2_10, 400ccf68b2353912, 08f6437dd4607b55);// 4464*log2(10)
BID_F128_CONST_DEF( c_1_ov_ln2,     3fff71547652b82f, e1777d0ffda0d23a);// 1/ln2
BID_F128_CONST_DEF( c_one,          3fff000000000000, 0000000000000000);// 1
BID_F128_CONST_DEF( c_half,         3ffe000000000000, 0000000000000000);// .5

BID128_FUNCTION_ARG1 (bid128_log2, x)

  BID_F128_TYPE xq, rq, rt;
  BID_UINT128 res;
  int z, cmp_res;
Exemplo n.º 5
0
  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  THE POSSIBILITY OF SUCH DAMAGE.
******************************************************************************/

#include "bid_trans.h"

// +10^-40, used in trivial path

static BID_UINT128 BID128_10PM40 =
  {BID128_LH_INIT( 0x0000000000000001ull, 0x2ff0000000000000ull )};

// Constants +1, +1/2 and -1/2 used elsewhere

static BID_UINT128 BID128_1 =
  {BID128_LH_INIT( 0x0000000000000001ull, 0x3040000000000000ull )};

static BID_UINT128 BID128_POSHALF =
  {BID128_LH_INIT( 0x0000000000000005ull, 0x303e000000000000ull )};

static BID_UINT128 BID128_NEGHALF =
  {BID128_LH_INIT( 0x0000000000000005ull, 0xb03e000000000000ull )};

static BID_UINT128 BID128_EXP_11000 =
  {BID128_LH_INIT( 0xd43ede775707fd0aull, 0x5550558ada285f8bull )};