|
|
|
|
|
|
|
|
|
|
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_d_f_align);
|
|
|
FCode (p4_to_float) |
|
FCode (p4_d_to_f) { int sign; double res; if (SP[0] < 0) sign = 1, dnegate ((p4dcell *) &SP[0]); else sign = 0; |
FCode (p4_f_store) { *(double *) *SP++ = *FP++; } |
FCode (p4_f_star) { FP[1] *= FP[0]; FP++; } |
FCode (p4_f_plus) { FP[1] += FP[0]; FP++; } |
FCode (p4_f_minus) { FP[1] -= FP[0]; FP++; } |
FCode (p4_f_slash) { FP[1] /= FP[0]; FP++; } |
FCode (p4_f_zero_less) { *--SP = P4_FLAG (*FP++ < 0); } |
FCode (p4_f_zero_equal) { *--SP = P4_FLAG (*FP++ == 0); } |
FCode (p4_f_less_than) { *--SP = P4_FLAG (FP[1] < FP[0]); FP += 2; } |
FCode (p4_f_fetch) { *--FP = *(double *) *SP++; } |
FCode_RT (p4_f_constant_RT) { FX_USE_BODY_ADDR; *--FP = *(double *) p4_dfaligned ((p4cell) FX_POP_BODY_ADDR); } |
FCode (p4_f_constant) { FX_RUNTIME_HEADER; FX_RUNTIME1 (p4_f_constant); FX (p4_d_f_align); FX_FCOMMA (*FP++); } |
P4RUNTIME1(p4_f_constant, p4_f_constant_RT); |
FCode (p4_f_depth) { *--SP = p4_F0 - FP; } |
FCode (p4_f_drop) { FP++; } |
FCode (p4_f_dup) { FP--; FP[0] = FP[1]; } |
|
FCode_XE (p4_f_literal_execution) { FX_USE_CODE_ADDR; *--FP= P4_POP_ (double, IP); FX_USE_CODE_EXIT; } |
FCode (p4_f_literal) { _FX_STATESMART_Q_COMP; if (STATESMART) { |
P4COMPILES2 (p4_f_literal, p4_f_literal_execution, p4_noop, p4_lit_float_SEE, P4_DEFAULT_STYLE); |
FCode (p4_floor) { *FP = floor (*FP); } |
FCode (p4_f_max) { if (FP[0] > FP[1]) FP[1] = FP[0]; FP++; } |
FCode (p4_f_min) { if (FP[0] < FP[1]) FP[1] = FP[0]; FP++; } |
FCode (p4_f_negate) { *FP = -*FP; } |
FCode (p4_f_over) { FP--; FP[0] = FP[2]; } |
FCode (p4_f_rot) { double h = FP[2]; FP[2] = FP[1]; FP[1] = FP[0]; FP[0] = h; } |
|
FCode (p4_f_round) { |
FCode (p4_f_swap) { double h = FP[1]; FP[1] = FP[0]; FP[0] = h; } |
FCode_RT (p4_f_variable_RT) { FX_USE_BODY_ADDR; FX_PUSH_SP = p4_dfaligned ((p4cell) FX_POP_BODY_ADDR); } |
FCode (p4_f_variable) { FX_RUNTIME_HEADER; FX_RUNTIME1 (p4_f_variable); FX (p4_d_f_align); FX_FCOMMA (0.); } |
P4RUNTIME1(p4_f_variable, p4_f_variable_RT); |
FCode (p4_represent) |
|
FCode (p4_d_f_align) { while (!P4_DFALIGNED (DP)) *DP++ = 0; } |
FCode (p4_d_f_aligned) { SP[0] = p4_dfaligned (SP[0]); } |
FCode (p4_d_float_plus) { *SP += sizeof (double); } |
FCode (p4_d_floats) { *SP *= sizeof (double); } |
FCode (p4_f_star_star) { FP[1] = pow (FP[1], FP[0]); FP++; } |
FCode (p4_f_dot)
{
p4_outf ( |
FCode (p4_f_abs) { *FP = fabs (*FP); } |
FCode (p4_f_e_dot) |
FCode (p4_f_s_dot)
{
p4_outf ( |
FCode (p4_f_proximate) { double a, b, c; a = FP[2]; b = FP[1]; c = FP[0]; FP += 3; *--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_set_precision) { PRECISION = *SP++; } |
FCode (p4_s_f_store) { *(float *) *SP++ = *FP++; } |
FCode (p4_s_f_fetch) { *--FP = *(float *) *SP++; } |
FCode (p4_s_float_plus) { *SP += sizeof (float); } |
FCode (p4_s_floats) { *SP *= sizeof (float); } |
|
FCode (p4_f_acos) { *FP = acos (*FP); } |
FCode (p4_f_acosh) { *FP = acosh (*FP); } |
FCode (p4_f_alog) { *FP = pow10 (*FP); } |
FCode (p4_f_asin) { *FP = asin (*FP); } |
FCode (p4_f_asinh) { *FP = asinh (*FP); } |
FCode (p4_f_atan) { *FP = atan (*FP); } |
FCode (p4_f_atan2) { FP [1] = atan2 (FP [1], FP [0]); FP++; } |
FCode (p4_f_atanh) { *FP = atanh (*FP); } |
FCode (p4_f_cos) { *FP = cos (*FP); } |
FCode (p4_f_cosh) { *FP = cosh (*FP); } |
FCode (p4_f_exp) { *FP = exp (*FP); } |
|
FCode (p4_f_expm1) { *FP = exp (*FP) - 1.0; } |
|
FCode (p4_f_expm1) { *FP = expm1 (*FP); } |
|
FCode (p4_f_ln) { *FP = log (*FP); } |
|
FCode (p4_f_lnp1) { *FP = log (*FP + 1.0); } |
|
FCode (p4_f_lnp1) { *FP = log1p (*FP); } |
|
FCode (p4_f_log) { *FP = log10 (*FP); } |
FCode (p4_f_sin) { *FP = sin (*FP); } |
FCode (p4_f_sincos) { --FP; FP [0] = cos (FP [1]); FP [1] = sin (FP [1]); } |
FCode (p4_f_sinh) { *FP = sinh (*FP); } |
FCode (p4_f_sqrt) { *FP = sqrt (*FP); } |
FCode (p4_f_tan) { *FP = tan (*FP); } |
FCode (p4_f_tanh) { *FP = tanh (*FP); } |
|
static FCode (p__floating_stack) { FX_PUSH ((PFE.f0 - PFE.fstack) / sizeof(double)); } |
static FCode (p__max_float) { *--FP = DBL_MAX; } |
|
|
static p4ucell FXCode (interpret_float) |
static FCode(abort_float) { FP = p4_F0; } |
static int decompile_floating (char* nfa, p4xt xt) { if (*P4_TO_CODE(xt) == PFX (p4_f_constant_RT)) { p4_outf ( |
|
static FCode_RT(floating_deinit) { FX_USE_BODY_ADDR; FX_POP_BODY_ADDR_UNUSED; PFE.decompile[FLOATING_INTERPRET_SLOT] = 0; PFE.interpret[FLOATING_INTERPRET_SLOT] = 0; PFE.abort[FLOATING_INTERPRET_SLOT] = 0; } |
|
static FCode(floating_init) { p4ucell flt_stack_size = p4_search_option_value ( |
extern p4Words P4WORDS(floating_misc); |
|
|
|