Exemplo n.º 1
0
static void fsqrt_(FPU_REG *st0_ptr, u_char st0_tag)
{
	int expon;

	clear_C1();

	if (st0_tag == TAG_Valid) {
		u_char tag;

		if (signnegative(st0_ptr)) {
			arith_invalid(0);	/* sqrt(negative) is invalid */
			return;
		}

		/* make st(0) in  [1.0 .. 4.0) */
		expon = exponent(st0_ptr);

	      denormal_arg:

		setexponent16(st0_ptr, (expon & 1));

		/* Do the computation, the sign of the result will be positive. */
		tag = wm_sqrt(st0_ptr, 0, 0, control_word, SIGN_POS);
		addexponent(st0_ptr, expon >> 1);
		FPU_settag0(tag);
		return;
	}
Exemplo n.º 2
0
static void fsqrt_(FPU_REG *st0_ptr, u_char st0_tag)
{
	int expon;

	clear_C1();

	if (st0_tag == TAG_Valid) {
		u_char tag;

		if (signnegative(st0_ptr)) {
			arith_invalid(0);	
			return;
		}

		
		expon = exponent(st0_ptr);

	      denormal_arg:

		setexponent16(st0_ptr, (expon & 1));

		
		tag = wm_sqrt(st0_ptr, 0, 0, control_word, SIGN_POS);
		addexponent(st0_ptr, expon >> 1);
		FPU_settag0(tag);
		return;
	}
Exemplo n.º 3
0
Arquivo: fpu_trig.c Projeto: kame/kame
static void
fsqrt_(void)
{
    if (!(FPU_st0_tag ^ TW_Valid)) {
        int     expon;

        if (FPU_st0_ptr->sign == SIGN_NEG) {
            arith_invalid(FPU_st0_ptr);	/* sqrt(negative) is
							 * invalid */
            return;
        }
#ifdef DENORM_OPERAND
        if ((FPU_st0_ptr->exp <= EXP_UNDER) && (denormal_operand()))
            return;
#endif				/* DENORM_OPERAND */

        expon = FPU_st0_ptr->exp - EXP_BIAS;
        FPU_st0_ptr->exp = EXP_BIAS + (expon & 1);	/* make st(0) in  [1.0
								 * .. 4.0) */

        wm_sqrt(FPU_st0_ptr, control_word);	/* Do the computation */

        FPU_st0_ptr->exp += expon >> 1;
        FPU_st0_ptr->sign = SIGN_POS;
    } else if (FPU_st0_tag == TW_Zero)