示例#1
0
uint64_t helper_fdiv_d(CPURISCVState *env, uint64_t frs1, uint64_t frs2, uint64_t rm)
{
    softfloat_roundingMode = RISCV_RM;
    frs1 = f64_div(frs1, frs2);
    set_fp_exceptions;
    return frs1;
}
示例#2
0
文件: double.c 项目: Tilka/epsilon
aeabi_double_t __aeabi_ddiv(aeabi_double_t a, aeabi_double_t b) {
  return d(f64_div(f64(a), f64(b)));
}
示例#3
0
文件: main.c 项目: onitake/aversive
int f64_test(void)
{
    f64 a,b,c;

    a = f64_from_double(A);
    b = f64_from_double(B);
    c = f64_from_double(C);

    printf("************ F64\n\n");

    printf("*** ADD\n\n");
    printf("Result is        ");
    f64_print(f64_add(a,b));
    printf("\nResult should be %f\n\n", A+B);
    printf("Result is        ");
    f64_print(f64_add(b,c));
    printf("\nResult should be %f\n\n", B+C);
    printf("Result is        ");
    f64_print(f64_add(c,a));
    printf("\nResult should be %f\n\n", C+A);

    printf("*** SUB\n\n");
    printf("Result is        ");
    f64_print(f64_sub(a,b));
    printf("\nResult should be %f\n\n", A-B);
    printf("Result is        ");
    f64_print(f64_sub(b,c));
    printf("\nResult should be %f\n\n", B-C);
    printf("Result is        ");
    f64_print(f64_sub(c,a));
    printf("\nResult should be %f\n\n", C-A);

    printf("*** INV\n\n");
    printf("Result is        ");
    f64_print(f64_inv(a));
    printf("\nResult should be %f\n\n", 1.0/A);
    printf("Result is        ");
    f64_print(f64_inv(b));
    printf("\nResult should be %f\n\n", 1.0/B);
    printf("Result is        ");
    f64_print(f64_inv(c));
    printf("\nResult should be %f\n\n", 1.0/C);

    printf("*** MUL\n\n");
    printf("Result is        ");
    f64_print(f64_mul(a,b));
    printf("\nResult should be %f\n\n", A*B);
    printf("Result is        ");
    f64_print(f64_mul(b,c));
    printf("\nResult should be %f\n\n", B*C);
    printf("Result is        ");
    f64_print(f64_mul(c,a));
    printf("\nResult should be %f\n\n", C*A);

    printf("*** DIV\n\n");
    printf("Result is        ");
    f64_print(f64_div(a,b));
    printf("\nResult should be %f\n\n", A/B);
    printf("Result is        ");
    f64_print(f64_div(b,c));
    printf("\nResult should be %f\n\n", B/C);
    printf("Result is        ");
    f64_print(f64_div(c,a));
    printf("\nResult should be %f\n\n", C/A);

    printf("*** SQRT\n\n");
    printf("Result is        ");
    f64_print(f64_sqrt(a));
    f64_sqrt(a);
    printf("\nResult should be %f\n\n", sqrt(A));
    printf("Result is        ");
    f64_print(f64_sqrt(b));
    printf("\nResult should be %f\n\n", sqrt(B));
    printf("Result is        ");
    f64_print(f64_sqrt(c));
    printf("\nResult should be %f\n\n", sqrt(C));


    return 0;
}