
(FPCore (x y z t) :precision binary64 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (exp (/ (* t t) 2.0))))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * exp(((t * t) / 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * Math.exp(((t * t) / 2.0));
}
def code(x, y, z, t): return (((x * 0.5) - y) * math.sqrt((z * 2.0))) * math.exp(((t * t) / 2.0))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * exp(Float64(Float64(t * t) / 2.0))) end
function tmp = code(x, y, z, t) tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (exp (/ (* t t) 2.0))))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * exp(((t * t) / 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * Math.exp(((t * t) / 2.0));
}
def code(x, y, z, t): return (((x * 0.5) - y) * math.sqrt((z * 2.0))) * math.exp(((t * t) / 2.0))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * exp(Float64(Float64(t * t) / 2.0))) end
function tmp = code(x, y, z, t) tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}}
\end{array}
(FPCore (x y z t) :precision binary64 (* (- (* 0.5 x) y) (sqrt (* z (* 2.0 (exp (* t t)))))))
double code(double x, double y, double z, double t) {
return ((0.5 * x) - y) * sqrt((z * (2.0 * exp((t * t)))));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((0.5d0 * x) - y) * sqrt((z * (2.0d0 * exp((t * t)))))
end function
public static double code(double x, double y, double z, double t) {
return ((0.5 * x) - y) * Math.sqrt((z * (2.0 * Math.exp((t * t)))));
}
def code(x, y, z, t): return ((0.5 * x) - y) * math.sqrt((z * (2.0 * math.exp((t * t)))))
function code(x, y, z, t) return Float64(Float64(Float64(0.5 * x) - y) * sqrt(Float64(z * Float64(2.0 * exp(Float64(t * t)))))) end
function tmp = code(x, y, z, t) tmp = ((0.5 * x) - y) * sqrt((z * (2.0 * exp((t * t))))); end
code[x_, y_, z_, t_] := N[(N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * N[(2.0 * N[Exp[N[(t * t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot x - y\right) \cdot \sqrt{z \cdot \left(2 \cdot e^{t \cdot t}\right)}
\end{array}
Initial program 99.0%
*-commutative99.0%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
exp-sqrt99.8%
associate-*r*99.0%
*-commutative99.0%
expm1-log1p-u58.4%
expm1-udef46.0%
Applied egg-rr46.4%
expm1-def58.8%
expm1-log1p99.8%
fma-neg99.8%
*-commutative99.8%
associate-*l*99.8%
Simplified99.8%
pow299.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (* z 2.0))))
(if (<= (* t t) 5.5e-7)
(* (- (* 0.5 x) y) t_1)
(* (* 0.5 (* x t_1)) (exp (/ (* t t) 2.0))))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z * 2.0));
double tmp;
if ((t * t) <= 5.5e-7) {
tmp = ((0.5 * x) - y) * t_1;
} else {
tmp = (0.5 * (x * t_1)) * exp(((t * t) / 2.0));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((z * 2.0d0))
if ((t * t) <= 5.5d-7) then
tmp = ((0.5d0 * x) - y) * t_1
else
tmp = (0.5d0 * (x * t_1)) * exp(((t * t) / 2.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((z * 2.0));
double tmp;
if ((t * t) <= 5.5e-7) {
tmp = ((0.5 * x) - y) * t_1;
} else {
tmp = (0.5 * (x * t_1)) * Math.exp(((t * t) / 2.0));
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((z * 2.0)) tmp = 0 if (t * t) <= 5.5e-7: tmp = ((0.5 * x) - y) * t_1 else: tmp = (0.5 * (x * t_1)) * math.exp(((t * t) / 2.0)) return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(z * 2.0)) tmp = 0.0 if (Float64(t * t) <= 5.5e-7) tmp = Float64(Float64(Float64(0.5 * x) - y) * t_1); else tmp = Float64(Float64(0.5 * Float64(x * t_1)) * exp(Float64(Float64(t * t) / 2.0))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt((z * 2.0)); tmp = 0.0; if ((t * t) <= 5.5e-7) tmp = ((0.5 * x) - y) * t_1; else tmp = (0.5 * (x * t_1)) * exp(((t * t) / 2.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t * t), $MachinePrecision], 5.5e-7], N[(N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[(0.5 * N[(x * t$95$1), $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
\mathbf{if}\;t \cdot t \leq 5.5 \cdot 10^{-7}:\\
\;\;\;\;\left(0.5 \cdot x - y\right) \cdot t_1\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \left(x \cdot t_1\right)\right) \cdot e^{\frac{t \cdot t}{2}}\\
\end{array}
\end{array}
if (*.f64 t t) < 5.5000000000000003e-7Initial program 99.7%
*-commutative99.7%
associate-*l*99.7%
exp-sqrt99.7%
Simplified99.7%
Taylor expanded in t around 0 99.6%
if 5.5000000000000003e-7 < (*.f64 t t) Initial program 98.4%
Taylor expanded in x around inf 69.8%
expm1-log1p-u50.7%
expm1-udef30.9%
associate-*l*30.9%
*-commutative30.9%
sqrt-prod30.9%
Applied egg-rr30.9%
expm1-def50.7%
expm1-log1p69.8%
*-commutative69.8%
Simplified69.8%
Final simplification84.9%
(FPCore (x y z t) :precision binary64 (if (<= t 16.0) (* (- (* 0.5 x) y) (sqrt (* z 2.0))) (sqrt (* 2.0 (* z (pow (+ (* 0.5 x) y) 2.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 16.0) {
tmp = ((0.5 * x) - y) * sqrt((z * 2.0));
} else {
tmp = sqrt((2.0 * (z * pow(((0.5 * x) + y), 2.0))));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= 16.0d0) then
tmp = ((0.5d0 * x) - y) * sqrt((z * 2.0d0))
else
tmp = sqrt((2.0d0 * (z * (((0.5d0 * x) + y) ** 2.0d0))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 16.0) {
tmp = ((0.5 * x) - y) * Math.sqrt((z * 2.0));
} else {
tmp = Math.sqrt((2.0 * (z * Math.pow(((0.5 * x) + y), 2.0))));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 16.0: tmp = ((0.5 * x) - y) * math.sqrt((z * 2.0)) else: tmp = math.sqrt((2.0 * (z * math.pow(((0.5 * x) + y), 2.0)))) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 16.0) tmp = Float64(Float64(Float64(0.5 * x) - y) * sqrt(Float64(z * 2.0))); else tmp = sqrt(Float64(2.0 * Float64(z * (Float64(Float64(0.5 * x) + y) ^ 2.0)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 16.0) tmp = ((0.5 * x) - y) * sqrt((z * 2.0)); else tmp = sqrt((2.0 * (z * (((0.5 * x) + y) ^ 2.0)))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 16.0], N[(N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(2.0 * N[(z * N[Power[N[(N[(0.5 * x), $MachinePrecision] + y), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 16:\\
\;\;\;\;\left(0.5 \cdot x - y\right) \cdot \sqrt{z \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2 \cdot \left(z \cdot {\left(0.5 \cdot x + y\right)}^{2}\right)}\\
\end{array}
\end{array}
if t < 16Initial program 99.8%
*-commutative99.8%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in t around 0 70.7%
if 16 < t Initial program 96.6%
*-commutative96.6%
associate-*l*100.0%
exp-sqrt100.0%
Simplified100.0%
Taylor expanded in t around 0 13.0%
add-sqr-sqrt9.7%
sqrt-unprod35.5%
swap-sqr37.1%
add-sqr-sqrt37.1%
pow237.1%
fma-neg37.1%
add-sqr-sqrt21.2%
sqrt-unprod37.1%
sqr-neg37.1%
sqrt-unprod15.9%
add-sqr-sqrt37.1%
Applied egg-rr37.1%
Taylor expanded in z around 0 37.1%
Final simplification63.1%
(FPCore (x y z t)
:precision binary64
(if (<= t 48.0)
(* (- (* 0.5 x) y) (sqrt (* z 2.0)))
(if (or (<= t 2e+173) (not (<= t 3.55e+230)))
(sqrt (* (* z 2.0) (* x (+ y (* x 0.25)))))
(sqrt (* 2.0 (* (* y z) (+ x y)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 48.0) {
tmp = ((0.5 * x) - y) * sqrt((z * 2.0));
} else if ((t <= 2e+173) || !(t <= 3.55e+230)) {
tmp = sqrt(((z * 2.0) * (x * (y + (x * 0.25)))));
} else {
tmp = sqrt((2.0 * ((y * z) * (x + y))));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= 48.0d0) then
tmp = ((0.5d0 * x) - y) * sqrt((z * 2.0d0))
else if ((t <= 2d+173) .or. (.not. (t <= 3.55d+230))) then
tmp = sqrt(((z * 2.0d0) * (x * (y + (x * 0.25d0)))))
else
tmp = sqrt((2.0d0 * ((y * z) * (x + y))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 48.0) {
tmp = ((0.5 * x) - y) * Math.sqrt((z * 2.0));
} else if ((t <= 2e+173) || !(t <= 3.55e+230)) {
tmp = Math.sqrt(((z * 2.0) * (x * (y + (x * 0.25)))));
} else {
tmp = Math.sqrt((2.0 * ((y * z) * (x + y))));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 48.0: tmp = ((0.5 * x) - y) * math.sqrt((z * 2.0)) elif (t <= 2e+173) or not (t <= 3.55e+230): tmp = math.sqrt(((z * 2.0) * (x * (y + (x * 0.25))))) else: tmp = math.sqrt((2.0 * ((y * z) * (x + y)))) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 48.0) tmp = Float64(Float64(Float64(0.5 * x) - y) * sqrt(Float64(z * 2.0))); elseif ((t <= 2e+173) || !(t <= 3.55e+230)) tmp = sqrt(Float64(Float64(z * 2.0) * Float64(x * Float64(y + Float64(x * 0.25))))); else tmp = sqrt(Float64(2.0 * Float64(Float64(y * z) * Float64(x + y)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 48.0) tmp = ((0.5 * x) - y) * sqrt((z * 2.0)); elseif ((t <= 2e+173) || ~((t <= 3.55e+230))) tmp = sqrt(((z * 2.0) * (x * (y + (x * 0.25))))); else tmp = sqrt((2.0 * ((y * z) * (x + y)))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 48.0], N[(N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t, 2e+173], N[Not[LessEqual[t, 3.55e+230]], $MachinePrecision]], N[Sqrt[N[(N[(z * 2.0), $MachinePrecision] * N[(x * N[(y + N[(x * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Sqrt[N[(2.0 * N[(N[(y * z), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 48:\\
\;\;\;\;\left(0.5 \cdot x - y\right) \cdot \sqrt{z \cdot 2}\\
\mathbf{elif}\;t \leq 2 \cdot 10^{+173} \lor \neg \left(t \leq 3.55 \cdot 10^{+230}\right):\\
\;\;\;\;\sqrt{\left(z \cdot 2\right) \cdot \left(x \cdot \left(y + x \cdot 0.25\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2 \cdot \left(\left(y \cdot z\right) \cdot \left(x + y\right)\right)}\\
\end{array}
\end{array}
if t < 48Initial program 99.8%
*-commutative99.8%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in t around 0 70.7%
if 48 < t < 2e173 or 3.5499999999999999e230 < t Initial program 95.7%
*-commutative95.7%
associate-*l*100.0%
exp-sqrt100.0%
Simplified100.0%
Taylor expanded in t around 0 15.0%
add-sqr-sqrt11.6%
sqrt-unprod39.3%
swap-sqr41.3%
add-sqr-sqrt41.3%
pow241.3%
fma-neg41.3%
add-sqr-sqrt21.8%
sqrt-unprod41.3%
sqr-neg41.3%
sqrt-unprod19.6%
add-sqr-sqrt41.3%
Applied egg-rr41.3%
Taylor expanded in x around inf 28.7%
+-commutative28.7%
*-commutative28.7%
unpow228.7%
associate-*l*28.7%
distribute-lft-out33.0%
Simplified33.0%
if 2e173 < t < 3.5499999999999999e230Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
exp-sqrt100.0%
Simplified100.0%
Taylor expanded in t around 0 4.2%
add-sqr-sqrt1.6%
sqrt-unprod19.1%
swap-sqr19.1%
add-sqr-sqrt19.1%
pow219.1%
fma-neg19.1%
add-sqr-sqrt18.9%
sqrt-unprod19.1%
sqr-neg19.1%
sqrt-unprod0.3%
add-sqr-sqrt19.1%
Applied egg-rr19.1%
Taylor expanded in x around 0 19.2%
+-commutative19.2%
distribute-lft-out19.2%
unpow219.2%
associate-*l*19.2%
distribute-rgt-out19.2%
Simplified19.2%
Final simplification61.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (* z 2.0))))
(if (or (<= x -1.05e+14) (not (<= x 1.3e+88)))
(* (* 0.5 x) t_1)
(* y (- t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z * 2.0));
double tmp;
if ((x <= -1.05e+14) || !(x <= 1.3e+88)) {
tmp = (0.5 * x) * t_1;
} else {
tmp = y * -t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((z * 2.0d0))
if ((x <= (-1.05d+14)) .or. (.not. (x <= 1.3d+88))) then
tmp = (0.5d0 * x) * t_1
else
tmp = y * -t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((z * 2.0));
double tmp;
if ((x <= -1.05e+14) || !(x <= 1.3e+88)) {
tmp = (0.5 * x) * t_1;
} else {
tmp = y * -t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((z * 2.0)) tmp = 0 if (x <= -1.05e+14) or not (x <= 1.3e+88): tmp = (0.5 * x) * t_1 else: tmp = y * -t_1 return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(z * 2.0)) tmp = 0.0 if ((x <= -1.05e+14) || !(x <= 1.3e+88)) tmp = Float64(Float64(0.5 * x) * t_1); else tmp = Float64(y * Float64(-t_1)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt((z * 2.0)); tmp = 0.0; if ((x <= -1.05e+14) || ~((x <= 1.3e+88))) tmp = (0.5 * x) * t_1; else tmp = y * -t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[x, -1.05e+14], N[Not[LessEqual[x, 1.3e+88]], $MachinePrecision]], N[(N[(0.5 * x), $MachinePrecision] * t$95$1), $MachinePrecision], N[(y * (-t$95$1)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
\mathbf{if}\;x \leq -1.05 \cdot 10^{+14} \lor \neg \left(x \leq 1.3 \cdot 10^{+88}\right):\\
\;\;\;\;\left(0.5 \cdot x\right) \cdot t_1\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-t_1\right)\\
\end{array}
\end{array}
if x < -1.05e14 or 1.3e88 < x Initial program 99.8%
*-commutative99.8%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in t around 0 60.7%
add-sqr-sqrt32.5%
sqrt-unprod52.6%
sqr-neg52.6%
sqrt-unprod23.7%
add-sqr-sqrt48.8%
distribute-rgt-out--47.9%
*-commutative47.9%
cancel-sign-sub47.9%
*-commutative47.9%
*-commutative47.9%
Applied egg-rr47.9%
*-commutative47.9%
distribute-lft-in48.8%
fma-udef48.8%
*-commutative48.8%
Simplified48.8%
Taylor expanded in x around inf 49.3%
Simplified49.4%
if -1.05e14 < x < 1.3e88Initial program 98.4%
*-commutative98.4%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in t around 0 55.0%
*-commutative55.0%
*-commutative55.0%
associate-*l*55.1%
Simplified55.1%
*-commutative55.1%
sqrt-prod55.2%
add-sqr-sqrt54.9%
pow254.9%
pow1/254.9%
sqrt-pow155.0%
metadata-eval55.0%
Applied egg-rr55.0%
Taylor expanded in x around 0 44.1%
Simplified44.2%
Final simplification46.5%
(FPCore (x y z t) :precision binary64 (if (<= t 2.9e+103) (* (- (* 0.5 x) y) (sqrt (* z 2.0))) (sqrt (* (* z 2.0) (* y (+ x y))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 2.9e+103) {
tmp = ((0.5 * x) - y) * sqrt((z * 2.0));
} else {
tmp = sqrt(((z * 2.0) * (y * (x + y))));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= 2.9d+103) then
tmp = ((0.5d0 * x) - y) * sqrt((z * 2.0d0))
else
tmp = sqrt(((z * 2.0d0) * (y * (x + y))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 2.9e+103) {
tmp = ((0.5 * x) - y) * Math.sqrt((z * 2.0));
} else {
tmp = Math.sqrt(((z * 2.0) * (y * (x + y))));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 2.9e+103: tmp = ((0.5 * x) - y) * math.sqrt((z * 2.0)) else: tmp = math.sqrt(((z * 2.0) * (y * (x + y)))) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 2.9e+103) tmp = Float64(Float64(Float64(0.5 * x) - y) * sqrt(Float64(z * 2.0))); else tmp = sqrt(Float64(Float64(z * 2.0) * Float64(y * Float64(x + y)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 2.9e+103) tmp = ((0.5 * x) - y) * sqrt((z * 2.0)); else tmp = sqrt(((z * 2.0) * (y * (x + y)))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 2.9e+103], N[(N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[(z * 2.0), $MachinePrecision] * N[(y * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 2.9 \cdot 10^{+103}:\\
\;\;\;\;\left(0.5 \cdot x - y\right) \cdot \sqrt{z \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\left(z \cdot 2\right) \cdot \left(y \cdot \left(x + y\right)\right)}\\
\end{array}
\end{array}
if t < 2.8999999999999998e103Initial program 99.3%
*-commutative99.3%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in t around 0 65.5%
if 2.8999999999999998e103 < t Initial program 97.4%
*-commutative97.4%
associate-*l*100.0%
exp-sqrt100.0%
Simplified100.0%
Taylor expanded in t around 0 12.4%
add-sqr-sqrt10.9%
sqrt-unprod37.8%
swap-sqr40.3%
add-sqr-sqrt40.3%
pow240.3%
fma-neg40.3%
add-sqr-sqrt24.2%
sqrt-unprod40.3%
sqr-neg40.3%
sqrt-unprod16.1%
add-sqr-sqrt40.3%
Applied egg-rr40.3%
Taylor expanded in x around 0 17.0%
+-commutative17.0%
unpow217.0%
distribute-rgt-out19.6%
Simplified19.6%
Final simplification58.7%
(FPCore (x y z t) :precision binary64 (* y (- (sqrt (* z 2.0)))))
double code(double x, double y, double z, double t) {
return y * -sqrt((z * 2.0));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = y * -sqrt((z * 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
return y * -Math.sqrt((z * 2.0));
}
def code(x, y, z, t): return y * -math.sqrt((z * 2.0))
function code(x, y, z, t) return Float64(y * Float64(-sqrt(Float64(z * 2.0)))) end
function tmp = code(x, y, z, t) tmp = y * -sqrt((z * 2.0)); end
code[x_, y_, z_, t_] := N[(y * (-N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \left(-\sqrt{z \cdot 2}\right)
\end{array}
Initial program 99.0%
*-commutative99.0%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in t around 0 57.4%
*-commutative57.4%
*-commutative57.4%
associate-*l*57.5%
Simplified57.5%
*-commutative57.5%
sqrt-prod57.6%
add-sqr-sqrt57.4%
pow257.4%
pow1/257.4%
sqrt-pow157.5%
metadata-eval57.5%
Applied egg-rr57.5%
Taylor expanded in x around 0 30.7%
Simplified30.8%
Final simplification30.8%
(FPCore (x y z t) :precision binary64 (* y (sqrt (* z 2.0))))
double code(double x, double y, double z, double t) {
return y * sqrt((z * 2.0));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = y * sqrt((z * 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
return y * Math.sqrt((z * 2.0));
}
def code(x, y, z, t): return y * math.sqrt((z * 2.0))
function code(x, y, z, t) return Float64(y * sqrt(Float64(z * 2.0))) end
function tmp = code(x, y, z, t) tmp = y * sqrt((z * 2.0)); end
code[x_, y_, z_, t_] := N[(y * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \sqrt{z \cdot 2}
\end{array}
Initial program 99.0%
*-commutative99.0%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in t around 0 57.4%
*-commutative57.4%
*-commutative57.4%
associate-*l*57.5%
Simplified57.5%
*-commutative57.5%
sqrt-prod57.6%
add-sqr-sqrt57.4%
pow257.4%
pow1/257.4%
sqrt-pow157.5%
metadata-eval57.5%
Applied egg-rr57.5%
Taylor expanded in x around 0 30.7%
Simplified30.8%
distribute-rgt-neg-out30.8%
pow1/230.8%
*-commutative30.8%
metadata-eval30.8%
pow-pow27.9%
distribute-lft-neg-in27.9%
add-sqr-sqrt12.8%
sqrt-unprod13.5%
sqr-neg13.5%
sqrt-prod3.3%
add-sqr-sqrt5.0%
expm1-log1p-u4.0%
expm1-udef4.0%
pow-pow2.2%
*-commutative2.2%
metadata-eval2.2%
pow1/22.2%
Applied egg-rr2.2%
expm1-def2.1%
expm1-log1p2.4%
Simplified2.4%
Final simplification2.4%
(FPCore (x y z t) :precision binary64 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (pow (exp 1.0) (/ (* t t) 2.0))))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((z * 2.0))) * pow(exp(1.0), ((t * t) / 2.0));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * (exp(1.0d0) ** ((t * t) / 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * Math.pow(Math.exp(1.0), ((t * t) / 2.0));
}
def code(x, y, z, t): return (((x * 0.5) - y) * math.sqrt((z * 2.0))) * math.pow(math.exp(1.0), ((t * t) / 2.0))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * (exp(1.0) ^ Float64(Float64(t * t) / 2.0))) end
function tmp = code(x, y, z, t) tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * (exp(1.0) ^ ((t * t) / 2.0)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Power[N[Exp[1.0], $MachinePrecision], N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot {\left(e^{1}\right)}^{\left(\frac{t \cdot t}{2}\right)}
\end{array}
herbie shell --seed 2024018
(FPCore (x y z t)
:name "Data.Number.Erf:$cinvnormcdf from erf-2.0.0.0, A"
:precision binary64
:herbie-target
(* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (pow (exp 1.0) (/ (* t t) 2.0)))
(* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (exp (/ (* t t) 2.0))))