
(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 11 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 (* (sqrt (* z 2.0)) (* (- (* x 0.5) y) (sqrt (pow (exp t) t)))))
double code(double x, double y, double z, double t) {
return sqrt((z * 2.0)) * (((x * 0.5) - y) * sqrt(pow(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 = sqrt((z * 2.0d0)) * (((x * 0.5d0) - y) * sqrt((exp(t) ** t)))
end function
public static double code(double x, double y, double z, double t) {
return Math.sqrt((z * 2.0)) * (((x * 0.5) - y) * Math.sqrt(Math.pow(Math.exp(t), t)));
}
def code(x, y, z, t): return math.sqrt((z * 2.0)) * (((x * 0.5) - y) * math.sqrt(math.pow(math.exp(t), t)))
function code(x, y, z, t) return Float64(sqrt(Float64(z * 2.0)) * Float64(Float64(Float64(x * 0.5) - y) * sqrt((exp(t) ^ t)))) end
function tmp = code(x, y, z, t) tmp = sqrt((z * 2.0)) * (((x * 0.5) - y) * sqrt((exp(t) ^ t))); end
code[x_, y_, z_, t_] := N[(N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[Power[N[Exp[t], $MachinePrecision], t], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{z \cdot 2} \cdot \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{{\left(e^{t}\right)}^{t}}\right)
\end{array}
Initial program 99.8%
sqr-neg99.8%
associate-/l*99.8%
distribute-frac-neg99.8%
exp-neg99.8%
associate-*r/99.8%
*-rgt-identity99.8%
*-commutative99.8%
associate-*r/99.8%
*-rgt-identity99.8%
associate-*r/99.8%
exp-neg99.8%
distribute-frac-neg99.8%
associate-/l*99.8%
sqr-neg99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (* (- (* x 0.5) y) (sqrt (* (pow (exp t) t) (* z 2.0)))))
double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * sqrt((pow(exp(t), t) * (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 = ((x * 0.5d0) - y) * sqrt(((exp(t) ** t) * (z * 2.0d0)))
end function
public static double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * Math.sqrt((Math.pow(Math.exp(t), t) * (z * 2.0)));
}
def code(x, y, z, t): return ((x * 0.5) - y) * math.sqrt((math.pow(math.exp(t), t) * (z * 2.0)))
function code(x, y, z, t) return Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64((exp(t) ^ t) * Float64(z * 2.0)))) end
function tmp = code(x, y, z, t) tmp = ((x * 0.5) - y) * sqrt(((exp(t) ^ t) * (z * 2.0))); end
code[x_, y_, z_, t_] := N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(N[Power[N[Exp[t], $MachinePrecision], t], $MachinePrecision] * N[(z * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 0.5 - y\right) \cdot \sqrt{{\left(e^{t}\right)}^{t} \cdot \left(z \cdot 2\right)}
\end{array}
Initial program 99.8%
sqr-neg99.8%
associate-/l*99.8%
distribute-frac-neg99.8%
exp-neg99.8%
associate-*r/99.8%
*-rgt-identity99.8%
associate-*r/99.8%
*-rgt-identity99.8%
associate-*r/99.8%
exp-neg99.8%
distribute-frac-neg99.8%
associate-/l*99.8%
sqr-neg99.8%
exp-sqrt99.8%
Simplified99.8%
expm1-log1p-u98.5%
expm1-udef73.1%
pow-exp73.1%
sqrt-unprod73.1%
associate-*l*73.1%
Applied egg-rr73.1%
expm1-def98.5%
expm1-log1p99.8%
associate-*r*99.8%
*-commutative99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (* (- (* x 0.5) y) (sqrt (* (* z 2.0) (exp (* t t))))))
double code(double x, double y, double z, double t) {
return ((x * 0.5) - 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 = ((x * 0.5d0) - y) * sqrt(((z * 2.0d0) * exp((t * t))))
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))));
}
def code(x, y, z, t): return ((x * 0.5) - y) * math.sqrt(((z * 2.0) * math.exp((t * t))))
function code(x, y, z, t) return Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(Float64(z * 2.0) * exp(Float64(t * t))))) end
function tmp = code(x, y, z, t) tmp = ((x * 0.5) - y) * sqrt(((z * 2.0) * exp((t * t)))); end
code[x_, y_, z_, t_] := N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(N[(z * 2.0), $MachinePrecision] * N[Exp[N[(t * t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 0.5 - y\right) \cdot \sqrt{\left(z \cdot 2\right) \cdot e^{t \cdot t}}
\end{array}
Initial program 99.8%
sqr-neg99.8%
associate-/l*99.8%
distribute-frac-neg99.8%
exp-neg99.8%
associate-*r/99.8%
*-rgt-identity99.8%
associate-*r/99.8%
*-rgt-identity99.8%
associate-*r/99.8%
exp-neg99.8%
distribute-frac-neg99.8%
associate-/l*99.8%
sqr-neg99.8%
exp-sqrt99.8%
Simplified99.8%
expm1-log1p-u98.5%
expm1-udef73.1%
pow-exp73.1%
sqrt-unprod73.1%
associate-*l*73.1%
Applied egg-rr73.1%
expm1-def98.5%
expm1-log1p99.8%
associate-*r*99.8%
*-commutative99.8%
Simplified99.8%
pow-exp99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x 0.5) y)))
(if (<= (* z 2.0) 5e+101)
(* (sqrt (* z 2.0)) (- (* 0.5 (+ x (* t (* t_1 t)))) y))
(* t_1 (sqrt (* 2.0 (+ z (* t (* z t)))))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double tmp;
if ((z * 2.0) <= 5e+101) {
tmp = sqrt((z * 2.0)) * ((0.5 * (x + (t * (t_1 * t)))) - y);
} else {
tmp = t_1 * sqrt((2.0 * (z + (t * (z * t)))));
}
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 = (x * 0.5d0) - y
if ((z * 2.0d0) <= 5d+101) then
tmp = sqrt((z * 2.0d0)) * ((0.5d0 * (x + (t * (t_1 * t)))) - y)
else
tmp = t_1 * sqrt((2.0d0 * (z + (t * (z * t)))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double tmp;
if ((z * 2.0) <= 5e+101) {
tmp = Math.sqrt((z * 2.0)) * ((0.5 * (x + (t * (t_1 * t)))) - y);
} else {
tmp = t_1 * Math.sqrt((2.0 * (z + (t * (z * t)))));
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * 0.5) - y tmp = 0 if (z * 2.0) <= 5e+101: tmp = math.sqrt((z * 2.0)) * ((0.5 * (x + (t * (t_1 * t)))) - y) else: tmp = t_1 * math.sqrt((2.0 * (z + (t * (z * t))))) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * 0.5) - y) tmp = 0.0 if (Float64(z * 2.0) <= 5e+101) tmp = Float64(sqrt(Float64(z * 2.0)) * Float64(Float64(0.5 * Float64(x + Float64(t * Float64(t_1 * t)))) - y)); else tmp = Float64(t_1 * sqrt(Float64(2.0 * Float64(z + Float64(t * Float64(z * t)))))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * 0.5) - y; tmp = 0.0; if ((z * 2.0) <= 5e+101) tmp = sqrt((z * 2.0)) * ((0.5 * (x + (t * (t_1 * t)))) - y); else tmp = t_1 * sqrt((2.0 * (z + (t * (z * t))))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[N[(z * 2.0), $MachinePrecision], 5e+101], N[(N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[(0.5 * N[(x + N[(t * N[(t$95$1 * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Sqrt[N[(2.0 * N[(z + N[(t * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
\mathbf{if}\;z \cdot 2 \leq 5 \cdot 10^{+101}:\\
\;\;\;\;\sqrt{z \cdot 2} \cdot \left(0.5 \cdot \left(x + t \cdot \left(t_1 \cdot t\right)\right) - y\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \sqrt{2 \cdot \left(z + t \cdot \left(z \cdot t\right)\right)}\\
\end{array}
\end{array}
if (*.f64 z 2) < 4.99999999999999989e101Initial program 99.7%
sqr-neg99.7%
associate-/l*99.7%
distribute-frac-neg99.7%
exp-neg99.7%
associate-*r/99.7%
*-rgt-identity99.7%
*-commutative99.7%
associate-*r/99.7%
*-rgt-identity99.7%
associate-*r/99.7%
exp-neg99.7%
distribute-frac-neg99.7%
associate-/l*99.7%
sqr-neg99.7%
Simplified99.7%
Taylor expanded in t around 0 85.9%
distribute-lft-out85.9%
unpow285.9%
Simplified85.9%
Taylor expanded in t around 0 85.9%
unpow285.9%
associate-*l*85.9%
Simplified85.9%
if 4.99999999999999989e101 < (*.f64 z 2) Initial program 99.8%
sqr-neg99.8%
associate-/l*99.8%
distribute-frac-neg99.8%
exp-neg99.8%
associate-*r/99.8%
*-rgt-identity99.8%
associate-*r/99.8%
*-rgt-identity99.8%
associate-*r/99.8%
exp-neg99.8%
distribute-frac-neg99.8%
associate-/l*99.8%
sqr-neg99.8%
exp-sqrt99.8%
Simplified99.8%
expm1-log1p-u97.1%
expm1-udef97.1%
pow-exp97.1%
sqrt-unprod97.1%
associate-*l*97.1%
Applied egg-rr97.1%
expm1-def97.1%
expm1-log1p99.8%
associate-*r*99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in t around 0 93.5%
distribute-lft-out93.5%
unpow293.5%
associate-*l*93.5%
Simplified93.5%
Final simplification88.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x 0.5) y)))
(if (<= (* z 2.0) 2e+158)
(* (sqrt (* z 2.0)) (- (* 0.5 (+ x (* t_1 (* t t)))) y))
(* t_1 (sqrt (* 2.0 (+ z (* t (* z t)))))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double tmp;
if ((z * 2.0) <= 2e+158) {
tmp = sqrt((z * 2.0)) * ((0.5 * (x + (t_1 * (t * t)))) - y);
} else {
tmp = t_1 * sqrt((2.0 * (z + (t * (z * t)))));
}
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 = (x * 0.5d0) - y
if ((z * 2.0d0) <= 2d+158) then
tmp = sqrt((z * 2.0d0)) * ((0.5d0 * (x + (t_1 * (t * t)))) - y)
else
tmp = t_1 * sqrt((2.0d0 * (z + (t * (z * t)))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double tmp;
if ((z * 2.0) <= 2e+158) {
tmp = Math.sqrt((z * 2.0)) * ((0.5 * (x + (t_1 * (t * t)))) - y);
} else {
tmp = t_1 * Math.sqrt((2.0 * (z + (t * (z * t)))));
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * 0.5) - y tmp = 0 if (z * 2.0) <= 2e+158: tmp = math.sqrt((z * 2.0)) * ((0.5 * (x + (t_1 * (t * t)))) - y) else: tmp = t_1 * math.sqrt((2.0 * (z + (t * (z * t))))) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * 0.5) - y) tmp = 0.0 if (Float64(z * 2.0) <= 2e+158) tmp = Float64(sqrt(Float64(z * 2.0)) * Float64(Float64(0.5 * Float64(x + Float64(t_1 * Float64(t * t)))) - y)); else tmp = Float64(t_1 * sqrt(Float64(2.0 * Float64(z + Float64(t * Float64(z * t)))))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * 0.5) - y; tmp = 0.0; if ((z * 2.0) <= 2e+158) tmp = sqrt((z * 2.0)) * ((0.5 * (x + (t_1 * (t * t)))) - y); else tmp = t_1 * sqrt((2.0 * (z + (t * (z * t))))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[N[(z * 2.0), $MachinePrecision], 2e+158], N[(N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[(0.5 * N[(x + N[(t$95$1 * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Sqrt[N[(2.0 * N[(z + N[(t * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
\mathbf{if}\;z \cdot 2 \leq 2 \cdot 10^{+158}:\\
\;\;\;\;\sqrt{z \cdot 2} \cdot \left(0.5 \cdot \left(x + t_1 \cdot \left(t \cdot t\right)\right) - y\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \sqrt{2 \cdot \left(z + t \cdot \left(z \cdot t\right)\right)}\\
\end{array}
\end{array}
if (*.f64 z 2) < 1.99999999999999991e158Initial program 99.7%
sqr-neg99.7%
associate-/l*99.7%
distribute-frac-neg99.7%
exp-neg99.7%
associate-*r/99.7%
*-rgt-identity99.7%
*-commutative99.7%
associate-*r/99.7%
*-rgt-identity99.7%
associate-*r/99.7%
exp-neg99.7%
distribute-frac-neg99.7%
associate-/l*99.7%
sqr-neg99.7%
Simplified99.8%
Taylor expanded in t around 0 85.3%
distribute-lft-out85.3%
unpow285.3%
Simplified85.3%
if 1.99999999999999991e158 < (*.f64 z 2) Initial program 99.8%
sqr-neg99.8%
associate-/l*99.8%
distribute-frac-neg99.8%
exp-neg99.8%
associate-*r/99.8%
*-rgt-identity99.8%
associate-*r/99.8%
*-rgt-identity99.8%
associate-*r/99.8%
exp-neg99.8%
distribute-frac-neg99.8%
associate-/l*99.8%
sqr-neg99.8%
exp-sqrt99.8%
Simplified99.8%
expm1-log1p-u97.0%
expm1-udef97.0%
pow-exp97.0%
sqrt-unprod97.0%
associate-*l*97.0%
Applied egg-rr97.0%
expm1-def97.0%
expm1-log1p99.8%
associate-*r*99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in t around 0 97.2%
distribute-lft-out97.2%
unpow297.2%
associate-*l*97.2%
Simplified97.2%
Final simplification88.4%
(FPCore (x y z t) :precision binary64 (if (<= (* x 0.5) -2e+110) (* (sqrt (* z 2.0)) (- (* 0.5 (* x (+ 1.0 (* 0.5 (* t t))))) y)) (* (- (* x 0.5) y) (sqrt (* (* z 2.0) (+ (* t t) 1.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x * 0.5) <= -2e+110) {
tmp = sqrt((z * 2.0)) * ((0.5 * (x * (1.0 + (0.5 * (t * t))))) - y);
} else {
tmp = ((x * 0.5) - y) * sqrt(((z * 2.0) * ((t * t) + 1.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 ((x * 0.5d0) <= (-2d+110)) then
tmp = sqrt((z * 2.0d0)) * ((0.5d0 * (x * (1.0d0 + (0.5d0 * (t * t))))) - y)
else
tmp = ((x * 0.5d0) - y) * sqrt(((z * 2.0d0) * ((t * t) + 1.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x * 0.5) <= -2e+110) {
tmp = Math.sqrt((z * 2.0)) * ((0.5 * (x * (1.0 + (0.5 * (t * t))))) - y);
} else {
tmp = ((x * 0.5) - y) * Math.sqrt(((z * 2.0) * ((t * t) + 1.0)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x * 0.5) <= -2e+110: tmp = math.sqrt((z * 2.0)) * ((0.5 * (x * (1.0 + (0.5 * (t * t))))) - y) else: tmp = ((x * 0.5) - y) * math.sqrt(((z * 2.0) * ((t * t) + 1.0))) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x * 0.5) <= -2e+110) tmp = Float64(sqrt(Float64(z * 2.0)) * Float64(Float64(0.5 * Float64(x * Float64(1.0 + Float64(0.5 * Float64(t * t))))) - y)); else tmp = Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(Float64(z * 2.0) * Float64(Float64(t * t) + 1.0)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x * 0.5) <= -2e+110) tmp = sqrt((z * 2.0)) * ((0.5 * (x * (1.0 + (0.5 * (t * t))))) - y); else tmp = ((x * 0.5) - y) * sqrt(((z * 2.0) * ((t * t) + 1.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x * 0.5), $MachinePrecision], -2e+110], N[(N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[(0.5 * N[(x * N[(1.0 + N[(0.5 * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(N[(z * 2.0), $MachinePrecision] * N[(N[(t * t), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot 0.5 \leq -2 \cdot 10^{+110}:\\
\;\;\;\;\sqrt{z \cdot 2} \cdot \left(0.5 \cdot \left(x \cdot \left(1 + 0.5 \cdot \left(t \cdot t\right)\right)\right) - y\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot \sqrt{\left(z \cdot 2\right) \cdot \left(t \cdot t + 1\right)}\\
\end{array}
\end{array}
if (*.f64 x 1/2) < -2e110Initial program 99.8%
sqr-neg99.8%
associate-/l*99.8%
distribute-frac-neg99.8%
exp-neg99.8%
associate-*r/99.9%
*-rgt-identity99.9%
*-commutative99.9%
associate-*r/99.9%
*-rgt-identity99.9%
associate-*r/99.9%
exp-neg99.9%
distribute-frac-neg99.9%
associate-/l*99.9%
sqr-neg99.9%
Simplified99.9%
Taylor expanded in t around 0 90.9%
distribute-lft-out90.9%
unpow290.9%
Simplified90.9%
Taylor expanded in x around inf 90.9%
+-commutative90.9%
unpow290.9%
Simplified90.9%
if -2e110 < (*.f64 x 1/2) Initial program 99.7%
sqr-neg99.7%
associate-/l*99.7%
distribute-frac-neg99.7%
exp-neg99.7%
associate-*r/99.7%
*-rgt-identity99.7%
associate-*r/99.7%
*-rgt-identity99.7%
associate-*r/99.7%
exp-neg99.7%
distribute-frac-neg99.7%
associate-/l*99.7%
sqr-neg99.7%
exp-sqrt99.7%
Simplified99.7%
expm1-log1p-u98.3%
expm1-udef72.8%
pow-exp72.8%
sqrt-unprod72.8%
associate-*l*72.8%
Applied egg-rr72.8%
expm1-def98.4%
expm1-log1p99.8%
associate-*r*99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in t around 0 83.8%
+-commutative83.8%
unpow283.8%
Simplified83.8%
Final simplification85.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x 0.5) y)))
(if (<= (* z 2.0) 2e+158)
(* (* (sqrt (* z 2.0)) t_1) (+ 1.0 (* 0.5 (* t t))))
(* t_1 (sqrt (* 2.0 (+ z (* t (* z t)))))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double tmp;
if ((z * 2.0) <= 2e+158) {
tmp = (sqrt((z * 2.0)) * t_1) * (1.0 + (0.5 * (t * t)));
} else {
tmp = t_1 * sqrt((2.0 * (z + (t * (z * t)))));
}
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 = (x * 0.5d0) - y
if ((z * 2.0d0) <= 2d+158) then
tmp = (sqrt((z * 2.0d0)) * t_1) * (1.0d0 + (0.5d0 * (t * t)))
else
tmp = t_1 * sqrt((2.0d0 * (z + (t * (z * t)))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double tmp;
if ((z * 2.0) <= 2e+158) {
tmp = (Math.sqrt((z * 2.0)) * t_1) * (1.0 + (0.5 * (t * t)));
} else {
tmp = t_1 * Math.sqrt((2.0 * (z + (t * (z * t)))));
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * 0.5) - y tmp = 0 if (z * 2.0) <= 2e+158: tmp = (math.sqrt((z * 2.0)) * t_1) * (1.0 + (0.5 * (t * t))) else: tmp = t_1 * math.sqrt((2.0 * (z + (t * (z * t))))) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * 0.5) - y) tmp = 0.0 if (Float64(z * 2.0) <= 2e+158) tmp = Float64(Float64(sqrt(Float64(z * 2.0)) * t_1) * Float64(1.0 + Float64(0.5 * Float64(t * t)))); else tmp = Float64(t_1 * sqrt(Float64(2.0 * Float64(z + Float64(t * Float64(z * t)))))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * 0.5) - y; tmp = 0.0; if ((z * 2.0) <= 2e+158) tmp = (sqrt((z * 2.0)) * t_1) * (1.0 + (0.5 * (t * t))); else tmp = t_1 * sqrt((2.0 * (z + (t * (z * t))))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[N[(z * 2.0), $MachinePrecision], 2e+158], N[(N[(N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision] * N[(1.0 + N[(0.5 * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Sqrt[N[(2.0 * N[(z + N[(t * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
\mathbf{if}\;z \cdot 2 \leq 2 \cdot 10^{+158}:\\
\;\;\;\;\left(\sqrt{z \cdot 2} \cdot t_1\right) \cdot \left(1 + 0.5 \cdot \left(t \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \sqrt{2 \cdot \left(z + t \cdot \left(z \cdot t\right)\right)}\\
\end{array}
\end{array}
if (*.f64 z 2) < 1.99999999999999991e158Initial program 99.7%
Taylor expanded in t around 0 83.4%
*-commutative83.4%
unpow283.4%
Simplified83.4%
if 1.99999999999999991e158 < (*.f64 z 2) Initial program 99.8%
sqr-neg99.8%
associate-/l*99.8%
distribute-frac-neg99.8%
exp-neg99.8%
associate-*r/99.8%
*-rgt-identity99.8%
associate-*r/99.8%
*-rgt-identity99.8%
associate-*r/99.8%
exp-neg99.8%
distribute-frac-neg99.8%
associate-/l*99.8%
sqr-neg99.8%
exp-sqrt99.8%
Simplified99.8%
expm1-log1p-u97.0%
expm1-udef97.0%
pow-exp97.0%
sqrt-unprod97.0%
associate-*l*97.0%
Applied egg-rr97.0%
expm1-def97.0%
expm1-log1p99.8%
associate-*r*99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in t around 0 97.2%
distribute-lft-out97.2%
unpow297.2%
associate-*l*97.2%
Simplified97.2%
Final simplification86.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (* z 2.0))))
(if (<= (* t t) 2.0)
(* t_1 (- (* x 0.5) y))
(* t_1 (- (* 0.5 (* (* t t) (* x 0.5))) y)))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z * 2.0));
double tmp;
if ((t * t) <= 2.0) {
tmp = t_1 * ((x * 0.5) - y);
} else {
tmp = t_1 * ((0.5 * ((t * t) * (x * 0.5))) - 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) :: t_1
real(8) :: tmp
t_1 = sqrt((z * 2.0d0))
if ((t * t) <= 2.0d0) then
tmp = t_1 * ((x * 0.5d0) - y)
else
tmp = t_1 * ((0.5d0 * ((t * t) * (x * 0.5d0))) - y)
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) <= 2.0) {
tmp = t_1 * ((x * 0.5) - y);
} else {
tmp = t_1 * ((0.5 * ((t * t) * (x * 0.5))) - y);
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((z * 2.0)) tmp = 0 if (t * t) <= 2.0: tmp = t_1 * ((x * 0.5) - y) else: tmp = t_1 * ((0.5 * ((t * t) * (x * 0.5))) - y) return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(z * 2.0)) tmp = 0.0 if (Float64(t * t) <= 2.0) tmp = Float64(t_1 * Float64(Float64(x * 0.5) - y)); else tmp = Float64(t_1 * Float64(Float64(0.5 * Float64(Float64(t * t) * Float64(x * 0.5))) - y)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt((z * 2.0)); tmp = 0.0; if ((t * t) <= 2.0) tmp = t_1 * ((x * 0.5) - y); else tmp = t_1 * ((0.5 * ((t * t) * (x * 0.5))) - y); 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], 2.0], N[(t$95$1 * N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(N[(0.5 * N[(N[(t * t), $MachinePrecision] * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
\mathbf{if}\;t \cdot t \leq 2:\\
\;\;\;\;t_1 \cdot \left(x \cdot 0.5 - y\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(0.5 \cdot \left(\left(t \cdot t\right) \cdot \left(x \cdot 0.5\right)\right) - y\right)\\
\end{array}
\end{array}
if (*.f64 t t) < 2Initial program 99.6%
sqr-neg99.6%
associate-/l*99.6%
distribute-frac-neg99.6%
exp-neg99.6%
associate-*r/99.6%
*-rgt-identity99.6%
*-commutative99.6%
associate-*r/99.6%
*-rgt-identity99.6%
associate-*r/99.6%
exp-neg99.6%
distribute-frac-neg99.6%
associate-/l*99.6%
sqr-neg99.6%
Simplified99.6%
Taylor expanded in t around 0 97.8%
if 2 < (*.f64 t t) Initial program 100.0%
sqr-neg100.0%
associate-/l*100.0%
distribute-frac-neg100.0%
exp-neg100.0%
associate-*r/100.0%
*-rgt-identity100.0%
*-commutative100.0%
associate-*r/100.0%
*-rgt-identity100.0%
associate-*r/100.0%
exp-neg100.0%
distribute-frac-neg100.0%
associate-/l*100.0%
sqr-neg100.0%
Simplified100.0%
Taylor expanded in t around 0 72.8%
distribute-lft-out72.8%
unpow272.8%
Simplified72.8%
Taylor expanded in x around inf 49.4%
+-commutative49.4%
unpow249.4%
Simplified49.4%
Taylor expanded in t around inf 49.4%
associate-*r*49.4%
*-commutative49.4%
associate-*r*49.4%
*-commutative49.4%
unpow249.4%
*-commutative49.4%
Simplified49.4%
Final simplification75.3%
(FPCore (x y z t) :precision binary64 (* (- (* x 0.5) y) (sqrt (* 2.0 (+ z (* t (* z t)))))))
double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * sqrt((2.0 * (z + (t * (z * 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 = ((x * 0.5d0) - y) * sqrt((2.0d0 * (z + (t * (z * t)))))
end function
public static double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * Math.sqrt((2.0 * (z + (t * (z * t)))));
}
def code(x, y, z, t): return ((x * 0.5) - y) * math.sqrt((2.0 * (z + (t * (z * t)))))
function code(x, y, z, t) return Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(2.0 * Float64(z + Float64(t * Float64(z * t)))))) end
function tmp = code(x, y, z, t) tmp = ((x * 0.5) - y) * sqrt((2.0 * (z + (t * (z * t))))); end
code[x_, y_, z_, t_] := N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(2.0 * N[(z + N[(t * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 0.5 - y\right) \cdot \sqrt{2 \cdot \left(z + t \cdot \left(z \cdot t\right)\right)}
\end{array}
Initial program 99.8%
sqr-neg99.8%
associate-/l*99.8%
distribute-frac-neg99.8%
exp-neg99.8%
associate-*r/99.8%
*-rgt-identity99.8%
associate-*r/99.8%
*-rgt-identity99.8%
associate-*r/99.8%
exp-neg99.8%
distribute-frac-neg99.8%
associate-/l*99.8%
sqr-neg99.8%
exp-sqrt99.8%
Simplified99.8%
expm1-log1p-u98.5%
expm1-udef73.1%
pow-exp73.1%
sqrt-unprod73.1%
associate-*l*73.1%
Applied egg-rr73.1%
expm1-def98.5%
expm1-log1p99.8%
associate-*r*99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in t around 0 83.2%
distribute-lft-out83.2%
unpow283.2%
associate-*l*81.0%
Simplified81.0%
Final simplification81.0%
(FPCore (x y z t) :precision binary64 (* (- (* x 0.5) y) (sqrt (* (* z 2.0) (+ (* t t) 1.0)))))
double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * sqrt(((z * 2.0) * ((t * t) + 1.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) * ((t * t) + 1.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) * ((t * t) + 1.0)));
}
def code(x, y, z, t): return ((x * 0.5) - y) * math.sqrt(((z * 2.0) * ((t * t) + 1.0)))
function code(x, y, z, t) return Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(Float64(z * 2.0) * Float64(Float64(t * t) + 1.0)))) end
function tmp = code(x, y, z, t) tmp = ((x * 0.5) - y) * sqrt(((z * 2.0) * ((t * t) + 1.0))); end
code[x_, y_, z_, t_] := N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(N[(z * 2.0), $MachinePrecision] * N[(N[(t * t), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 0.5 - y\right) \cdot \sqrt{\left(z \cdot 2\right) \cdot \left(t \cdot t + 1\right)}
\end{array}
Initial program 99.8%
sqr-neg99.8%
associate-/l*99.8%
distribute-frac-neg99.8%
exp-neg99.8%
associate-*r/99.8%
*-rgt-identity99.8%
associate-*r/99.8%
*-rgt-identity99.8%
associate-*r/99.8%
exp-neg99.8%
distribute-frac-neg99.8%
associate-/l*99.8%
sqr-neg99.8%
exp-sqrt99.8%
Simplified99.8%
expm1-log1p-u98.5%
expm1-udef73.1%
pow-exp73.1%
sqrt-unprod73.1%
associate-*l*73.1%
Applied egg-rr73.1%
expm1-def98.5%
expm1-log1p99.8%
associate-*r*99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in t around 0 83.2%
+-commutative83.2%
unpow283.2%
Simplified83.2%
Final simplification83.2%
(FPCore (x y z t) :precision binary64 (* (sqrt (* z 2.0)) (- (* x 0.5) y)))
double code(double x, double y, double z, double t) {
return sqrt((z * 2.0)) * ((x * 0.5) - y);
}
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 = sqrt((z * 2.0d0)) * ((x * 0.5d0) - y)
end function
public static double code(double x, double y, double z, double t) {
return Math.sqrt((z * 2.0)) * ((x * 0.5) - y);
}
def code(x, y, z, t): return math.sqrt((z * 2.0)) * ((x * 0.5) - y)
function code(x, y, z, t) return Float64(sqrt(Float64(z * 2.0)) * Float64(Float64(x * 0.5) - y)) end
function tmp = code(x, y, z, t) tmp = sqrt((z * 2.0)) * ((x * 0.5) - y); end
code[x_, y_, z_, t_] := N[(N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - y\right)
\end{array}
Initial program 99.8%
sqr-neg99.8%
associate-/l*99.8%
distribute-frac-neg99.8%
exp-neg99.8%
associate-*r/99.8%
*-rgt-identity99.8%
*-commutative99.8%
associate-*r/99.8%
*-rgt-identity99.8%
associate-*r/99.8%
exp-neg99.8%
distribute-frac-neg99.8%
associate-/l*99.8%
sqr-neg99.8%
Simplified99.8%
Taylor expanded in t around 0 60.0%
Final simplification60.0%
(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 2023290
(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))))