
(FPCore (x)
:precision binary64
(let* ((t_0 (/ 1.0 (+ 1.0 (* 0.3275911 (fabs x))))))
(-
1.0
(*
(*
t_0
(+
0.254829592
(*
t_0
(+
-0.284496736
(*
t_0
(+
1.421413741
(* t_0 (+ -1.453152027 (* t_0 1.061405429)))))))))
(exp (- (* (fabs x) (fabs x))))))))double code(double x) {
double t_0 = 1.0 / (1.0 + (0.3275911 * fabs(x)));
return 1.0 - ((t_0 * (0.254829592 + (t_0 * (-0.284496736 + (t_0 * (1.421413741 + (t_0 * (-1.453152027 + (t_0 * 1.061405429))))))))) * exp(-(fabs(x) * fabs(x))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8) :: t_0
t_0 = 1.0d0 / (1.0d0 + (0.3275911d0 * abs(x)))
code = 1.0d0 - ((t_0 * (0.254829592d0 + (t_0 * ((-0.284496736d0) + (t_0 * (1.421413741d0 + (t_0 * ((-1.453152027d0) + (t_0 * 1.061405429d0))))))))) * exp(-(abs(x) * abs(x))))
end function
public static double code(double x) {
double t_0 = 1.0 / (1.0 + (0.3275911 * Math.abs(x)));
return 1.0 - ((t_0 * (0.254829592 + (t_0 * (-0.284496736 + (t_0 * (1.421413741 + (t_0 * (-1.453152027 + (t_0 * 1.061405429))))))))) * Math.exp(-(Math.abs(x) * Math.abs(x))));
}
def code(x): t_0 = 1.0 / (1.0 + (0.3275911 * math.fabs(x))) return 1.0 - ((t_0 * (0.254829592 + (t_0 * (-0.284496736 + (t_0 * (1.421413741 + (t_0 * (-1.453152027 + (t_0 * 1.061405429))))))))) * math.exp(-(math.fabs(x) * math.fabs(x))))
function code(x) t_0 = Float64(1.0 / Float64(1.0 + Float64(0.3275911 * abs(x)))) return Float64(1.0 - Float64(Float64(t_0 * Float64(0.254829592 + Float64(t_0 * Float64(-0.284496736 + Float64(t_0 * Float64(1.421413741 + Float64(t_0 * Float64(-1.453152027 + Float64(t_0 * 1.061405429))))))))) * exp(Float64(-Float64(abs(x) * abs(x)))))) end
function tmp = code(x) t_0 = 1.0 / (1.0 + (0.3275911 * abs(x))); tmp = 1.0 - ((t_0 * (0.254829592 + (t_0 * (-0.284496736 + (t_0 * (1.421413741 + (t_0 * (-1.453152027 + (t_0 * 1.061405429))))))))) * exp(-(abs(x) * abs(x)))); end
code[x_] := Block[{t$95$0 = N[(1.0 / N[(1.0 + N[(0.3275911 * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(1.0 - N[(N[(t$95$0 * N[(0.254829592 + N[(t$95$0 * N[(-0.284496736 + N[(t$95$0 * N[(1.421413741 + N[(t$95$0 * N[(-1.453152027 + N[(t$95$0 * 1.061405429), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[Abs[x], $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_0 := \frac{1}{1 + 0.3275911 \cdot \left|x\right|}\\
1 - \left(t\_0 \cdot \left(0.254829592 + t\_0 \cdot \left(-0.284496736 + t\_0 \cdot \left(1.421413741 + t\_0 \cdot \left(-1.453152027 + t\_0 \cdot 1.061405429\right)\right)\right)\right)\right) \cdot e^{-\left|x\right| \cdot \left|x\right|}
\end{array}
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x)
:precision binary64
(let* ((t_0 (/ 1.0 (+ 1.0 (* 0.3275911 (fabs x))))))
(-
1.0
(*
(*
t_0
(+
0.254829592
(*
t_0
(+
-0.284496736
(*
t_0
(+
1.421413741
(* t_0 (+ -1.453152027 (* t_0 1.061405429)))))))))
(exp (- (* (fabs x) (fabs x))))))))double code(double x) {
double t_0 = 1.0 / (1.0 + (0.3275911 * fabs(x)));
return 1.0 - ((t_0 * (0.254829592 + (t_0 * (-0.284496736 + (t_0 * (1.421413741 + (t_0 * (-1.453152027 + (t_0 * 1.061405429))))))))) * exp(-(fabs(x) * fabs(x))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8) :: t_0
t_0 = 1.0d0 / (1.0d0 + (0.3275911d0 * abs(x)))
code = 1.0d0 - ((t_0 * (0.254829592d0 + (t_0 * ((-0.284496736d0) + (t_0 * (1.421413741d0 + (t_0 * ((-1.453152027d0) + (t_0 * 1.061405429d0))))))))) * exp(-(abs(x) * abs(x))))
end function
public static double code(double x) {
double t_0 = 1.0 / (1.0 + (0.3275911 * Math.abs(x)));
return 1.0 - ((t_0 * (0.254829592 + (t_0 * (-0.284496736 + (t_0 * (1.421413741 + (t_0 * (-1.453152027 + (t_0 * 1.061405429))))))))) * Math.exp(-(Math.abs(x) * Math.abs(x))));
}
def code(x): t_0 = 1.0 / (1.0 + (0.3275911 * math.fabs(x))) return 1.0 - ((t_0 * (0.254829592 + (t_0 * (-0.284496736 + (t_0 * (1.421413741 + (t_0 * (-1.453152027 + (t_0 * 1.061405429))))))))) * math.exp(-(math.fabs(x) * math.fabs(x))))
function code(x) t_0 = Float64(1.0 / Float64(1.0 + Float64(0.3275911 * abs(x)))) return Float64(1.0 - Float64(Float64(t_0 * Float64(0.254829592 + Float64(t_0 * Float64(-0.284496736 + Float64(t_0 * Float64(1.421413741 + Float64(t_0 * Float64(-1.453152027 + Float64(t_0 * 1.061405429))))))))) * exp(Float64(-Float64(abs(x) * abs(x)))))) end
function tmp = code(x) t_0 = 1.0 / (1.0 + (0.3275911 * abs(x))); tmp = 1.0 - ((t_0 * (0.254829592 + (t_0 * (-0.284496736 + (t_0 * (1.421413741 + (t_0 * (-1.453152027 + (t_0 * 1.061405429))))))))) * exp(-(abs(x) * abs(x)))); end
code[x_] := Block[{t$95$0 = N[(1.0 / N[(1.0 + N[(0.3275911 * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(1.0 - N[(N[(t$95$0 * N[(0.254829592 + N[(t$95$0 * N[(-0.284496736 + N[(t$95$0 * N[(1.421413741 + N[(t$95$0 * N[(-1.453152027 + N[(t$95$0 * 1.061405429), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[Abs[x], $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_0 := \frac{1}{1 + 0.3275911 \cdot \left|x\right|}\\
1 - \left(t\_0 \cdot \left(0.254829592 + t\_0 \cdot \left(-0.284496736 + t\_0 \cdot \left(1.421413741 + t\_0 \cdot \left(-1.453152027 + t\_0 \cdot 1.061405429\right)\right)\right)\right)\right) \cdot e^{-\left|x\right| \cdot \left|x\right|}
\end{array}
(FPCore (x)
:precision binary64
(let* ((t_0 (* 0.3275911 (fabs x)))
(t_1 (- t_0 -1.0))
(t_2 (- -1.0 t_0))
(t_3 (- (* (fabs x) 0.3275911) -1.0))
(t_4 (exp (* x x)))
(t_5 (* (fabs x) -0.3275911))
(t_6 (/ (- (* t_5 t_5) 1.0) (+ t_5 1.0)))
(t_7
(/
(-
(/
(-
(/
(-
(/ (- (/ -1.061405429 t_3) -1.453152027) t_3)
1.421413741)
t_3)
-0.284496736)
t_6)
-0.254829592)
(* t_6 t_4)))
(t_8 (/ -1.061405429 t_1))
(t_9
(/
(-
(/
(-
-0.284496736
(/ (- 1.421413741 (/ (- t_8 -1.453152027) t_1)) t_2))
t_1)
-0.254829592)
(* t_2 t_4))))
(/
(+
(/
1.0
(/
(pow (* t_4 t_6) 3.0)
(pow
(-
(/
(-
-0.284496736
(/ (- 1.421413741 (/ (- -1.453152027 t_8) t_6)) t_6))
t_1)
-0.254829592)
3.0)))
(pow 1.0 3.0))
(+ (* t_7 t_7) (/ (- 1.0 (pow t_9 2.0)) (+ 1.0 t_9))))))double code(double x) {
double t_0 = 0.3275911 * fabs(x);
double t_1 = t_0 - -1.0;
double t_2 = -1.0 - t_0;
double t_3 = (fabs(x) * 0.3275911) - -1.0;
double t_4 = exp((x * x));
double t_5 = fabs(x) * -0.3275911;
double t_6 = ((t_5 * t_5) - 1.0) / (t_5 + 1.0);
double t_7 = ((((((((-1.061405429 / t_3) - -1.453152027) / t_3) - 1.421413741) / t_3) - -0.284496736) / t_6) - -0.254829592) / (t_6 * t_4);
double t_8 = -1.061405429 / t_1;
double t_9 = (((-0.284496736 - ((1.421413741 - ((t_8 - -1.453152027) / t_1)) / t_2)) / t_1) - -0.254829592) / (t_2 * t_4);
return ((1.0 / (pow((t_4 * t_6), 3.0) / pow((((-0.284496736 - ((1.421413741 - ((-1.453152027 - t_8) / t_6)) / t_6)) / t_1) - -0.254829592), 3.0))) + pow(1.0, 3.0)) / ((t_7 * t_7) + ((1.0 - pow(t_9, 2.0)) / (1.0 + t_9)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: t_6
real(8) :: t_7
real(8) :: t_8
real(8) :: t_9
t_0 = 0.3275911d0 * abs(x)
t_1 = t_0 - (-1.0d0)
t_2 = (-1.0d0) - t_0
t_3 = (abs(x) * 0.3275911d0) - (-1.0d0)
t_4 = exp((x * x))
t_5 = abs(x) * (-0.3275911d0)
t_6 = ((t_5 * t_5) - 1.0d0) / (t_5 + 1.0d0)
t_7 = (((((((((-1.061405429d0) / t_3) - (-1.453152027d0)) / t_3) - 1.421413741d0) / t_3) - (-0.284496736d0)) / t_6) - (-0.254829592d0)) / (t_6 * t_4)
t_8 = (-1.061405429d0) / t_1
t_9 = ((((-0.284496736d0) - ((1.421413741d0 - ((t_8 - (-1.453152027d0)) / t_1)) / t_2)) / t_1) - (-0.254829592d0)) / (t_2 * t_4)
code = ((1.0d0 / (((t_4 * t_6) ** 3.0d0) / (((((-0.284496736d0) - ((1.421413741d0 - (((-1.453152027d0) - t_8) / t_6)) / t_6)) / t_1) - (-0.254829592d0)) ** 3.0d0))) + (1.0d0 ** 3.0d0)) / ((t_7 * t_7) + ((1.0d0 - (t_9 ** 2.0d0)) / (1.0d0 + t_9)))
end function
public static double code(double x) {
double t_0 = 0.3275911 * Math.abs(x);
double t_1 = t_0 - -1.0;
double t_2 = -1.0 - t_0;
double t_3 = (Math.abs(x) * 0.3275911) - -1.0;
double t_4 = Math.exp((x * x));
double t_5 = Math.abs(x) * -0.3275911;
double t_6 = ((t_5 * t_5) - 1.0) / (t_5 + 1.0);
double t_7 = ((((((((-1.061405429 / t_3) - -1.453152027) / t_3) - 1.421413741) / t_3) - -0.284496736) / t_6) - -0.254829592) / (t_6 * t_4);
double t_8 = -1.061405429 / t_1;
double t_9 = (((-0.284496736 - ((1.421413741 - ((t_8 - -1.453152027) / t_1)) / t_2)) / t_1) - -0.254829592) / (t_2 * t_4);
return ((1.0 / (Math.pow((t_4 * t_6), 3.0) / Math.pow((((-0.284496736 - ((1.421413741 - ((-1.453152027 - t_8) / t_6)) / t_6)) / t_1) - -0.254829592), 3.0))) + Math.pow(1.0, 3.0)) / ((t_7 * t_7) + ((1.0 - Math.pow(t_9, 2.0)) / (1.0 + t_9)));
}
def code(x): t_0 = 0.3275911 * math.fabs(x) t_1 = t_0 - -1.0 t_2 = -1.0 - t_0 t_3 = (math.fabs(x) * 0.3275911) - -1.0 t_4 = math.exp((x * x)) t_5 = math.fabs(x) * -0.3275911 t_6 = ((t_5 * t_5) - 1.0) / (t_5 + 1.0) t_7 = ((((((((-1.061405429 / t_3) - -1.453152027) / t_3) - 1.421413741) / t_3) - -0.284496736) / t_6) - -0.254829592) / (t_6 * t_4) t_8 = -1.061405429 / t_1 t_9 = (((-0.284496736 - ((1.421413741 - ((t_8 - -1.453152027) / t_1)) / t_2)) / t_1) - -0.254829592) / (t_2 * t_4) return ((1.0 / (math.pow((t_4 * t_6), 3.0) / math.pow((((-0.284496736 - ((1.421413741 - ((-1.453152027 - t_8) / t_6)) / t_6)) / t_1) - -0.254829592), 3.0))) + math.pow(1.0, 3.0)) / ((t_7 * t_7) + ((1.0 - math.pow(t_9, 2.0)) / (1.0 + t_9)))
function code(x) t_0 = Float64(0.3275911 * abs(x)) t_1 = Float64(t_0 - -1.0) t_2 = Float64(-1.0 - t_0) t_3 = Float64(Float64(abs(x) * 0.3275911) - -1.0) t_4 = exp(Float64(x * x)) t_5 = Float64(abs(x) * -0.3275911) t_6 = Float64(Float64(Float64(t_5 * t_5) - 1.0) / Float64(t_5 + 1.0)) t_7 = Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(-1.061405429 / t_3) - -1.453152027) / t_3) - 1.421413741) / t_3) - -0.284496736) / t_6) - -0.254829592) / Float64(t_6 * t_4)) t_8 = Float64(-1.061405429 / t_1) t_9 = Float64(Float64(Float64(Float64(-0.284496736 - Float64(Float64(1.421413741 - Float64(Float64(t_8 - -1.453152027) / t_1)) / t_2)) / t_1) - -0.254829592) / Float64(t_2 * t_4)) return Float64(Float64(Float64(1.0 / Float64((Float64(t_4 * t_6) ^ 3.0) / (Float64(Float64(Float64(-0.284496736 - Float64(Float64(1.421413741 - Float64(Float64(-1.453152027 - t_8) / t_6)) / t_6)) / t_1) - -0.254829592) ^ 3.0))) + (1.0 ^ 3.0)) / Float64(Float64(t_7 * t_7) + Float64(Float64(1.0 - (t_9 ^ 2.0)) / Float64(1.0 + t_9)))) end
function tmp = code(x) t_0 = 0.3275911 * abs(x); t_1 = t_0 - -1.0; t_2 = -1.0 - t_0; t_3 = (abs(x) * 0.3275911) - -1.0; t_4 = exp((x * x)); t_5 = abs(x) * -0.3275911; t_6 = ((t_5 * t_5) - 1.0) / (t_5 + 1.0); t_7 = ((((((((-1.061405429 / t_3) - -1.453152027) / t_3) - 1.421413741) / t_3) - -0.284496736) / t_6) - -0.254829592) / (t_6 * t_4); t_8 = -1.061405429 / t_1; t_9 = (((-0.284496736 - ((1.421413741 - ((t_8 - -1.453152027) / t_1)) / t_2)) / t_1) - -0.254829592) / (t_2 * t_4); tmp = ((1.0 / (((t_4 * t_6) ^ 3.0) / ((((-0.284496736 - ((1.421413741 - ((-1.453152027 - t_8) / t_6)) / t_6)) / t_1) - -0.254829592) ^ 3.0))) + (1.0 ^ 3.0)) / ((t_7 * t_7) + ((1.0 - (t_9 ^ 2.0)) / (1.0 + t_9))); end
code[x_] := Block[{t$95$0 = N[(0.3275911 * N[Abs[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 - -1.0), $MachinePrecision]}, Block[{t$95$2 = N[(-1.0 - t$95$0), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[Abs[x], $MachinePrecision] * 0.3275911), $MachinePrecision] - -1.0), $MachinePrecision]}, Block[{t$95$4 = N[Exp[N[(x * x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[(N[Abs[x], $MachinePrecision] * -0.3275911), $MachinePrecision]}, Block[{t$95$6 = N[(N[(N[(t$95$5 * t$95$5), $MachinePrecision] - 1.0), $MachinePrecision] / N[(t$95$5 + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$7 = N[(N[(N[(N[(N[(N[(N[(N[(N[(-1.061405429 / t$95$3), $MachinePrecision] - -1.453152027), $MachinePrecision] / t$95$3), $MachinePrecision] - 1.421413741), $MachinePrecision] / t$95$3), $MachinePrecision] - -0.284496736), $MachinePrecision] / t$95$6), $MachinePrecision] - -0.254829592), $MachinePrecision] / N[(t$95$6 * t$95$4), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$8 = N[(-1.061405429 / t$95$1), $MachinePrecision]}, Block[{t$95$9 = N[(N[(N[(N[(-0.284496736 - N[(N[(1.421413741 - N[(N[(t$95$8 - -1.453152027), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision] - -0.254829592), $MachinePrecision] / N[(t$95$2 * t$95$4), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(1.0 / N[(N[Power[N[(t$95$4 * t$95$6), $MachinePrecision], 3.0], $MachinePrecision] / N[Power[N[(N[(N[(-0.284496736 - N[(N[(1.421413741 - N[(N[(-1.453152027 - t$95$8), $MachinePrecision] / t$95$6), $MachinePrecision]), $MachinePrecision] / t$95$6), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision] - -0.254829592), $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[1.0, 3.0], $MachinePrecision]), $MachinePrecision] / N[(N[(t$95$7 * t$95$7), $MachinePrecision] + N[(N[(1.0 - N[Power[t$95$9, 2.0], $MachinePrecision]), $MachinePrecision] / N[(1.0 + t$95$9), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}
t_0 := 0.3275911 \cdot \left|x\right|\\
t_1 := t\_0 - -1\\
t_2 := -1 - t\_0\\
t_3 := \left|x\right| \cdot 0.3275911 - -1\\
t_4 := e^{x \cdot x}\\
t_5 := \left|x\right| \cdot -0.3275911\\
t_6 := \frac{t\_5 \cdot t\_5 - 1}{t\_5 + 1}\\
t_7 := \frac{\frac{\frac{\frac{\frac{-1.061405429}{t\_3} - -1.453152027}{t\_3} - 1.421413741}{t\_3} - -0.284496736}{t\_6} - -0.254829592}{t\_6 \cdot t\_4}\\
t_8 := \frac{-1.061405429}{t\_1}\\
t_9 := \frac{\frac{-0.284496736 - \frac{1.421413741 - \frac{t\_8 - -1.453152027}{t\_1}}{t\_2}}{t\_1} - -0.254829592}{t\_2 \cdot t\_4}\\
\frac{\frac{1}{\frac{{\left(t\_4 \cdot t\_6\right)}^{3}}{{\left(\frac{-0.284496736 - \frac{1.421413741 - \frac{-1.453152027 - t\_8}{t\_6}}{t\_6}}{t\_1} - -0.254829592\right)}^{3}}} + {1}^{3}}{t\_7 \cdot t\_7 + \frac{1 - {t\_9}^{2}}{1 + t\_9}}
\end{array}
Initial program 79.2%
Applied rewrites79.3%
Applied rewrites80.4%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
metadata-evalN/A
lower-unsound-+.f6480.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.4%
Applied rewrites80.4%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
metadata-evalN/A
lower-unsound-+.f6480.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.4%
Applied rewrites80.4%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
metadata-evalN/A
lower-unsound-+.f6480.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.4%
Applied rewrites80.4%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
metadata-evalN/A
lower-unsound-+.f6480.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.4%
Applied rewrites80.4%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
metadata-evalN/A
lower-unsound-+.f6480.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.4%
Applied rewrites80.4%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
metadata-evalN/A
lower-unsound-+.f6480.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.4%
Applied rewrites80.4%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
metadata-evalN/A
lower-unsound-+.f6480.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.4%
Applied rewrites80.4%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
metadata-evalN/A
lower-unsound-+.f6480.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.4%
Applied rewrites80.4%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
metadata-evalN/A
lower-unsound-+.f6480.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.4%
Applied rewrites80.4%
Applied rewrites80.4%
(FPCore (x)
:precision binary64
(let* ((t_0 (exp (* x x)))
(t_1 (* 0.3275911 (fabs x)))
(t_2 (- -1.0 t_1))
(t_3 (* (fabs x) -0.3275911))
(t_4 (- t_1 -1.0))
(t_5 (- (* (fabs x) 0.3275911) -1.0))
(t_6 (/ (- (* t_3 t_3) 1.0) (+ t_3 1.0)))
(t_7
(/
(-
(/
(-
(/
(-
(/ (- (/ -1.061405429 t_5) -1.453152027) t_5)
1.421413741)
t_5)
-0.284496736)
t_6)
-0.254829592)
(* t_6 t_0))))
(/
(+
(/
1.0
(/
(pow (* t_0 t_6) 3.0)
(pow
(-
(/
(*
(-
(* -0.284496736 t_2)
(-
1.421413741
(/ (- (/ -1.061405429 t_4) -1.453152027) t_4)))
1.0)
(* t_2 t_4))
-0.254829592)
3.0)))
(pow 1.0 3.0))
(+ (* t_7 t_7) (- (* 1.0 1.0) (* t_7 1.0))))))double code(double x) {
double t_0 = exp((x * x));
double t_1 = 0.3275911 * fabs(x);
double t_2 = -1.0 - t_1;
double t_3 = fabs(x) * -0.3275911;
double t_4 = t_1 - -1.0;
double t_5 = (fabs(x) * 0.3275911) - -1.0;
double t_6 = ((t_3 * t_3) - 1.0) / (t_3 + 1.0);
double t_7 = ((((((((-1.061405429 / t_5) - -1.453152027) / t_5) - 1.421413741) / t_5) - -0.284496736) / t_6) - -0.254829592) / (t_6 * t_0);
return ((1.0 / (pow((t_0 * t_6), 3.0) / pow((((((-0.284496736 * t_2) - (1.421413741 - (((-1.061405429 / t_4) - -1.453152027) / t_4))) * 1.0) / (t_2 * t_4)) - -0.254829592), 3.0))) + pow(1.0, 3.0)) / ((t_7 * t_7) + ((1.0 * 1.0) - (t_7 * 1.0)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: t_6
real(8) :: t_7
t_0 = exp((x * x))
t_1 = 0.3275911d0 * abs(x)
t_2 = (-1.0d0) - t_1
t_3 = abs(x) * (-0.3275911d0)
t_4 = t_1 - (-1.0d0)
t_5 = (abs(x) * 0.3275911d0) - (-1.0d0)
t_6 = ((t_3 * t_3) - 1.0d0) / (t_3 + 1.0d0)
t_7 = (((((((((-1.061405429d0) / t_5) - (-1.453152027d0)) / t_5) - 1.421413741d0) / t_5) - (-0.284496736d0)) / t_6) - (-0.254829592d0)) / (t_6 * t_0)
code = ((1.0d0 / (((t_0 * t_6) ** 3.0d0) / (((((((-0.284496736d0) * t_2) - (1.421413741d0 - ((((-1.061405429d0) / t_4) - (-1.453152027d0)) / t_4))) * 1.0d0) / (t_2 * t_4)) - (-0.254829592d0)) ** 3.0d0))) + (1.0d0 ** 3.0d0)) / ((t_7 * t_7) + ((1.0d0 * 1.0d0) - (t_7 * 1.0d0)))
end function
public static double code(double x) {
double t_0 = Math.exp((x * x));
double t_1 = 0.3275911 * Math.abs(x);
double t_2 = -1.0 - t_1;
double t_3 = Math.abs(x) * -0.3275911;
double t_4 = t_1 - -1.0;
double t_5 = (Math.abs(x) * 0.3275911) - -1.0;
double t_6 = ((t_3 * t_3) - 1.0) / (t_3 + 1.0);
double t_7 = ((((((((-1.061405429 / t_5) - -1.453152027) / t_5) - 1.421413741) / t_5) - -0.284496736) / t_6) - -0.254829592) / (t_6 * t_0);
return ((1.0 / (Math.pow((t_0 * t_6), 3.0) / Math.pow((((((-0.284496736 * t_2) - (1.421413741 - (((-1.061405429 / t_4) - -1.453152027) / t_4))) * 1.0) / (t_2 * t_4)) - -0.254829592), 3.0))) + Math.pow(1.0, 3.0)) / ((t_7 * t_7) + ((1.0 * 1.0) - (t_7 * 1.0)));
}
def code(x): t_0 = math.exp((x * x)) t_1 = 0.3275911 * math.fabs(x) t_2 = -1.0 - t_1 t_3 = math.fabs(x) * -0.3275911 t_4 = t_1 - -1.0 t_5 = (math.fabs(x) * 0.3275911) - -1.0 t_6 = ((t_3 * t_3) - 1.0) / (t_3 + 1.0) t_7 = ((((((((-1.061405429 / t_5) - -1.453152027) / t_5) - 1.421413741) / t_5) - -0.284496736) / t_6) - -0.254829592) / (t_6 * t_0) return ((1.0 / (math.pow((t_0 * t_6), 3.0) / math.pow((((((-0.284496736 * t_2) - (1.421413741 - (((-1.061405429 / t_4) - -1.453152027) / t_4))) * 1.0) / (t_2 * t_4)) - -0.254829592), 3.0))) + math.pow(1.0, 3.0)) / ((t_7 * t_7) + ((1.0 * 1.0) - (t_7 * 1.0)))
function code(x) t_0 = exp(Float64(x * x)) t_1 = Float64(0.3275911 * abs(x)) t_2 = Float64(-1.0 - t_1) t_3 = Float64(abs(x) * -0.3275911) t_4 = Float64(t_1 - -1.0) t_5 = Float64(Float64(abs(x) * 0.3275911) - -1.0) t_6 = Float64(Float64(Float64(t_3 * t_3) - 1.0) / Float64(t_3 + 1.0)) t_7 = Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(-1.061405429 / t_5) - -1.453152027) / t_5) - 1.421413741) / t_5) - -0.284496736) / t_6) - -0.254829592) / Float64(t_6 * t_0)) return Float64(Float64(Float64(1.0 / Float64((Float64(t_0 * t_6) ^ 3.0) / (Float64(Float64(Float64(Float64(Float64(-0.284496736 * t_2) - Float64(1.421413741 - Float64(Float64(Float64(-1.061405429 / t_4) - -1.453152027) / t_4))) * 1.0) / Float64(t_2 * t_4)) - -0.254829592) ^ 3.0))) + (1.0 ^ 3.0)) / Float64(Float64(t_7 * t_7) + Float64(Float64(1.0 * 1.0) - Float64(t_7 * 1.0)))) end
function tmp = code(x) t_0 = exp((x * x)); t_1 = 0.3275911 * abs(x); t_2 = -1.0 - t_1; t_3 = abs(x) * -0.3275911; t_4 = t_1 - -1.0; t_5 = (abs(x) * 0.3275911) - -1.0; t_6 = ((t_3 * t_3) - 1.0) / (t_3 + 1.0); t_7 = ((((((((-1.061405429 / t_5) - -1.453152027) / t_5) - 1.421413741) / t_5) - -0.284496736) / t_6) - -0.254829592) / (t_6 * t_0); tmp = ((1.0 / (((t_0 * t_6) ^ 3.0) / ((((((-0.284496736 * t_2) - (1.421413741 - (((-1.061405429 / t_4) - -1.453152027) / t_4))) * 1.0) / (t_2 * t_4)) - -0.254829592) ^ 3.0))) + (1.0 ^ 3.0)) / ((t_7 * t_7) + ((1.0 * 1.0) - (t_7 * 1.0))); end
code[x_] := Block[{t$95$0 = N[Exp[N[(x * x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(0.3275911 * N[Abs[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(-1.0 - t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[Abs[x], $MachinePrecision] * -0.3275911), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$1 - -1.0), $MachinePrecision]}, Block[{t$95$5 = N[(N[(N[Abs[x], $MachinePrecision] * 0.3275911), $MachinePrecision] - -1.0), $MachinePrecision]}, Block[{t$95$6 = N[(N[(N[(t$95$3 * t$95$3), $MachinePrecision] - 1.0), $MachinePrecision] / N[(t$95$3 + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$7 = N[(N[(N[(N[(N[(N[(N[(N[(N[(-1.061405429 / t$95$5), $MachinePrecision] - -1.453152027), $MachinePrecision] / t$95$5), $MachinePrecision] - 1.421413741), $MachinePrecision] / t$95$5), $MachinePrecision] - -0.284496736), $MachinePrecision] / t$95$6), $MachinePrecision] - -0.254829592), $MachinePrecision] / N[(t$95$6 * t$95$0), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(1.0 / N[(N[Power[N[(t$95$0 * t$95$6), $MachinePrecision], 3.0], $MachinePrecision] / N[Power[N[(N[(N[(N[(N[(-0.284496736 * t$95$2), $MachinePrecision] - N[(1.421413741 - N[(N[(N[(-1.061405429 / t$95$4), $MachinePrecision] - -1.453152027), $MachinePrecision] / t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision] / N[(t$95$2 * t$95$4), $MachinePrecision]), $MachinePrecision] - -0.254829592), $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[1.0, 3.0], $MachinePrecision]), $MachinePrecision] / N[(N[(t$95$7 * t$95$7), $MachinePrecision] + N[(N[(1.0 * 1.0), $MachinePrecision] - N[(t$95$7 * 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
t_0 := e^{x \cdot x}\\
t_1 := 0.3275911 \cdot \left|x\right|\\
t_2 := -1 - t\_1\\
t_3 := \left|x\right| \cdot -0.3275911\\
t_4 := t\_1 - -1\\
t_5 := \left|x\right| \cdot 0.3275911 - -1\\
t_6 := \frac{t\_3 \cdot t\_3 - 1}{t\_3 + 1}\\
t_7 := \frac{\frac{\frac{\frac{\frac{-1.061405429}{t\_5} - -1.453152027}{t\_5} - 1.421413741}{t\_5} - -0.284496736}{t\_6} - -0.254829592}{t\_6 \cdot t\_0}\\
\frac{\frac{1}{\frac{{\left(t\_0 \cdot t\_6\right)}^{3}}{{\left(\frac{\left(-0.284496736 \cdot t\_2 - \left(1.421413741 - \frac{\frac{-1.061405429}{t\_4} - -1.453152027}{t\_4}\right)\right) \cdot 1}{t\_2 \cdot t\_4} - -0.254829592\right)}^{3}}} + {1}^{3}}{t\_7 \cdot t\_7 + \left(1 \cdot 1 - t\_7 \cdot 1\right)}
\end{array}
Initial program 79.2%
Applied rewrites79.3%
Applied rewrites80.4%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
metadata-evalN/A
lower-unsound-+.f6480.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.4%
Applied rewrites80.4%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
metadata-evalN/A
lower-unsound-+.f6480.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.4%
Applied rewrites80.4%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
metadata-evalN/A
lower-unsound-+.f6480.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.4%
Applied rewrites80.4%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
metadata-evalN/A
lower-unsound-+.f6480.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.4%
Applied rewrites80.4%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
metadata-evalN/A
lower-unsound-+.f6480.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.4%
Applied rewrites80.4%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
metadata-evalN/A
lower-unsound-+.f6480.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.4%
Applied rewrites80.4%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
metadata-evalN/A
lower-unsound-+.f6480.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.4%
Applied rewrites80.4%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
metadata-evalN/A
lower-unsound-+.f6480.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.4%
Applied rewrites80.4%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
metadata-evalN/A
lower-unsound-+.f6480.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.4%
Applied rewrites80.4%
Applied rewrites80.4%
(FPCore (x)
:precision binary64
(let* ((t_0 (exp (* x x)))
(t_1 (* 0.3275911 (fabs x)))
(t_2 (- t_1 -1.0))
(t_3 (- -1.0 t_1))
(t_4 (* (fabs x) -0.3275911))
(t_5 (/ (- (* t_4 t_4) 1.0) (+ t_4 1.0)))
(t_6 (/ -1.061405429 t_2))
(t_7
(/
(-
(/
(-
-0.284496736
(/ (- 1.421413741 (/ (- t_6 -1.453152027) t_2)) t_3))
t_2)
-0.254829592)
(* t_3 t_0))))
(/
(+
(/
1.0
(/
(pow (* t_0 t_5) 3.0)
(pow
(-
(/
(-
-0.284496736
(/ (- 1.421413741 (/ (- -1.453152027 t_6) t_5)) t_5))
t_2)
-0.254829592)
3.0)))
(pow 1.0 3.0))
(- (+ (pow t_7 2.0) 1.0) t_7))))double code(double x) {
double t_0 = exp((x * x));
double t_1 = 0.3275911 * fabs(x);
double t_2 = t_1 - -1.0;
double t_3 = -1.0 - t_1;
double t_4 = fabs(x) * -0.3275911;
double t_5 = ((t_4 * t_4) - 1.0) / (t_4 + 1.0);
double t_6 = -1.061405429 / t_2;
double t_7 = (((-0.284496736 - ((1.421413741 - ((t_6 - -1.453152027) / t_2)) / t_3)) / t_2) - -0.254829592) / (t_3 * t_0);
return ((1.0 / (pow((t_0 * t_5), 3.0) / pow((((-0.284496736 - ((1.421413741 - ((-1.453152027 - t_6) / t_5)) / t_5)) / t_2) - -0.254829592), 3.0))) + pow(1.0, 3.0)) / ((pow(t_7, 2.0) + 1.0) - t_7);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: t_6
real(8) :: t_7
t_0 = exp((x * x))
t_1 = 0.3275911d0 * abs(x)
t_2 = t_1 - (-1.0d0)
t_3 = (-1.0d0) - t_1
t_4 = abs(x) * (-0.3275911d0)
t_5 = ((t_4 * t_4) - 1.0d0) / (t_4 + 1.0d0)
t_6 = (-1.061405429d0) / t_2
t_7 = ((((-0.284496736d0) - ((1.421413741d0 - ((t_6 - (-1.453152027d0)) / t_2)) / t_3)) / t_2) - (-0.254829592d0)) / (t_3 * t_0)
code = ((1.0d0 / (((t_0 * t_5) ** 3.0d0) / (((((-0.284496736d0) - ((1.421413741d0 - (((-1.453152027d0) - t_6) / t_5)) / t_5)) / t_2) - (-0.254829592d0)) ** 3.0d0))) + (1.0d0 ** 3.0d0)) / (((t_7 ** 2.0d0) + 1.0d0) - t_7)
end function
public static double code(double x) {
double t_0 = Math.exp((x * x));
double t_1 = 0.3275911 * Math.abs(x);
double t_2 = t_1 - -1.0;
double t_3 = -1.0 - t_1;
double t_4 = Math.abs(x) * -0.3275911;
double t_5 = ((t_4 * t_4) - 1.0) / (t_4 + 1.0);
double t_6 = -1.061405429 / t_2;
double t_7 = (((-0.284496736 - ((1.421413741 - ((t_6 - -1.453152027) / t_2)) / t_3)) / t_2) - -0.254829592) / (t_3 * t_0);
return ((1.0 / (Math.pow((t_0 * t_5), 3.0) / Math.pow((((-0.284496736 - ((1.421413741 - ((-1.453152027 - t_6) / t_5)) / t_5)) / t_2) - -0.254829592), 3.0))) + Math.pow(1.0, 3.0)) / ((Math.pow(t_7, 2.0) + 1.0) - t_7);
}
def code(x): t_0 = math.exp((x * x)) t_1 = 0.3275911 * math.fabs(x) t_2 = t_1 - -1.0 t_3 = -1.0 - t_1 t_4 = math.fabs(x) * -0.3275911 t_5 = ((t_4 * t_4) - 1.0) / (t_4 + 1.0) t_6 = -1.061405429 / t_2 t_7 = (((-0.284496736 - ((1.421413741 - ((t_6 - -1.453152027) / t_2)) / t_3)) / t_2) - -0.254829592) / (t_3 * t_0) return ((1.0 / (math.pow((t_0 * t_5), 3.0) / math.pow((((-0.284496736 - ((1.421413741 - ((-1.453152027 - t_6) / t_5)) / t_5)) / t_2) - -0.254829592), 3.0))) + math.pow(1.0, 3.0)) / ((math.pow(t_7, 2.0) + 1.0) - t_7)
function code(x) t_0 = exp(Float64(x * x)) t_1 = Float64(0.3275911 * abs(x)) t_2 = Float64(t_1 - -1.0) t_3 = Float64(-1.0 - t_1) t_4 = Float64(abs(x) * -0.3275911) t_5 = Float64(Float64(Float64(t_4 * t_4) - 1.0) / Float64(t_4 + 1.0)) t_6 = Float64(-1.061405429 / t_2) t_7 = Float64(Float64(Float64(Float64(-0.284496736 - Float64(Float64(1.421413741 - Float64(Float64(t_6 - -1.453152027) / t_2)) / t_3)) / t_2) - -0.254829592) / Float64(t_3 * t_0)) return Float64(Float64(Float64(1.0 / Float64((Float64(t_0 * t_5) ^ 3.0) / (Float64(Float64(Float64(-0.284496736 - Float64(Float64(1.421413741 - Float64(Float64(-1.453152027 - t_6) / t_5)) / t_5)) / t_2) - -0.254829592) ^ 3.0))) + (1.0 ^ 3.0)) / Float64(Float64((t_7 ^ 2.0) + 1.0) - t_7)) end
function tmp = code(x) t_0 = exp((x * x)); t_1 = 0.3275911 * abs(x); t_2 = t_1 - -1.0; t_3 = -1.0 - t_1; t_4 = abs(x) * -0.3275911; t_5 = ((t_4 * t_4) - 1.0) / (t_4 + 1.0); t_6 = -1.061405429 / t_2; t_7 = (((-0.284496736 - ((1.421413741 - ((t_6 - -1.453152027) / t_2)) / t_3)) / t_2) - -0.254829592) / (t_3 * t_0); tmp = ((1.0 / (((t_0 * t_5) ^ 3.0) / ((((-0.284496736 - ((1.421413741 - ((-1.453152027 - t_6) / t_5)) / t_5)) / t_2) - -0.254829592) ^ 3.0))) + (1.0 ^ 3.0)) / (((t_7 ^ 2.0) + 1.0) - t_7); end
code[x_] := Block[{t$95$0 = N[Exp[N[(x * x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(0.3275911 * N[Abs[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 - -1.0), $MachinePrecision]}, Block[{t$95$3 = N[(-1.0 - t$95$1), $MachinePrecision]}, Block[{t$95$4 = N[(N[Abs[x], $MachinePrecision] * -0.3275911), $MachinePrecision]}, Block[{t$95$5 = N[(N[(N[(t$95$4 * t$95$4), $MachinePrecision] - 1.0), $MachinePrecision] / N[(t$95$4 + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(-1.061405429 / t$95$2), $MachinePrecision]}, Block[{t$95$7 = N[(N[(N[(N[(-0.284496736 - N[(N[(1.421413741 - N[(N[(t$95$6 - -1.453152027), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision] / t$95$3), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision] - -0.254829592), $MachinePrecision] / N[(t$95$3 * t$95$0), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(1.0 / N[(N[Power[N[(t$95$0 * t$95$5), $MachinePrecision], 3.0], $MachinePrecision] / N[Power[N[(N[(N[(-0.284496736 - N[(N[(1.421413741 - N[(N[(-1.453152027 - t$95$6), $MachinePrecision] / t$95$5), $MachinePrecision]), $MachinePrecision] / t$95$5), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision] - -0.254829592), $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[1.0, 3.0], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Power[t$95$7, 2.0], $MachinePrecision] + 1.0), $MachinePrecision] - t$95$7), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
t_0 := e^{x \cdot x}\\
t_1 := 0.3275911 \cdot \left|x\right|\\
t_2 := t\_1 - -1\\
t_3 := -1 - t\_1\\
t_4 := \left|x\right| \cdot -0.3275911\\
t_5 := \frac{t\_4 \cdot t\_4 - 1}{t\_4 + 1}\\
t_6 := \frac{-1.061405429}{t\_2}\\
t_7 := \frac{\frac{-0.284496736 - \frac{1.421413741 - \frac{t\_6 - -1.453152027}{t\_2}}{t\_3}}{t\_2} - -0.254829592}{t\_3 \cdot t\_0}\\
\frac{\frac{1}{\frac{{\left(t\_0 \cdot t\_5\right)}^{3}}{{\left(\frac{-0.284496736 - \frac{1.421413741 - \frac{-1.453152027 - t\_6}{t\_5}}{t\_5}}{t\_2} - -0.254829592\right)}^{3}}} + {1}^{3}}{\left({t\_7}^{2} + 1\right) - t\_7}
\end{array}
Initial program 79.2%
Applied rewrites79.3%
Applied rewrites80.4%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
metadata-evalN/A
lower-unsound-+.f6480.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.4%
Applied rewrites80.4%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
metadata-evalN/A
lower-unsound-+.f6480.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.4%
Applied rewrites80.4%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
metadata-evalN/A
lower-unsound-+.f6480.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.4%
Applied rewrites80.4%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
metadata-evalN/A
lower-unsound-+.f6480.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.4%
Applied rewrites80.4%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
metadata-evalN/A
lower-unsound-+.f6480.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.4%
Applied rewrites80.4%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
metadata-evalN/A
lower-unsound-+.f6480.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.4%
Applied rewrites80.4%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
metadata-evalN/A
lower-unsound-+.f6480.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.4%
Applied rewrites80.4%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
metadata-evalN/A
lower-unsound-+.f6480.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.4%
Applied rewrites80.4%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
metadata-evalN/A
lower-unsound-+.f6480.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.4%
Applied rewrites80.4%
Applied rewrites80.4%
(FPCore (x)
:precision binary64
(let* ((t_0 (- (* (fabs x) -0.3275911) 1.0))
(t_1 (exp (* x x)))
(t_2 (- (* -0.3275911 (fabs x)) 1.0))
(t_3 (* 0.3275911 (fabs x)))
(t_4 (- t_3 -1.0))
(t_5
(/
(-
(/
(-
(/
(-
(/ (- (/ 1.061405429 t_0) -1.453152027) t_4)
1.421413741)
t_4)
-0.284496736)
(- -1.0 t_3))
-0.254829592)
(* t_0 t_1))))
(/
(+
(/
1.0
(/
(pow (* t_1 t_2) 3.0)
(pow
(-
(/
(-
-0.284496736
(/
(-
1.421413741
(/ (- -1.453152027 (/ -1.061405429 t_4)) t_2))
t_2))
t_4)
-0.254829592)
3.0)))
(pow 1.0 3.0))
(- (+ (pow t_5 2.0) 1.0) t_5))))double code(double x) {
double t_0 = (fabs(x) * -0.3275911) - 1.0;
double t_1 = exp((x * x));
double t_2 = (-0.3275911 * fabs(x)) - 1.0;
double t_3 = 0.3275911 * fabs(x);
double t_4 = t_3 - -1.0;
double t_5 = ((((((((1.061405429 / t_0) - -1.453152027) / t_4) - 1.421413741) / t_4) - -0.284496736) / (-1.0 - t_3)) - -0.254829592) / (t_0 * t_1);
return ((1.0 / (pow((t_1 * t_2), 3.0) / pow((((-0.284496736 - ((1.421413741 - ((-1.453152027 - (-1.061405429 / t_4)) / t_2)) / t_2)) / t_4) - -0.254829592), 3.0))) + pow(1.0, 3.0)) / ((pow(t_5, 2.0) + 1.0) - t_5);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
t_0 = (abs(x) * (-0.3275911d0)) - 1.0d0
t_1 = exp((x * x))
t_2 = ((-0.3275911d0) * abs(x)) - 1.0d0
t_3 = 0.3275911d0 * abs(x)
t_4 = t_3 - (-1.0d0)
t_5 = ((((((((1.061405429d0 / t_0) - (-1.453152027d0)) / t_4) - 1.421413741d0) / t_4) - (-0.284496736d0)) / ((-1.0d0) - t_3)) - (-0.254829592d0)) / (t_0 * t_1)
code = ((1.0d0 / (((t_1 * t_2) ** 3.0d0) / (((((-0.284496736d0) - ((1.421413741d0 - (((-1.453152027d0) - ((-1.061405429d0) / t_4)) / t_2)) / t_2)) / t_4) - (-0.254829592d0)) ** 3.0d0))) + (1.0d0 ** 3.0d0)) / (((t_5 ** 2.0d0) + 1.0d0) - t_5)
end function
public static double code(double x) {
double t_0 = (Math.abs(x) * -0.3275911) - 1.0;
double t_1 = Math.exp((x * x));
double t_2 = (-0.3275911 * Math.abs(x)) - 1.0;
double t_3 = 0.3275911 * Math.abs(x);
double t_4 = t_3 - -1.0;
double t_5 = ((((((((1.061405429 / t_0) - -1.453152027) / t_4) - 1.421413741) / t_4) - -0.284496736) / (-1.0 - t_3)) - -0.254829592) / (t_0 * t_1);
return ((1.0 / (Math.pow((t_1 * t_2), 3.0) / Math.pow((((-0.284496736 - ((1.421413741 - ((-1.453152027 - (-1.061405429 / t_4)) / t_2)) / t_2)) / t_4) - -0.254829592), 3.0))) + Math.pow(1.0, 3.0)) / ((Math.pow(t_5, 2.0) + 1.0) - t_5);
}
def code(x): t_0 = (math.fabs(x) * -0.3275911) - 1.0 t_1 = math.exp((x * x)) t_2 = (-0.3275911 * math.fabs(x)) - 1.0 t_3 = 0.3275911 * math.fabs(x) t_4 = t_3 - -1.0 t_5 = ((((((((1.061405429 / t_0) - -1.453152027) / t_4) - 1.421413741) / t_4) - -0.284496736) / (-1.0 - t_3)) - -0.254829592) / (t_0 * t_1) return ((1.0 / (math.pow((t_1 * t_2), 3.0) / math.pow((((-0.284496736 - ((1.421413741 - ((-1.453152027 - (-1.061405429 / t_4)) / t_2)) / t_2)) / t_4) - -0.254829592), 3.0))) + math.pow(1.0, 3.0)) / ((math.pow(t_5, 2.0) + 1.0) - t_5)
function code(x) t_0 = Float64(Float64(abs(x) * -0.3275911) - 1.0) t_1 = exp(Float64(x * x)) t_2 = Float64(Float64(-0.3275911 * abs(x)) - 1.0) t_3 = Float64(0.3275911 * abs(x)) t_4 = Float64(t_3 - -1.0) t_5 = Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(1.061405429 / t_0) - -1.453152027) / t_4) - 1.421413741) / t_4) - -0.284496736) / Float64(-1.0 - t_3)) - -0.254829592) / Float64(t_0 * t_1)) return Float64(Float64(Float64(1.0 / Float64((Float64(t_1 * t_2) ^ 3.0) / (Float64(Float64(Float64(-0.284496736 - Float64(Float64(1.421413741 - Float64(Float64(-1.453152027 - Float64(-1.061405429 / t_4)) / t_2)) / t_2)) / t_4) - -0.254829592) ^ 3.0))) + (1.0 ^ 3.0)) / Float64(Float64((t_5 ^ 2.0) + 1.0) - t_5)) end
function tmp = code(x) t_0 = (abs(x) * -0.3275911) - 1.0; t_1 = exp((x * x)); t_2 = (-0.3275911 * abs(x)) - 1.0; t_3 = 0.3275911 * abs(x); t_4 = t_3 - -1.0; t_5 = ((((((((1.061405429 / t_0) - -1.453152027) / t_4) - 1.421413741) / t_4) - -0.284496736) / (-1.0 - t_3)) - -0.254829592) / (t_0 * t_1); tmp = ((1.0 / (((t_1 * t_2) ^ 3.0) / ((((-0.284496736 - ((1.421413741 - ((-1.453152027 - (-1.061405429 / t_4)) / t_2)) / t_2)) / t_4) - -0.254829592) ^ 3.0))) + (1.0 ^ 3.0)) / (((t_5 ^ 2.0) + 1.0) - t_5); end
code[x_] := Block[{t$95$0 = N[(N[(N[Abs[x], $MachinePrecision] * -0.3275911), $MachinePrecision] - 1.0), $MachinePrecision]}, Block[{t$95$1 = N[Exp[N[(x * x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(-0.3275911 * N[Abs[x], $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]}, Block[{t$95$3 = N[(0.3275911 * N[Abs[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 - -1.0), $MachinePrecision]}, Block[{t$95$5 = N[(N[(N[(N[(N[(N[(N[(N[(N[(1.061405429 / t$95$0), $MachinePrecision] - -1.453152027), $MachinePrecision] / t$95$4), $MachinePrecision] - 1.421413741), $MachinePrecision] / t$95$4), $MachinePrecision] - -0.284496736), $MachinePrecision] / N[(-1.0 - t$95$3), $MachinePrecision]), $MachinePrecision] - -0.254829592), $MachinePrecision] / N[(t$95$0 * t$95$1), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(1.0 / N[(N[Power[N[(t$95$1 * t$95$2), $MachinePrecision], 3.0], $MachinePrecision] / N[Power[N[(N[(N[(-0.284496736 - N[(N[(1.421413741 - N[(N[(-1.453152027 - N[(-1.061405429 / t$95$4), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision] / t$95$4), $MachinePrecision] - -0.254829592), $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[1.0, 3.0], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Power[t$95$5, 2.0], $MachinePrecision] + 1.0), $MachinePrecision] - t$95$5), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
t_0 := \left|x\right| \cdot -0.3275911 - 1\\
t_1 := e^{x \cdot x}\\
t_2 := -0.3275911 \cdot \left|x\right| - 1\\
t_3 := 0.3275911 \cdot \left|x\right|\\
t_4 := t\_3 - -1\\
t_5 := \frac{\frac{\frac{\frac{\frac{1.061405429}{t\_0} - -1.453152027}{t\_4} - 1.421413741}{t\_4} - -0.284496736}{-1 - t\_3} - -0.254829592}{t\_0 \cdot t\_1}\\
\frac{\frac{1}{\frac{{\left(t\_1 \cdot t\_2\right)}^{3}}{{\left(\frac{-0.284496736 - \frac{1.421413741 - \frac{-1.453152027 - \frac{-1.061405429}{t\_4}}{t\_2}}{t\_2}}{t\_4} - -0.254829592\right)}^{3}}} + {1}^{3}}{\left({t\_5}^{2} + 1\right) - t\_5}
\end{array}
Initial program 79.2%
Applied rewrites79.3%
Applied rewrites80.4%
Applied rewrites80.4%
(FPCore (x)
:precision binary64
(let* ((t_0 (* -0.3275911 (fabs x)))
(t_1 (- t_0 1.0))
(t_2 (* 0.3275911 (fabs x)))
(t_3 (- t_2 -1.0))
(t_4 (- -1.0 t_2))
(t_5 (- (* (fabs x) 0.3275911) -1.0))
(t_6
(/
(-
(/
(-
(/
(-
(/ (- (/ -1.061405429 t_5) -1.453152027) t_5)
1.421413741)
t_5)
-0.284496736)
t_1)
-0.254829592)
(* t_1 (exp (* x x))))))
(/
(+
(/
1.0
(/
1.0
(pow
(/
(-
(/
(-
-0.284496736
(/
(-
1.421413741
(/ (- (/ -1.061405429 t_3) -1.453152027) t_3))
t_4))
t_3)
-0.254829592)
(- (+ (* t_4 (* x x)) t_0) 1.0))
3.0)))
(pow 1.0 3.0))
(+ (* t_6 t_6) (- (* 1.0 1.0) (* t_6 1.0))))))double code(double x) {
double t_0 = -0.3275911 * fabs(x);
double t_1 = t_0 - 1.0;
double t_2 = 0.3275911 * fabs(x);
double t_3 = t_2 - -1.0;
double t_4 = -1.0 - t_2;
double t_5 = (fabs(x) * 0.3275911) - -1.0;
double t_6 = ((((((((-1.061405429 / t_5) - -1.453152027) / t_5) - 1.421413741) / t_5) - -0.284496736) / t_1) - -0.254829592) / (t_1 * exp((x * x)));
return ((1.0 / (1.0 / pow(((((-0.284496736 - ((1.421413741 - (((-1.061405429 / t_3) - -1.453152027) / t_3)) / t_4)) / t_3) - -0.254829592) / (((t_4 * (x * x)) + t_0) - 1.0)), 3.0))) + pow(1.0, 3.0)) / ((t_6 * t_6) + ((1.0 * 1.0) - (t_6 * 1.0)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: t_6
t_0 = (-0.3275911d0) * abs(x)
t_1 = t_0 - 1.0d0
t_2 = 0.3275911d0 * abs(x)
t_3 = t_2 - (-1.0d0)
t_4 = (-1.0d0) - t_2
t_5 = (abs(x) * 0.3275911d0) - (-1.0d0)
t_6 = (((((((((-1.061405429d0) / t_5) - (-1.453152027d0)) / t_5) - 1.421413741d0) / t_5) - (-0.284496736d0)) / t_1) - (-0.254829592d0)) / (t_1 * exp((x * x)))
code = ((1.0d0 / (1.0d0 / ((((((-0.284496736d0) - ((1.421413741d0 - ((((-1.061405429d0) / t_3) - (-1.453152027d0)) / t_3)) / t_4)) / t_3) - (-0.254829592d0)) / (((t_4 * (x * x)) + t_0) - 1.0d0)) ** 3.0d0))) + (1.0d0 ** 3.0d0)) / ((t_6 * t_6) + ((1.0d0 * 1.0d0) - (t_6 * 1.0d0)))
end function
public static double code(double x) {
double t_0 = -0.3275911 * Math.abs(x);
double t_1 = t_0 - 1.0;
double t_2 = 0.3275911 * Math.abs(x);
double t_3 = t_2 - -1.0;
double t_4 = -1.0 - t_2;
double t_5 = (Math.abs(x) * 0.3275911) - -1.0;
double t_6 = ((((((((-1.061405429 / t_5) - -1.453152027) / t_5) - 1.421413741) / t_5) - -0.284496736) / t_1) - -0.254829592) / (t_1 * Math.exp((x * x)));
return ((1.0 / (1.0 / Math.pow(((((-0.284496736 - ((1.421413741 - (((-1.061405429 / t_3) - -1.453152027) / t_3)) / t_4)) / t_3) - -0.254829592) / (((t_4 * (x * x)) + t_0) - 1.0)), 3.0))) + Math.pow(1.0, 3.0)) / ((t_6 * t_6) + ((1.0 * 1.0) - (t_6 * 1.0)));
}
def code(x): t_0 = -0.3275911 * math.fabs(x) t_1 = t_0 - 1.0 t_2 = 0.3275911 * math.fabs(x) t_3 = t_2 - -1.0 t_4 = -1.0 - t_2 t_5 = (math.fabs(x) * 0.3275911) - -1.0 t_6 = ((((((((-1.061405429 / t_5) - -1.453152027) / t_5) - 1.421413741) / t_5) - -0.284496736) / t_1) - -0.254829592) / (t_1 * math.exp((x * x))) return ((1.0 / (1.0 / math.pow(((((-0.284496736 - ((1.421413741 - (((-1.061405429 / t_3) - -1.453152027) / t_3)) / t_4)) / t_3) - -0.254829592) / (((t_4 * (x * x)) + t_0) - 1.0)), 3.0))) + math.pow(1.0, 3.0)) / ((t_6 * t_6) + ((1.0 * 1.0) - (t_6 * 1.0)))
function code(x) t_0 = Float64(-0.3275911 * abs(x)) t_1 = Float64(t_0 - 1.0) t_2 = Float64(0.3275911 * abs(x)) t_3 = Float64(t_2 - -1.0) t_4 = Float64(-1.0 - t_2) t_5 = Float64(Float64(abs(x) * 0.3275911) - -1.0) t_6 = Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(-1.061405429 / t_5) - -1.453152027) / t_5) - 1.421413741) / t_5) - -0.284496736) / t_1) - -0.254829592) / Float64(t_1 * exp(Float64(x * x)))) return Float64(Float64(Float64(1.0 / Float64(1.0 / (Float64(Float64(Float64(Float64(-0.284496736 - Float64(Float64(1.421413741 - Float64(Float64(Float64(-1.061405429 / t_3) - -1.453152027) / t_3)) / t_4)) / t_3) - -0.254829592) / Float64(Float64(Float64(t_4 * Float64(x * x)) + t_0) - 1.0)) ^ 3.0))) + (1.0 ^ 3.0)) / Float64(Float64(t_6 * t_6) + Float64(Float64(1.0 * 1.0) - Float64(t_6 * 1.0)))) end
function tmp = code(x) t_0 = -0.3275911 * abs(x); t_1 = t_0 - 1.0; t_2 = 0.3275911 * abs(x); t_3 = t_2 - -1.0; t_4 = -1.0 - t_2; t_5 = (abs(x) * 0.3275911) - -1.0; t_6 = ((((((((-1.061405429 / t_5) - -1.453152027) / t_5) - 1.421413741) / t_5) - -0.284496736) / t_1) - -0.254829592) / (t_1 * exp((x * x))); tmp = ((1.0 / (1.0 / (((((-0.284496736 - ((1.421413741 - (((-1.061405429 / t_3) - -1.453152027) / t_3)) / t_4)) / t_3) - -0.254829592) / (((t_4 * (x * x)) + t_0) - 1.0)) ^ 3.0))) + (1.0 ^ 3.0)) / ((t_6 * t_6) + ((1.0 * 1.0) - (t_6 * 1.0))); end
code[x_] := Block[{t$95$0 = N[(-0.3275911 * N[Abs[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 - 1.0), $MachinePrecision]}, Block[{t$95$2 = N[(0.3275911 * N[Abs[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 - -1.0), $MachinePrecision]}, Block[{t$95$4 = N[(-1.0 - t$95$2), $MachinePrecision]}, Block[{t$95$5 = N[(N[(N[Abs[x], $MachinePrecision] * 0.3275911), $MachinePrecision] - -1.0), $MachinePrecision]}, Block[{t$95$6 = N[(N[(N[(N[(N[(N[(N[(N[(N[(-1.061405429 / t$95$5), $MachinePrecision] - -1.453152027), $MachinePrecision] / t$95$5), $MachinePrecision] - 1.421413741), $MachinePrecision] / t$95$5), $MachinePrecision] - -0.284496736), $MachinePrecision] / t$95$1), $MachinePrecision] - -0.254829592), $MachinePrecision] / N[(t$95$1 * N[Exp[N[(x * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(1.0 / N[(1.0 / N[Power[N[(N[(N[(N[(-0.284496736 - N[(N[(1.421413741 - N[(N[(N[(-1.061405429 / t$95$3), $MachinePrecision] - -1.453152027), $MachinePrecision] / t$95$3), $MachinePrecision]), $MachinePrecision] / t$95$4), $MachinePrecision]), $MachinePrecision] / t$95$3), $MachinePrecision] - -0.254829592), $MachinePrecision] / N[(N[(N[(t$95$4 * N[(x * x), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[1.0, 3.0], $MachinePrecision]), $MachinePrecision] / N[(N[(t$95$6 * t$95$6), $MachinePrecision] + N[(N[(1.0 * 1.0), $MachinePrecision] - N[(t$95$6 * 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
t_0 := -0.3275911 \cdot \left|x\right|\\
t_1 := t\_0 - 1\\
t_2 := 0.3275911 \cdot \left|x\right|\\
t_3 := t\_2 - -1\\
t_4 := -1 - t\_2\\
t_5 := \left|x\right| \cdot 0.3275911 - -1\\
t_6 := \frac{\frac{\frac{\frac{\frac{-1.061405429}{t\_5} - -1.453152027}{t\_5} - 1.421413741}{t\_5} - -0.284496736}{t\_1} - -0.254829592}{t\_1 \cdot e^{x \cdot x}}\\
\frac{\frac{1}{\frac{1}{{\left(\frac{\frac{-0.284496736 - \frac{1.421413741 - \frac{\frac{-1.061405429}{t\_3} - -1.453152027}{t\_3}}{t\_4}}{t\_3} - -0.254829592}{\left(t\_4 \cdot \left(x \cdot x\right) + t\_0\right) - 1}\right)}^{3}}} + {1}^{3}}{t\_6 \cdot t\_6 + \left(1 \cdot 1 - t\_6 \cdot 1\right)}
\end{array}
Initial program 79.2%
Applied rewrites79.3%
Applied rewrites80.4%
Taylor expanded in x around 0
lower--.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-fabs.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-fabs.f6480.0%
Applied rewrites80.0%
Applied rewrites80.0%
(FPCore (x)
:precision binary64
(let* ((t_0 (- (* (fabs x) 0.3275911) -1.0))
(t_1
(/
(- (* (* x x) 0.10731592879921) 1.0)
(- (* 0.3275911 (fabs x)) 1.0))))
(-
1.0
(/
(-
(/
(-
(/
(-
(* (- (/ -1.061405429 t_1) -1.453152027) (/ 1.0 t_1))
1.421413741)
t_0)
-0.284496736)
(- (* -0.3275911 (fabs x)) 1.0))
-0.254829592)
(* t_0 (exp (* x x)))))))double code(double x) {
double t_0 = (fabs(x) * 0.3275911) - -1.0;
double t_1 = (((x * x) * 0.10731592879921) - 1.0) / ((0.3275911 * fabs(x)) - 1.0);
return 1.0 - (((((((((-1.061405429 / t_1) - -1.453152027) * (1.0 / t_1)) - 1.421413741) / t_0) - -0.284496736) / ((-0.3275911 * fabs(x)) - 1.0)) - -0.254829592) / (t_0 * exp((x * x))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: t_1
t_0 = (abs(x) * 0.3275911d0) - (-1.0d0)
t_1 = (((x * x) * 0.10731592879921d0) - 1.0d0) / ((0.3275911d0 * abs(x)) - 1.0d0)
code = 1.0d0 - ((((((((((-1.061405429d0) / t_1) - (-1.453152027d0)) * (1.0d0 / t_1)) - 1.421413741d0) / t_0) - (-0.284496736d0)) / (((-0.3275911d0) * abs(x)) - 1.0d0)) - (-0.254829592d0)) / (t_0 * exp((x * x))))
end function
public static double code(double x) {
double t_0 = (Math.abs(x) * 0.3275911) - -1.0;
double t_1 = (((x * x) * 0.10731592879921) - 1.0) / ((0.3275911 * Math.abs(x)) - 1.0);
return 1.0 - (((((((((-1.061405429 / t_1) - -1.453152027) * (1.0 / t_1)) - 1.421413741) / t_0) - -0.284496736) / ((-0.3275911 * Math.abs(x)) - 1.0)) - -0.254829592) / (t_0 * Math.exp((x * x))));
}
def code(x): t_0 = (math.fabs(x) * 0.3275911) - -1.0 t_1 = (((x * x) * 0.10731592879921) - 1.0) / ((0.3275911 * math.fabs(x)) - 1.0) return 1.0 - (((((((((-1.061405429 / t_1) - -1.453152027) * (1.0 / t_1)) - 1.421413741) / t_0) - -0.284496736) / ((-0.3275911 * math.fabs(x)) - 1.0)) - -0.254829592) / (t_0 * math.exp((x * x))))
function code(x) t_0 = Float64(Float64(abs(x) * 0.3275911) - -1.0) t_1 = Float64(Float64(Float64(Float64(x * x) * 0.10731592879921) - 1.0) / Float64(Float64(0.3275911 * abs(x)) - 1.0)) return Float64(1.0 - Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(-1.061405429 / t_1) - -1.453152027) * Float64(1.0 / t_1)) - 1.421413741) / t_0) - -0.284496736) / Float64(Float64(-0.3275911 * abs(x)) - 1.0)) - -0.254829592) / Float64(t_0 * exp(Float64(x * x))))) end
function tmp = code(x) t_0 = (abs(x) * 0.3275911) - -1.0; t_1 = (((x * x) * 0.10731592879921) - 1.0) / ((0.3275911 * abs(x)) - 1.0); tmp = 1.0 - (((((((((-1.061405429 / t_1) - -1.453152027) * (1.0 / t_1)) - 1.421413741) / t_0) - -0.284496736) / ((-0.3275911 * abs(x)) - 1.0)) - -0.254829592) / (t_0 * exp((x * x)))); end
code[x_] := Block[{t$95$0 = N[(N[(N[Abs[x], $MachinePrecision] * 0.3275911), $MachinePrecision] - -1.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(N[(x * x), $MachinePrecision] * 0.10731592879921), $MachinePrecision] - 1.0), $MachinePrecision] / N[(N[(0.3275911 * N[Abs[x], $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]}, N[(1.0 - N[(N[(N[(N[(N[(N[(N[(N[(N[(-1.061405429 / t$95$1), $MachinePrecision] - -1.453152027), $MachinePrecision] * N[(1.0 / t$95$1), $MachinePrecision]), $MachinePrecision] - 1.421413741), $MachinePrecision] / t$95$0), $MachinePrecision] - -0.284496736), $MachinePrecision] / N[(N[(-0.3275911 * N[Abs[x], $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision] - -0.254829592), $MachinePrecision] / N[(t$95$0 * N[Exp[N[(x * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \left|x\right| \cdot 0.3275911 - -1\\
t_1 := \frac{\left(x \cdot x\right) \cdot 0.10731592879921 - 1}{0.3275911 \cdot \left|x\right| - 1}\\
1 - \frac{\frac{\frac{\left(\frac{-1.061405429}{t\_1} - -1.453152027\right) \cdot \frac{1}{t\_1} - 1.421413741}{t\_0} - -0.284496736}{-0.3275911 \cdot \left|x\right| - 1} - -0.254829592}{t\_0 \cdot e^{x \cdot x}}
\end{array}
Initial program 79.2%
Applied rewrites79.2%
lift-/.f64N/A
mult-flipN/A
lift-/.f64N/A
lift--.f64N/A
sub-flipN/A
metadata-evalN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-+.f64N/A
lower-*.f6479.2%
lift-*.f64N/A
*-commutativeN/A
lift-*.f6479.2%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
Applied rewrites79.2%
lift--.f64N/A
sub-flipN/A
metadata-evalN/A
flip-+N/A
lower-unsound-/.f64N/A
Applied rewrites79.2%
lift--.f64N/A
sub-flipN/A
metadata-evalN/A
flip-+N/A
lower-unsound-/.f64N/A
Applied rewrites79.2%
(FPCore (x)
:precision binary64
(let* ((t_0 (- (* -0.3275911 (fabs x)) 1.0))
(t_1 (* 0.3275911 (fabs x))))
(-
1.0
(*
(*
(/ 1.0 (+ 1.0 t_1))
(+
0.254829592
(-
(/ -0.284496736 (- (* (fabs x) 0.3275911) -1.0))
(/
1.0
(/
(* t_0 t_0)
(-
(/ (- -1.453152027 (/ -1.061405429 (- t_1 -1.0))) t_0)
1.421413741))))))
(exp (- (* (fabs x) (fabs x))))))))double code(double x) {
double t_0 = (-0.3275911 * fabs(x)) - 1.0;
double t_1 = 0.3275911 * fabs(x);
return 1.0 - (((1.0 / (1.0 + t_1)) * (0.254829592 + ((-0.284496736 / ((fabs(x) * 0.3275911) - -1.0)) - (1.0 / ((t_0 * t_0) / (((-1.453152027 - (-1.061405429 / (t_1 - -1.0))) / t_0) - 1.421413741)))))) * exp(-(fabs(x) * fabs(x))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: t_1
t_0 = ((-0.3275911d0) * abs(x)) - 1.0d0
t_1 = 0.3275911d0 * abs(x)
code = 1.0d0 - (((1.0d0 / (1.0d0 + t_1)) * (0.254829592d0 + (((-0.284496736d0) / ((abs(x) * 0.3275911d0) - (-1.0d0))) - (1.0d0 / ((t_0 * t_0) / ((((-1.453152027d0) - ((-1.061405429d0) / (t_1 - (-1.0d0)))) / t_0) - 1.421413741d0)))))) * exp(-(abs(x) * abs(x))))
end function
public static double code(double x) {
double t_0 = (-0.3275911 * Math.abs(x)) - 1.0;
double t_1 = 0.3275911 * Math.abs(x);
return 1.0 - (((1.0 / (1.0 + t_1)) * (0.254829592 + ((-0.284496736 / ((Math.abs(x) * 0.3275911) - -1.0)) - (1.0 / ((t_0 * t_0) / (((-1.453152027 - (-1.061405429 / (t_1 - -1.0))) / t_0) - 1.421413741)))))) * Math.exp(-(Math.abs(x) * Math.abs(x))));
}
def code(x): t_0 = (-0.3275911 * math.fabs(x)) - 1.0 t_1 = 0.3275911 * math.fabs(x) return 1.0 - (((1.0 / (1.0 + t_1)) * (0.254829592 + ((-0.284496736 / ((math.fabs(x) * 0.3275911) - -1.0)) - (1.0 / ((t_0 * t_0) / (((-1.453152027 - (-1.061405429 / (t_1 - -1.0))) / t_0) - 1.421413741)))))) * math.exp(-(math.fabs(x) * math.fabs(x))))
function code(x) t_0 = Float64(Float64(-0.3275911 * abs(x)) - 1.0) t_1 = Float64(0.3275911 * abs(x)) return Float64(1.0 - Float64(Float64(Float64(1.0 / Float64(1.0 + t_1)) * Float64(0.254829592 + Float64(Float64(-0.284496736 / Float64(Float64(abs(x) * 0.3275911) - -1.0)) - Float64(1.0 / Float64(Float64(t_0 * t_0) / Float64(Float64(Float64(-1.453152027 - Float64(-1.061405429 / Float64(t_1 - -1.0))) / t_0) - 1.421413741)))))) * exp(Float64(-Float64(abs(x) * abs(x)))))) end
function tmp = code(x) t_0 = (-0.3275911 * abs(x)) - 1.0; t_1 = 0.3275911 * abs(x); tmp = 1.0 - (((1.0 / (1.0 + t_1)) * (0.254829592 + ((-0.284496736 / ((abs(x) * 0.3275911) - -1.0)) - (1.0 / ((t_0 * t_0) / (((-1.453152027 - (-1.061405429 / (t_1 - -1.0))) / t_0) - 1.421413741)))))) * exp(-(abs(x) * abs(x)))); end
code[x_] := Block[{t$95$0 = N[(N[(-0.3275911 * N[Abs[x], $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]}, Block[{t$95$1 = N[(0.3275911 * N[Abs[x], $MachinePrecision]), $MachinePrecision]}, N[(1.0 - N[(N[(N[(1.0 / N[(1.0 + t$95$1), $MachinePrecision]), $MachinePrecision] * N[(0.254829592 + N[(N[(-0.284496736 / N[(N[(N[Abs[x], $MachinePrecision] * 0.3275911), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] - N[(1.0 / N[(N[(t$95$0 * t$95$0), $MachinePrecision] / N[(N[(N[(-1.453152027 - N[(-1.061405429 / N[(t$95$1 - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision] - 1.421413741), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[Abs[x], $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := -0.3275911 \cdot \left|x\right| - 1\\
t_1 := 0.3275911 \cdot \left|x\right|\\
1 - \left(\frac{1}{1 + t\_1} \cdot \left(0.254829592 + \left(\frac{-0.284496736}{\left|x\right| \cdot 0.3275911 - -1} - \frac{1}{\frac{t\_0 \cdot t\_0}{\frac{-1.453152027 - \frac{-1.061405429}{t\_1 - -1}}{t\_0} - 1.421413741}}\right)\right)\right) \cdot e^{-\left|x\right| \cdot \left|x\right|}
\end{array}
Initial program 79.2%
Applied rewrites79.2%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lift-*.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6479.2%
Applied rewrites79.2%
(FPCore (x)
:precision binary64
(let* ((t_0 (- (* (fabs x) 0.3275911) -1.0))
(t_1 (- (* 0.3275911 (fabs x)) -1.0)))
(-
1.0
(/
(-
(/
(-
(/
(-
(* (- (/ -1.061405429 t_1) -1.453152027) (/ 1.0 t_1))
1.421413741)
t_0)
-0.284496736)
(- (* -0.3275911 (fabs x)) 1.0))
-0.254829592)
(* t_0 (exp (* x x)))))))double code(double x) {
double t_0 = (fabs(x) * 0.3275911) - -1.0;
double t_1 = (0.3275911 * fabs(x)) - -1.0;
return 1.0 - (((((((((-1.061405429 / t_1) - -1.453152027) * (1.0 / t_1)) - 1.421413741) / t_0) - -0.284496736) / ((-0.3275911 * fabs(x)) - 1.0)) - -0.254829592) / (t_0 * exp((x * x))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: t_1
t_0 = (abs(x) * 0.3275911d0) - (-1.0d0)
t_1 = (0.3275911d0 * abs(x)) - (-1.0d0)
code = 1.0d0 - ((((((((((-1.061405429d0) / t_1) - (-1.453152027d0)) * (1.0d0 / t_1)) - 1.421413741d0) / t_0) - (-0.284496736d0)) / (((-0.3275911d0) * abs(x)) - 1.0d0)) - (-0.254829592d0)) / (t_0 * exp((x * x))))
end function
public static double code(double x) {
double t_0 = (Math.abs(x) * 0.3275911) - -1.0;
double t_1 = (0.3275911 * Math.abs(x)) - -1.0;
return 1.0 - (((((((((-1.061405429 / t_1) - -1.453152027) * (1.0 / t_1)) - 1.421413741) / t_0) - -0.284496736) / ((-0.3275911 * Math.abs(x)) - 1.0)) - -0.254829592) / (t_0 * Math.exp((x * x))));
}
def code(x): t_0 = (math.fabs(x) * 0.3275911) - -1.0 t_1 = (0.3275911 * math.fabs(x)) - -1.0 return 1.0 - (((((((((-1.061405429 / t_1) - -1.453152027) * (1.0 / t_1)) - 1.421413741) / t_0) - -0.284496736) / ((-0.3275911 * math.fabs(x)) - 1.0)) - -0.254829592) / (t_0 * math.exp((x * x))))
function code(x) t_0 = Float64(Float64(abs(x) * 0.3275911) - -1.0) t_1 = Float64(Float64(0.3275911 * abs(x)) - -1.0) return Float64(1.0 - Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(-1.061405429 / t_1) - -1.453152027) * Float64(1.0 / t_1)) - 1.421413741) / t_0) - -0.284496736) / Float64(Float64(-0.3275911 * abs(x)) - 1.0)) - -0.254829592) / Float64(t_0 * exp(Float64(x * x))))) end
function tmp = code(x) t_0 = (abs(x) * 0.3275911) - -1.0; t_1 = (0.3275911 * abs(x)) - -1.0; tmp = 1.0 - (((((((((-1.061405429 / t_1) - -1.453152027) * (1.0 / t_1)) - 1.421413741) / t_0) - -0.284496736) / ((-0.3275911 * abs(x)) - 1.0)) - -0.254829592) / (t_0 * exp((x * x)))); end
code[x_] := Block[{t$95$0 = N[(N[(N[Abs[x], $MachinePrecision] * 0.3275911), $MachinePrecision] - -1.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[(0.3275911 * N[Abs[x], $MachinePrecision]), $MachinePrecision] - -1.0), $MachinePrecision]}, N[(1.0 - N[(N[(N[(N[(N[(N[(N[(N[(N[(-1.061405429 / t$95$1), $MachinePrecision] - -1.453152027), $MachinePrecision] * N[(1.0 / t$95$1), $MachinePrecision]), $MachinePrecision] - 1.421413741), $MachinePrecision] / t$95$0), $MachinePrecision] - -0.284496736), $MachinePrecision] / N[(N[(-0.3275911 * N[Abs[x], $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision] - -0.254829592), $MachinePrecision] / N[(t$95$0 * N[Exp[N[(x * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \left|x\right| \cdot 0.3275911 - -1\\
t_1 := 0.3275911 \cdot \left|x\right| - -1\\
1 - \frac{\frac{\frac{\left(\frac{-1.061405429}{t\_1} - -1.453152027\right) \cdot \frac{1}{t\_1} - 1.421413741}{t\_0} - -0.284496736}{-0.3275911 \cdot \left|x\right| - 1} - -0.254829592}{t\_0 \cdot e^{x \cdot x}}
\end{array}
Initial program 79.2%
Applied rewrites79.2%
lift-/.f64N/A
mult-flipN/A
lift-/.f64N/A
lift--.f64N/A
sub-flipN/A
metadata-evalN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-+.f64N/A
lower-*.f6479.2%
lift-*.f64N/A
*-commutativeN/A
lift-*.f6479.2%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
Applied rewrites79.2%
(FPCore (x)
:precision binary64
(let* ((t_0 (- (* (fabs x) 0.3275911) -1.0)))
(-
1.0
(/
(*
(exp (* (- x) x))
(-
(/
(-
(/
(- (/ (- (/ -1.061405429 t_0) -1.453152027) t_0) 1.421413741)
t_0)
-0.284496736)
(- (* -0.3275911 (fabs x)) 1.0))
-0.254829592))
t_0))))double code(double x) {
double t_0 = (fabs(x) * 0.3275911) - -1.0;
return 1.0 - ((exp((-x * x)) * ((((((((-1.061405429 / t_0) - -1.453152027) / t_0) - 1.421413741) / t_0) - -0.284496736) / ((-0.3275911 * fabs(x)) - 1.0)) - -0.254829592)) / t_0);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8) :: t_0
t_0 = (abs(x) * 0.3275911d0) - (-1.0d0)
code = 1.0d0 - ((exp((-x * x)) * (((((((((-1.061405429d0) / t_0) - (-1.453152027d0)) / t_0) - 1.421413741d0) / t_0) - (-0.284496736d0)) / (((-0.3275911d0) * abs(x)) - 1.0d0)) - (-0.254829592d0))) / t_0)
end function
public static double code(double x) {
double t_0 = (Math.abs(x) * 0.3275911) - -1.0;
return 1.0 - ((Math.exp((-x * x)) * ((((((((-1.061405429 / t_0) - -1.453152027) / t_0) - 1.421413741) / t_0) - -0.284496736) / ((-0.3275911 * Math.abs(x)) - 1.0)) - -0.254829592)) / t_0);
}
def code(x): t_0 = (math.fabs(x) * 0.3275911) - -1.0 return 1.0 - ((math.exp((-x * x)) * ((((((((-1.061405429 / t_0) - -1.453152027) / t_0) - 1.421413741) / t_0) - -0.284496736) / ((-0.3275911 * math.fabs(x)) - 1.0)) - -0.254829592)) / t_0)
function code(x) t_0 = Float64(Float64(abs(x) * 0.3275911) - -1.0) return Float64(1.0 - Float64(Float64(exp(Float64(Float64(-x) * x)) * Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(-1.061405429 / t_0) - -1.453152027) / t_0) - 1.421413741) / t_0) - -0.284496736) / Float64(Float64(-0.3275911 * abs(x)) - 1.0)) - -0.254829592)) / t_0)) end
function tmp = code(x) t_0 = (abs(x) * 0.3275911) - -1.0; tmp = 1.0 - ((exp((-x * x)) * ((((((((-1.061405429 / t_0) - -1.453152027) / t_0) - 1.421413741) / t_0) - -0.284496736) / ((-0.3275911 * abs(x)) - 1.0)) - -0.254829592)) / t_0); end
code[x_] := Block[{t$95$0 = N[(N[(N[Abs[x], $MachinePrecision] * 0.3275911), $MachinePrecision] - -1.0), $MachinePrecision]}, N[(1.0 - N[(N[(N[Exp[N[((-x) * x), $MachinePrecision]], $MachinePrecision] * N[(N[(N[(N[(N[(N[(N[(N[(-1.061405429 / t$95$0), $MachinePrecision] - -1.453152027), $MachinePrecision] / t$95$0), $MachinePrecision] - 1.421413741), $MachinePrecision] / t$95$0), $MachinePrecision] - -0.284496736), $MachinePrecision] / N[(N[(-0.3275911 * N[Abs[x], $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision] - -0.254829592), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_0 := \left|x\right| \cdot 0.3275911 - -1\\
1 - \frac{e^{\left(-x\right) \cdot x} \cdot \left(\frac{\frac{\frac{\frac{-1.061405429}{t\_0} - -1.453152027}{t\_0} - 1.421413741}{t\_0} - -0.284496736}{-0.3275911 \cdot \left|x\right| - 1} - -0.254829592\right)}{t\_0}
\end{array}
Initial program 79.2%
Applied rewrites79.2%
(FPCore (x)
:precision binary64
(let* ((t_0 (- (* (fabs x) 0.3275911) -1.0)))
(-
1.0
(/
(-
(/
(-
(/
(- (/ (- (/ -1.061405429 t_0) -1.453152027) t_0) 1.421413741)
t_0)
-0.284496736)
(- (* -0.3275911 (fabs x)) 1.0))
-0.254829592)
(* t_0 (exp (* x x)))))))double code(double x) {
double t_0 = (fabs(x) * 0.3275911) - -1.0;
return 1.0 - (((((((((-1.061405429 / t_0) - -1.453152027) / t_0) - 1.421413741) / t_0) - -0.284496736) / ((-0.3275911 * fabs(x)) - 1.0)) - -0.254829592) / (t_0 * exp((x * x))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8) :: t_0
t_0 = (abs(x) * 0.3275911d0) - (-1.0d0)
code = 1.0d0 - ((((((((((-1.061405429d0) / t_0) - (-1.453152027d0)) / t_0) - 1.421413741d0) / t_0) - (-0.284496736d0)) / (((-0.3275911d0) * abs(x)) - 1.0d0)) - (-0.254829592d0)) / (t_0 * exp((x * x))))
end function
public static double code(double x) {
double t_0 = (Math.abs(x) * 0.3275911) - -1.0;
return 1.0 - (((((((((-1.061405429 / t_0) - -1.453152027) / t_0) - 1.421413741) / t_0) - -0.284496736) / ((-0.3275911 * Math.abs(x)) - 1.0)) - -0.254829592) / (t_0 * Math.exp((x * x))));
}
def code(x): t_0 = (math.fabs(x) * 0.3275911) - -1.0 return 1.0 - (((((((((-1.061405429 / t_0) - -1.453152027) / t_0) - 1.421413741) / t_0) - -0.284496736) / ((-0.3275911 * math.fabs(x)) - 1.0)) - -0.254829592) / (t_0 * math.exp((x * x))))
function code(x) t_0 = Float64(Float64(abs(x) * 0.3275911) - -1.0) return Float64(1.0 - Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(-1.061405429 / t_0) - -1.453152027) / t_0) - 1.421413741) / t_0) - -0.284496736) / Float64(Float64(-0.3275911 * abs(x)) - 1.0)) - -0.254829592) / Float64(t_0 * exp(Float64(x * x))))) end
function tmp = code(x) t_0 = (abs(x) * 0.3275911) - -1.0; tmp = 1.0 - (((((((((-1.061405429 / t_0) - -1.453152027) / t_0) - 1.421413741) / t_0) - -0.284496736) / ((-0.3275911 * abs(x)) - 1.0)) - -0.254829592) / (t_0 * exp((x * x)))); end
code[x_] := Block[{t$95$0 = N[(N[(N[Abs[x], $MachinePrecision] * 0.3275911), $MachinePrecision] - -1.0), $MachinePrecision]}, N[(1.0 - N[(N[(N[(N[(N[(N[(N[(N[(N[(-1.061405429 / t$95$0), $MachinePrecision] - -1.453152027), $MachinePrecision] / t$95$0), $MachinePrecision] - 1.421413741), $MachinePrecision] / t$95$0), $MachinePrecision] - -0.284496736), $MachinePrecision] / N[(N[(-0.3275911 * N[Abs[x], $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision] - -0.254829592), $MachinePrecision] / N[(t$95$0 * N[Exp[N[(x * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_0 := \left|x\right| \cdot 0.3275911 - -1\\
1 - \frac{\frac{\frac{\frac{\frac{-1.061405429}{t\_0} - -1.453152027}{t\_0} - 1.421413741}{t\_0} - -0.284496736}{-0.3275911 \cdot \left|x\right| - 1} - -0.254829592}{t\_0 \cdot e^{x \cdot x}}
\end{array}
Initial program 79.2%
Applied rewrites79.2%
(FPCore (x)
:precision binary64
(let* ((t_0 (- (* (fabs x) 0.3275911) -1.0)))
(-
1.0
(/
(-
(/
(-
(/
(- (/ (- (/ -1.061405429 t_0) -1.453152027) t_0) 1.421413741)
t_0)
-0.284496736)
(- (* -0.3275911 (fabs x)) 1.0))
-0.254829592)
(* t_0 (+ 1.0 (pow x 2.0)))))))double code(double x) {
double t_0 = (fabs(x) * 0.3275911) - -1.0;
return 1.0 - (((((((((-1.061405429 / t_0) - -1.453152027) / t_0) - 1.421413741) / t_0) - -0.284496736) / ((-0.3275911 * fabs(x)) - 1.0)) - -0.254829592) / (t_0 * (1.0 + pow(x, 2.0))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8) :: t_0
t_0 = (abs(x) * 0.3275911d0) - (-1.0d0)
code = 1.0d0 - ((((((((((-1.061405429d0) / t_0) - (-1.453152027d0)) / t_0) - 1.421413741d0) / t_0) - (-0.284496736d0)) / (((-0.3275911d0) * abs(x)) - 1.0d0)) - (-0.254829592d0)) / (t_0 * (1.0d0 + (x ** 2.0d0))))
end function
public static double code(double x) {
double t_0 = (Math.abs(x) * 0.3275911) - -1.0;
return 1.0 - (((((((((-1.061405429 / t_0) - -1.453152027) / t_0) - 1.421413741) / t_0) - -0.284496736) / ((-0.3275911 * Math.abs(x)) - 1.0)) - -0.254829592) / (t_0 * (1.0 + Math.pow(x, 2.0))));
}
def code(x): t_0 = (math.fabs(x) * 0.3275911) - -1.0 return 1.0 - (((((((((-1.061405429 / t_0) - -1.453152027) / t_0) - 1.421413741) / t_0) - -0.284496736) / ((-0.3275911 * math.fabs(x)) - 1.0)) - -0.254829592) / (t_0 * (1.0 + math.pow(x, 2.0))))
function code(x) t_0 = Float64(Float64(abs(x) * 0.3275911) - -1.0) return Float64(1.0 - Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(-1.061405429 / t_0) - -1.453152027) / t_0) - 1.421413741) / t_0) - -0.284496736) / Float64(Float64(-0.3275911 * abs(x)) - 1.0)) - -0.254829592) / Float64(t_0 * Float64(1.0 + (x ^ 2.0))))) end
function tmp = code(x) t_0 = (abs(x) * 0.3275911) - -1.0; tmp = 1.0 - (((((((((-1.061405429 / t_0) - -1.453152027) / t_0) - 1.421413741) / t_0) - -0.284496736) / ((-0.3275911 * abs(x)) - 1.0)) - -0.254829592) / (t_0 * (1.0 + (x ^ 2.0)))); end
code[x_] := Block[{t$95$0 = N[(N[(N[Abs[x], $MachinePrecision] * 0.3275911), $MachinePrecision] - -1.0), $MachinePrecision]}, N[(1.0 - N[(N[(N[(N[(N[(N[(N[(N[(N[(-1.061405429 / t$95$0), $MachinePrecision] - -1.453152027), $MachinePrecision] / t$95$0), $MachinePrecision] - 1.421413741), $MachinePrecision] / t$95$0), $MachinePrecision] - -0.284496736), $MachinePrecision] / N[(N[(-0.3275911 * N[Abs[x], $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision] - -0.254829592), $MachinePrecision] / N[(t$95$0 * N[(1.0 + N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_0 := \left|x\right| \cdot 0.3275911 - -1\\
1 - \frac{\frac{\frac{\frac{\frac{-1.061405429}{t\_0} - -1.453152027}{t\_0} - 1.421413741}{t\_0} - -0.284496736}{-0.3275911 \cdot \left|x\right| - 1} - -0.254829592}{t\_0 \cdot \left(1 + {x}^{2}\right)}
\end{array}
Initial program 79.2%
Applied rewrites79.2%
Taylor expanded in x around 0
lower-+.f64N/A
lower-pow.f6478.6%
Applied rewrites78.6%
(FPCore (x)
:precision binary64
(let* ((t_0 (* (fabs x) -0.3275911))
(t_1 (- (* (fabs x) 0.3275911) -1.0)))
(-
1.0
(/
(-
(/
(-
(/
(- (/ (- (/ -1.061405429 t_1) -1.453152027) t_1) 1.421413741)
t_1)
-0.284496736)
(/ (- (* t_0 t_0) 1.0) (+ t_0 1.0)))
-0.254829592)
(* t_1 1.0)))))double code(double x) {
double t_0 = fabs(x) * -0.3275911;
double t_1 = (fabs(x) * 0.3275911) - -1.0;
return 1.0 - (((((((((-1.061405429 / t_1) - -1.453152027) / t_1) - 1.421413741) / t_1) - -0.284496736) / (((t_0 * t_0) - 1.0) / (t_0 + 1.0))) - -0.254829592) / (t_1 * 1.0));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: t_1
t_0 = abs(x) * (-0.3275911d0)
t_1 = (abs(x) * 0.3275911d0) - (-1.0d0)
code = 1.0d0 - ((((((((((-1.061405429d0) / t_1) - (-1.453152027d0)) / t_1) - 1.421413741d0) / t_1) - (-0.284496736d0)) / (((t_0 * t_0) - 1.0d0) / (t_0 + 1.0d0))) - (-0.254829592d0)) / (t_1 * 1.0d0))
end function
public static double code(double x) {
double t_0 = Math.abs(x) * -0.3275911;
double t_1 = (Math.abs(x) * 0.3275911) - -1.0;
return 1.0 - (((((((((-1.061405429 / t_1) - -1.453152027) / t_1) - 1.421413741) / t_1) - -0.284496736) / (((t_0 * t_0) - 1.0) / (t_0 + 1.0))) - -0.254829592) / (t_1 * 1.0));
}
def code(x): t_0 = math.fabs(x) * -0.3275911 t_1 = (math.fabs(x) * 0.3275911) - -1.0 return 1.0 - (((((((((-1.061405429 / t_1) - -1.453152027) / t_1) - 1.421413741) / t_1) - -0.284496736) / (((t_0 * t_0) - 1.0) / (t_0 + 1.0))) - -0.254829592) / (t_1 * 1.0))
function code(x) t_0 = Float64(abs(x) * -0.3275911) t_1 = Float64(Float64(abs(x) * 0.3275911) - -1.0) return Float64(1.0 - Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(-1.061405429 / t_1) - -1.453152027) / t_1) - 1.421413741) / t_1) - -0.284496736) / Float64(Float64(Float64(t_0 * t_0) - 1.0) / Float64(t_0 + 1.0))) - -0.254829592) / Float64(t_1 * 1.0))) end
function tmp = code(x) t_0 = abs(x) * -0.3275911; t_1 = (abs(x) * 0.3275911) - -1.0; tmp = 1.0 - (((((((((-1.061405429 / t_1) - -1.453152027) / t_1) - 1.421413741) / t_1) - -0.284496736) / (((t_0 * t_0) - 1.0) / (t_0 + 1.0))) - -0.254829592) / (t_1 * 1.0)); end
code[x_] := Block[{t$95$0 = N[(N[Abs[x], $MachinePrecision] * -0.3275911), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Abs[x], $MachinePrecision] * 0.3275911), $MachinePrecision] - -1.0), $MachinePrecision]}, N[(1.0 - N[(N[(N[(N[(N[(N[(N[(N[(N[(-1.061405429 / t$95$1), $MachinePrecision] - -1.453152027), $MachinePrecision] / t$95$1), $MachinePrecision] - 1.421413741), $MachinePrecision] / t$95$1), $MachinePrecision] - -0.284496736), $MachinePrecision] / N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] - 1.0), $MachinePrecision] / N[(t$95$0 + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - -0.254829592), $MachinePrecision] / N[(t$95$1 * 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \left|x\right| \cdot -0.3275911\\
t_1 := \left|x\right| \cdot 0.3275911 - -1\\
1 - \frac{\frac{\frac{\frac{\frac{-1.061405429}{t\_1} - -1.453152027}{t\_1} - 1.421413741}{t\_1} - -0.284496736}{\frac{t\_0 \cdot t\_0 - 1}{t\_0 + 1}} - -0.254829592}{t\_1 \cdot 1}
\end{array}
Initial program 79.2%
Applied rewrites79.2%
Taylor expanded in x around 0
Applied rewrites77.7%
lift--.f64N/A
flip--N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
metadata-evalN/A
lower-unsound-+.f6477.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6477.7%
Applied rewrites77.7%
(FPCore (x)
:precision binary64
(let* ((t_0 (* 0.3275911 (fabs x)))
(t_1 (- t_0 -1.0))
(t_2 (* t_1 1.0)))
(/
(-
(* 1.0 t_2)
(-
(/
(-
(/
(-
(/
(-
(/ 1.061405429 (- (* (fabs x) -0.3275911) 1.0))
-1.453152027)
t_1)
1.421413741)
t_1)
-0.284496736)
(- -1.0 t_0))
-0.254829592))
t_2)))double code(double x) {
double t_0 = 0.3275911 * fabs(x);
double t_1 = t_0 - -1.0;
double t_2 = t_1 * 1.0;
return ((1.0 * t_2) - ((((((((1.061405429 / ((fabs(x) * -0.3275911) - 1.0)) - -1.453152027) / t_1) - 1.421413741) / t_1) - -0.284496736) / (-1.0 - t_0)) - -0.254829592)) / t_2;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
t_0 = 0.3275911d0 * abs(x)
t_1 = t_0 - (-1.0d0)
t_2 = t_1 * 1.0d0
code = ((1.0d0 * t_2) - ((((((((1.061405429d0 / ((abs(x) * (-0.3275911d0)) - 1.0d0)) - (-1.453152027d0)) / t_1) - 1.421413741d0) / t_1) - (-0.284496736d0)) / ((-1.0d0) - t_0)) - (-0.254829592d0))) / t_2
end function
public static double code(double x) {
double t_0 = 0.3275911 * Math.abs(x);
double t_1 = t_0 - -1.0;
double t_2 = t_1 * 1.0;
return ((1.0 * t_2) - ((((((((1.061405429 / ((Math.abs(x) * -0.3275911) - 1.0)) - -1.453152027) / t_1) - 1.421413741) / t_1) - -0.284496736) / (-1.0 - t_0)) - -0.254829592)) / t_2;
}
def code(x): t_0 = 0.3275911 * math.fabs(x) t_1 = t_0 - -1.0 t_2 = t_1 * 1.0 return ((1.0 * t_2) - ((((((((1.061405429 / ((math.fabs(x) * -0.3275911) - 1.0)) - -1.453152027) / t_1) - 1.421413741) / t_1) - -0.284496736) / (-1.0 - t_0)) - -0.254829592)) / t_2
function code(x) t_0 = Float64(0.3275911 * abs(x)) t_1 = Float64(t_0 - -1.0) t_2 = Float64(t_1 * 1.0) return Float64(Float64(Float64(1.0 * t_2) - Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(1.061405429 / Float64(Float64(abs(x) * -0.3275911) - 1.0)) - -1.453152027) / t_1) - 1.421413741) / t_1) - -0.284496736) / Float64(-1.0 - t_0)) - -0.254829592)) / t_2) end
function tmp = code(x) t_0 = 0.3275911 * abs(x); t_1 = t_0 - -1.0; t_2 = t_1 * 1.0; tmp = ((1.0 * t_2) - ((((((((1.061405429 / ((abs(x) * -0.3275911) - 1.0)) - -1.453152027) / t_1) - 1.421413741) / t_1) - -0.284496736) / (-1.0 - t_0)) - -0.254829592)) / t_2; end
code[x_] := Block[{t$95$0 = N[(0.3275911 * N[Abs[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 - -1.0), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * 1.0), $MachinePrecision]}, N[(N[(N[(1.0 * t$95$2), $MachinePrecision] - N[(N[(N[(N[(N[(N[(N[(N[(1.061405429 / N[(N[(N[Abs[x], $MachinePrecision] * -0.3275911), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision] - -1.453152027), $MachinePrecision] / t$95$1), $MachinePrecision] - 1.421413741), $MachinePrecision] / t$95$1), $MachinePrecision] - -0.284496736), $MachinePrecision] / N[(-1.0 - t$95$0), $MachinePrecision]), $MachinePrecision] - -0.254829592), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision]]]]
\begin{array}{l}
t_0 := 0.3275911 \cdot \left|x\right|\\
t_1 := t\_0 - -1\\
t_2 := t\_1 \cdot 1\\
\frac{1 \cdot t\_2 - \left(\frac{\frac{\frac{\frac{1.061405429}{\left|x\right| \cdot -0.3275911 - 1} - -1.453152027}{t\_1} - 1.421413741}{t\_1} - -0.284496736}{-1 - t\_0} - -0.254829592\right)}{t\_2}
\end{array}
Initial program 79.2%
Applied rewrites79.2%
Taylor expanded in x around 0
Applied rewrites77.7%
Applied rewrites77.7%
(FPCore (x)
:precision binary64
(let* ((t_0 (- (* (fabs x) 0.3275911) -1.0)))
(-
1.0
(/
(-
(/
(-
(/
(- (/ (- (/ -1.061405429 t_0) -1.453152027) t_0) 1.421413741)
t_0)
-0.284496736)
(- (* -0.3275911 (fabs x)) 1.0))
-0.254829592)
(* t_0 1.0)))))double code(double x) {
double t_0 = (fabs(x) * 0.3275911) - -1.0;
return 1.0 - (((((((((-1.061405429 / t_0) - -1.453152027) / t_0) - 1.421413741) / t_0) - -0.284496736) / ((-0.3275911 * fabs(x)) - 1.0)) - -0.254829592) / (t_0 * 1.0));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8) :: t_0
t_0 = (abs(x) * 0.3275911d0) - (-1.0d0)
code = 1.0d0 - ((((((((((-1.061405429d0) / t_0) - (-1.453152027d0)) / t_0) - 1.421413741d0) / t_0) - (-0.284496736d0)) / (((-0.3275911d0) * abs(x)) - 1.0d0)) - (-0.254829592d0)) / (t_0 * 1.0d0))
end function
public static double code(double x) {
double t_0 = (Math.abs(x) * 0.3275911) - -1.0;
return 1.0 - (((((((((-1.061405429 / t_0) - -1.453152027) / t_0) - 1.421413741) / t_0) - -0.284496736) / ((-0.3275911 * Math.abs(x)) - 1.0)) - -0.254829592) / (t_0 * 1.0));
}
def code(x): t_0 = (math.fabs(x) * 0.3275911) - -1.0 return 1.0 - (((((((((-1.061405429 / t_0) - -1.453152027) / t_0) - 1.421413741) / t_0) - -0.284496736) / ((-0.3275911 * math.fabs(x)) - 1.0)) - -0.254829592) / (t_0 * 1.0))
function code(x) t_0 = Float64(Float64(abs(x) * 0.3275911) - -1.0) return Float64(1.0 - Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(-1.061405429 / t_0) - -1.453152027) / t_0) - 1.421413741) / t_0) - -0.284496736) / Float64(Float64(-0.3275911 * abs(x)) - 1.0)) - -0.254829592) / Float64(t_0 * 1.0))) end
function tmp = code(x) t_0 = (abs(x) * 0.3275911) - -1.0; tmp = 1.0 - (((((((((-1.061405429 / t_0) - -1.453152027) / t_0) - 1.421413741) / t_0) - -0.284496736) / ((-0.3275911 * abs(x)) - 1.0)) - -0.254829592) / (t_0 * 1.0)); end
code[x_] := Block[{t$95$0 = N[(N[(N[Abs[x], $MachinePrecision] * 0.3275911), $MachinePrecision] - -1.0), $MachinePrecision]}, N[(1.0 - N[(N[(N[(N[(N[(N[(N[(N[(N[(-1.061405429 / t$95$0), $MachinePrecision] - -1.453152027), $MachinePrecision] / t$95$0), $MachinePrecision] - 1.421413741), $MachinePrecision] / t$95$0), $MachinePrecision] - -0.284496736), $MachinePrecision] / N[(N[(-0.3275911 * N[Abs[x], $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision] - -0.254829592), $MachinePrecision] / N[(t$95$0 * 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_0 := \left|x\right| \cdot 0.3275911 - -1\\
1 - \frac{\frac{\frac{\frac{\frac{-1.061405429}{t\_0} - -1.453152027}{t\_0} - 1.421413741}{t\_0} - -0.284496736}{-0.3275911 \cdot \left|x\right| - 1} - -0.254829592}{t\_0 \cdot 1}
\end{array}
Initial program 79.2%
Applied rewrites79.2%
Taylor expanded in x around 0
Applied rewrites77.7%
herbie shell --seed 2025258
(FPCore (x)
:name "Jmat.Real.erf"
:precision binary64
(- 1.0 (* (* (/ 1.0 (+ 1.0 (* 0.3275911 (fabs x)))) (+ 0.254829592 (* (/ 1.0 (+ 1.0 (* 0.3275911 (fabs x)))) (+ -0.284496736 (* (/ 1.0 (+ 1.0 (* 0.3275911 (fabs x)))) (+ 1.421413741 (* (/ 1.0 (+ 1.0 (* 0.3275911 (fabs x)))) (+ -1.453152027 (* (/ 1.0 (+ 1.0 (* 0.3275911 (fabs x)))) 1.061405429))))))))) (exp (- (* (fabs x) (fabs x)))))))