|
|
|
|
|
|
|
|
static double acosh (double n) { return log (n + sqrt (n * n - 1)); } |
static double asinh (double n) { return (n < 0 ? -1.0 : 1.0) * log (fabs (n) + sqrt (n * n + 1)); } |
static double atanh (double n) { return log (1.0 + ((2.0 * n) / (1.0 - n))) * 0.5; } |
|
|
|
|
/**
*/
|
FCode (p4_nofp_d_f_align);
|
|
|
FCode (p4_nofp_to_float) |
|
FCode (p4_nofp_d_to_f) { int sign; double res; if (SP[0] < 0) sign = 1, dnegate ((p4dcell *) &SP[0]); else sign = 0; |
FCode (p4_nofp_f_store) { *((double *) *SP) = *((double*) (SP+1)); SP++; FSPINC; } |
FCode (p4_nofp_f_star) { FSP[1] *= FSP[0]; FSPINC; } |
FCode (p4_nofp_f_plus) { FSP[1] += FSP[0]; FSPINC; } |
FCode (p4_nofp_f_minus) { FSP[1] -= FSP[0]; FSPINC; } |
FCode (p4_nofp_f_slash) { FSP[1] /= FSP[0]; FSPINC; } |
FCode (p4_nofp_f_zero_less) { *(SP+1) = P4_FLAG (*FSP < 0); SP++; } |
FCode (p4_nofp_f_zero_equal) { *(SP+1) = P4_FLAG (*FSP == 0); SP++; } |
FCode (p4_nofp_f_equal) { int flag; flag = P4_FLAG (FSP[1] == FSP[0]); FSPINC; *++SP = flag; } |
FCode (p4_nofp_f_not_equal) { int flag; flag = P4_FLAG (FSP[1] != FSP[0]); FSPINC; *++SP = flag; } |
FCode (p4_nofp_f_less_than) { int flag; flag = P4_FLAG (FSP[1] < FSP[0]); FSPINC; *++SP = flag; } |
FCode (p4_nofp_f_greater_than) { int flag; flag = P4_FLAG (FSP[1] > FSP[0]); FSPINC; *++SP = flag; } |
FCode (p4_nofp_f_less_than_or_equal) { int flag; flag = P4_FLAG (FSP[1] <= FSP[0]); FSPINC; *++SP = flag; } |
FCode (p4_nofp_f_greater_than_or_equal) { int flag; flag = P4_FLAG (FSP[1] >= FSP[0]); FSPINC; *++SP = flag; } |
FCode (p4_nofp_f_to_d) { double a, hi, lo; int sign; if ((a = *FSP) < 0) sign = 1, a = -a; else sign = 0; lo = modf (ldexp (a, -CELLBITS), &hi); SP[0] = (p4ucell) hi; SP[1] = (p4ucell) ldexp (lo, CELLBITS); if (sign) dnegate ((p4dcell *) &SP[0]); } |
|
/** S>F |
/** FTRUNC>S |
/** FROUND>S |
/** FTRUNC |
/** -FROT |
/** FNIP |
/** FTUCK |
/** 1/F |
/** F^2 |
/** F2/ |
/** F2* |
|
FCode (p4_nofp_f_zero_greater) { int flag; flag = P4_FLAG (*FSP > 0.); *++SP = flag; } |
/** F0<> |
|
FCode (p4_nofp_f_fetch) { *((double*) (SP-1)) = *((double*) *SP); SP--; } |
FCode_RT (p4_nofp_f_constant_RT) { FX_USE_BODY_ADDR; FSPDEC; *FSP = *(double *) p4_nofp_dfaligned ((p4cell) FX_POP_BODY_ADDR); } |
FCode (p4_nofp_f_constant) { FX_RUNTIME_HEADER; FX_RUNTIME1 (p4_nofp_f_constant); FX (p4_nofp_d_f_align); FX_FCOMMA (*FSP); FSPINC; } |
P4RUNTIME1(p4_nofp_f_constant, p4_nofp_f_constant_RT); |
FCode (p4_nofp_f_depth) { *--SP = (p4_S0 - SP)/2; } |
FCode (p4_nofp_f_drop) { FSPINC; } |
FCode (p4_nofp_f_dup) { FSPDEC; FSP[0] = FSP[1]; } |
|
FCode_XE (p4_nofp_f_literal_execution) { FX_USE_CODE_ADDR; FSPDEC; *FSP= P4_POP_ (double, IP); FX_USE_CODE_EXIT; } |
FCode (p4_nofp_f_literal) { _FX_STATESMART_Q_COMP; if (STATESMART) { |
P4COMPILES2 (p4_nofp_f_literal, p4_nofp_f_literal_execution, p4_noop, p4_lit_nofp_float_SEE, P4_DEFAULT_STYLE); |
FCode (p4_nofp_floor) { *FSP = floor (*FSP); } |
FCode (p4_nofp_f_max) { if (FSP[0] > FSP[1]) FSP[1] = FSP[0]; FSPINC; } |
FCode (p4_nofp_f_min) { if (FSP[0] < FSP[1]) FSP[1] = FSP[0]; FSPINC; } |
FCode (p4_nofp_f_negate) { *FSP = -*FSP; } |
FCode (p4_nofp_f_over) { FSPDEC; FSP[0] = FSP[2]; } |
FCode (p4_nofp_f_rot) { double h = FSP[2]; FSP[2] = FSP[1]; FSP[1] = FSP[0]; FSP[0] = h; } |
|
FCode (p4_nofp_f_round) { |
FCode (p4_nofp_f_swap) { double h = FSP[1]; FSP[1] = FSP[0]; FSP[0] = h; } |
FCode_RT (p4_nofp_f_variable_RT) { FX_USE_BODY_ADDR; FX_PUSH_SP = p4_nofp_dfaligned ((p4cell) FX_POP_BODY_ADDR); } |
FCode (p4_nofp_f_variable) { FX_RUNTIME_HEADER; FX_RUNTIME1 (p4_nofp_f_variable); FX (p4_nofp_d_f_align); FX_FCOMMA (0.); } |
P4RUNTIME1(p4_nofp_f_variable, p4_nofp_f_variable_RT); |
FCode (p4_nofp_represent) |
|
FCode (p4_nofp_d_f_align) { while (!P4_DFALIGNED (DP)) *DP++ = 0; } |
FCode (p4_nofp_d_f_aligned) { SP[0] = p4_nofp_dfaligned (SP[0]); } |
FCode (p4_nofp_d_float_plus) { *SP += sizeof (double); } |
FCode (p4_nofp_d_floats) { *SP *= sizeof (double); } |
FCode (p4_nofp_f_star_star) { FSP[1] = pow (FSP[1], FSP[0]); FSPINC; } |
FCode (p4_nofp_f_dot)
{
p4_outf ( |
FCode (p4_nofp_f_abs) { *FSP = fabs(*FSP); } |
FCode (p4_nofp_f_e_dot) |
FCode (p4_nofp_f_s_dot)
{
p4_outf ( |
FCode (p4_nofp_f_proximate) { double a, b, c; a = FSP[2]; b = FSP[1]; c = FSP[0]; FSPINC; FSPINC; SP++; *SP = P4_FLAG (c > 0 ? fabs (a - b) < c : c < 0 ? fabs (a - b) < -c * (fabs (a) + fabs (b)) : EXACTLY_EQUAL (a, b)); } |
FCode (p4_nofp_set_precision) { PRECISION = *SP++; } |
FCode (p4_nofp_s_f_store) { *(float *) *SP = *((double*) (SP+1)); SP += 3; } |
FCode (p4_nofp_s_f_fetch) { *((double*)(SP-1)) = *(float *) *SP; --SP; } |
FCode (p4_nofp_s_float_plus) { *SP += sizeof (float); } |
FCode (p4_nofp_s_floats) { *SP *= sizeof (float); } |
|
FCode (p4_nofp_f_acos) { *FSP = acos (*FSP); } |
FCode (p4_nofp_f_acosh) { *FSP = acosh (*FSP); } |
FCode (p4_nofp_f_alog) { *FSP = pow10 (*FSP); } |
FCode (p4_nofp_f_asin) { *FSP = asin (*FSP); } |
FCode (p4_nofp_f_asinh) { *FSP = asinh (*FSP); } |
FCode (p4_nofp_f_atan) { *FSP = atan (*FSP); } |
FCode (p4_nofp_f_atan2) { FSP [1] = atan2 (FSP [1], FSP [0]); FSPINC; } |
FCode (p4_nofp_f_atanh) { *FSP = atanh (*FSP); } |
FCode (p4_nofp_f_cos) { *FSP = cos (*FSP); } |
FCode (p4_nofp_f_cosh) { *FSP = cosh (*FSP); } |
FCode (p4_nofp_f_exp) { *FSP = exp (*FSP); } |
|
FCode (p4_nofp_f_expm1) { *FSP = exp (*FSP) - 1.0; } |
|
FCode (p4_nofp_f_expm1) { *FSP = expm1 (*FSP); } |
|
FCode (p4_nofp_f_ln) { *FSP = log (*FSP); } |
|
FCode (p4_nofp_f_lnp1) { *FSP = log (*FSP + 1.0); } |
|
FCode (p4_nofp_f_lnp1) { *FSP = log1p (*FSP); } |
|
FCode (p4_nofp_f_log) { *FSP = log10 (*FSP); } |
FCode (p4_nofp_f_sin) { *FSP = sin (*FSP); } |
FCode (p4_nofp_f_sincos){ FSPDEC; FSP[0]=cos(FSP[1]); FSP[1]=sin(FSP[1]);} |
FCode (p4_nofp_f_sinh) { *FSP = sinh (*FSP); } |
FCode (p4_nofp_f_sqrt) { *FSP = sqrt (*FSP); } |
FCode (p4_nofp_f_tan) { *FSP = tan (*FSP); } |
FCode (p4_nofp_f_tanh) { *FSP = tanh (*FSP); } |
|
static FCode (p__nofp_max_float) { FSPDEC; *FSP = DBL_MAX; } |
|
|
|
static p4ucell FXCode (interpret_float) |
static int decompile_floating (char* nfa, p4xt xt) { if (*P4_TO_CODE(xt) == PFX (p4_nofp_f_constant_RT)) { p4_outf ( |
|
|
static FCode_RT(fpnostack_deinit) { FX_USE_BODY_ADDR; FX_POP_BODY_ADDR_UNUSED; PFE.decompile[FPNOSTACK_INTERPRET_SLOT] = 0; PFE.interpret[FPNOSTACK_INTERPRET_SLOT] = 0; } |
static FCode(fpnostack_init)
{
PFE.interpret[FPNOSTACK_INTERPRET_SLOT] = PFX (interpret_float);
PFE.decompile[FPNOSTACK_INTERPRET_SLOT] = decompile_floating;
p4_forget_word ( |
|
|
|