
(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 9 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 (* (- (* 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(z * Float64(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[(z * N[(2.0 * N[Exp[N[(t * t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot \left(2 \cdot e^{t \cdot t}\right)}
\end{array}
Initial program 99.4%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
expm1-log1p-u98.2%
expm1-udef77.2%
sqrt-unprod77.2%
associate-*l*77.2%
exp-prod77.2%
Applied egg-rr77.2%
expm1-def98.2%
expm1-log1p99.8%
exp-prod99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x 0.5) y)))
(if (<= (* z 2.0) 1e+118)
(* (+ (* 0.5 (* t t)) 1.0) (* t_1 (sqrt (* z 2.0))))
(* t_1 (sqrt (* 2.0 (+ z (* z (* t t)))))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double tmp;
if ((z * 2.0) <= 1e+118) {
tmp = ((0.5 * (t * t)) + 1.0) * (t_1 * sqrt((z * 2.0)));
} else {
tmp = t_1 * sqrt((2.0 * (z + (z * (t * 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) <= 1d+118) then
tmp = ((0.5d0 * (t * t)) + 1.0d0) * (t_1 * sqrt((z * 2.0d0)))
else
tmp = t_1 * sqrt((2.0d0 * (z + (z * (t * 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) <= 1e+118) {
tmp = ((0.5 * (t * t)) + 1.0) * (t_1 * Math.sqrt((z * 2.0)));
} else {
tmp = t_1 * Math.sqrt((2.0 * (z + (z * (t * t)))));
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * 0.5) - y tmp = 0 if (z * 2.0) <= 1e+118: tmp = ((0.5 * (t * t)) + 1.0) * (t_1 * math.sqrt((z * 2.0))) else: tmp = t_1 * math.sqrt((2.0 * (z + (z * (t * 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) <= 1e+118) tmp = Float64(Float64(Float64(0.5 * Float64(t * t)) + 1.0) * Float64(t_1 * sqrt(Float64(z * 2.0)))); else tmp = Float64(t_1 * sqrt(Float64(2.0 * Float64(z + Float64(z * Float64(t * 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) <= 1e+118) tmp = ((0.5 * (t * t)) + 1.0) * (t_1 * sqrt((z * 2.0))); else tmp = t_1 * sqrt((2.0 * (z + (z * (t * 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], 1e+118], N[(N[(N[(0.5 * N[(t * t), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(t$95$1 * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Sqrt[N[(2.0 * N[(z + N[(z * N[(t * 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 10^{+118}:\\
\;\;\;\;\left(0.5 \cdot \left(t \cdot t\right) + 1\right) \cdot \left(t_1 \cdot \sqrt{z \cdot 2}\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \sqrt{2 \cdot \left(z + z \cdot \left(t \cdot t\right)\right)}\\
\end{array}
\end{array}
if (*.f64 z 2) < 9.99999999999999967e117Initial program 99.2%
Taylor expanded in t around 0 78.9%
unpow278.9%
Simplified78.9%
if 9.99999999999999967e117 < (*.f64 z 2) Initial program 99.9%
associate-*l*99.9%
exp-sqrt99.9%
Simplified99.9%
expm1-log1p-u96.1%
expm1-udef96.1%
sqrt-unprod96.1%
associate-*l*96.1%
exp-prod96.1%
Applied egg-rr96.1%
expm1-def96.1%
expm1-log1p99.9%
exp-prod99.9%
Simplified99.9%
Taylor expanded in t around 0 95.3%
distribute-lft-out95.3%
*-commutative95.3%
unpow295.3%
Simplified95.3%
Final simplification84.2%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (- (* x 0.5) y))) (if (<= t 27.5) (* t_1 (sqrt (* z 2.0))) (sqrt (* (* z 2.0) (* t_1 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double tmp;
if (t <= 27.5) {
tmp = t_1 * sqrt((z * 2.0));
} else {
tmp = sqrt(((z * 2.0) * (t_1 * 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 = (x * 0.5d0) - y
if (t <= 27.5d0) then
tmp = t_1 * sqrt((z * 2.0d0))
else
tmp = sqrt(((z * 2.0d0) * (t_1 * t_1)))
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 (t <= 27.5) {
tmp = t_1 * Math.sqrt((z * 2.0));
} else {
tmp = Math.sqrt(((z * 2.0) * (t_1 * t_1)));
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * 0.5) - y tmp = 0 if t <= 27.5: tmp = t_1 * math.sqrt((z * 2.0)) else: tmp = math.sqrt(((z * 2.0) * (t_1 * t_1))) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * 0.5) - y) tmp = 0.0 if (t <= 27.5) tmp = Float64(t_1 * sqrt(Float64(z * 2.0))); else tmp = sqrt(Float64(Float64(z * 2.0) * Float64(t_1 * t_1))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * 0.5) - y; tmp = 0.0; if (t <= 27.5) tmp = t_1 * sqrt((z * 2.0)); else tmp = sqrt(((z * 2.0) * (t_1 * t_1))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[t, 27.5], N[(t$95$1 * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[(z * 2.0), $MachinePrecision] * N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
\mathbf{if}\;t \leq 27.5:\\
\;\;\;\;t_1 \cdot \sqrt{z \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\left(z \cdot 2\right) \cdot \left(t_1 \cdot t_1\right)}\\
\end{array}
\end{array}
if t < 27.5Initial program 99.7%
associate-*l*99.7%
exp-sqrt99.7%
Simplified99.7%
Taylor expanded in t around 0 69.6%
sqrt-unprod69.8%
*-commutative69.8%
Applied egg-rr69.8%
if 27.5 < t Initial program 98.4%
associate-*l*100.0%
exp-sqrt100.0%
Simplified100.0%
Taylor expanded in t around 0 15.1%
add-sqr-sqrt3.2%
sqrt-unprod15.8%
*-commutative15.8%
*-commutative15.8%
swap-sqr23.6%
sqrt-unprod23.6%
sqrt-unprod23.6%
add-sqr-sqrt23.6%
*-commutative23.6%
pow223.6%
Applied egg-rr23.6%
unpow223.6%
Applied egg-rr23.6%
Final simplification58.8%
(FPCore (x y z t) :precision binary64 (* (- (* x 0.5) y) (* (sqrt (* z 2.0)) (+ (* 0.5 (* t t)) 1.0))))
double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * (sqrt((z * 2.0)) * ((0.5 * (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)) * ((0.5d0 * (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)) * ((0.5 * (t * t)) + 1.0));
}
def code(x, y, z, t): return ((x * 0.5) - y) * (math.sqrt((z * 2.0)) * ((0.5 * (t * t)) + 1.0))
function code(x, y, z, t) return Float64(Float64(Float64(x * 0.5) - y) * Float64(sqrt(Float64(z * 2.0)) * Float64(Float64(0.5 * Float64(t * t)) + 1.0))) end
function tmp = code(x, y, z, t) tmp = ((x * 0.5) - y) * (sqrt((z * 2.0)) * ((0.5 * (t * t)) + 1.0)); end
code[x_, y_, z_, t_] := N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[(N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[(0.5 * N[(t * t), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 0.5 - y\right) \cdot \left(\sqrt{z \cdot 2} \cdot \left(0.5 \cdot \left(t \cdot t\right) + 1\right)\right)
\end{array}
Initial program 99.4%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
add-exp-log99.8%
pow1/299.8%
log-pow99.8%
add-log-exp99.8%
Applied egg-rr99.8%
Taylor expanded in t around 0 83.5%
+-commutative83.5%
unpow283.5%
Simplified83.5%
Final simplification83.5%
(FPCore (x y z t) :precision binary64 (* (- (* x 0.5) y) (sqrt (* 2.0 (+ z (* z (* t t)))))))
double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * sqrt((2.0 * (z + (z * (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((2.0d0 * (z + (z * (t * 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 + (z * (t * t)))));
}
def code(x, y, z, t): return ((x * 0.5) - y) * math.sqrt((2.0 * (z + (z * (t * t)))))
function code(x, y, z, t) return Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(2.0 * Float64(z + Float64(z * Float64(t * t)))))) end
function tmp = code(x, y, z, t) tmp = ((x * 0.5) - y) * sqrt((2.0 * (z + (z * (t * t))))); end
code[x_, y_, z_, t_] := N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(2.0 * N[(z + N[(z * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 0.5 - y\right) \cdot \sqrt{2 \cdot \left(z + z \cdot \left(t \cdot t\right)\right)}
\end{array}
Initial program 99.4%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
expm1-log1p-u98.2%
expm1-udef77.2%
sqrt-unprod77.2%
associate-*l*77.2%
exp-prod77.2%
Applied egg-rr77.2%
expm1-def98.2%
expm1-log1p99.8%
exp-prod99.8%
Simplified99.8%
Taylor expanded in t around 0 81.5%
distribute-lft-out81.5%
*-commutative81.5%
unpow281.5%
Simplified81.5%
Final simplification81.5%
(FPCore (x y z t) :precision binary64 (if (<= y -9.5e+229) (sqrt (* (* z 2.0) (* y y))) (* (- (* x 0.5) y) (sqrt (* z 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -9.5e+229) {
tmp = sqrt(((z * 2.0) * (y * y)));
} else {
tmp = ((x * 0.5) - y) * sqrt((z * 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 (y <= (-9.5d+229)) then
tmp = sqrt(((z * 2.0d0) * (y * y)))
else
tmp = ((x * 0.5d0) - y) * sqrt((z * 2.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -9.5e+229) {
tmp = Math.sqrt(((z * 2.0) * (y * y)));
} else {
tmp = ((x * 0.5) - y) * Math.sqrt((z * 2.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -9.5e+229: tmp = math.sqrt(((z * 2.0) * (y * y))) else: tmp = ((x * 0.5) - y) * math.sqrt((z * 2.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -9.5e+229) tmp = sqrt(Float64(Float64(z * 2.0) * Float64(y * y))); else tmp = Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -9.5e+229) tmp = sqrt(((z * 2.0) * (y * y))); else tmp = ((x * 0.5) - y) * sqrt((z * 2.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -9.5e+229], N[Sqrt[N[(N[(z * 2.0), $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.5 \cdot 10^{+229}:\\
\;\;\;\;\sqrt{\left(z \cdot 2\right) \cdot \left(y \cdot y\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\\
\end{array}
\end{array}
if y < -9.5e229Initial program 99.9%
associate-*l*99.9%
exp-sqrt99.9%
Simplified99.9%
Taylor expanded in t around 0 48.0%
add-sqr-sqrt47.9%
sqrt-unprod79.3%
*-commutative79.3%
*-commutative79.3%
swap-sqr84.7%
sqrt-unprod84.7%
sqrt-unprod84.7%
add-sqr-sqrt84.7%
*-commutative84.7%
pow284.7%
Applied egg-rr84.7%
Taylor expanded in x around 0 84.7%
unpow284.7%
Simplified84.7%
if -9.5e229 < y Initial program 99.4%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in t around 0 57.3%
sqrt-unprod57.4%
*-commutative57.4%
Applied egg-rr57.4%
Final simplification59.4%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2.4e-48) (not (<= y 7.4e+36))) (* y (- (sqrt (* z 2.0)))) (* x (sqrt (* 0.5 z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.4e-48) || !(y <= 7.4e+36)) {
tmp = y * -sqrt((z * 2.0));
} else {
tmp = x * sqrt((0.5 * z));
}
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 ((y <= (-2.4d-48)) .or. (.not. (y <= 7.4d+36))) then
tmp = y * -sqrt((z * 2.0d0))
else
tmp = x * sqrt((0.5d0 * z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.4e-48) || !(y <= 7.4e+36)) {
tmp = y * -Math.sqrt((z * 2.0));
} else {
tmp = x * Math.sqrt((0.5 * z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2.4e-48) or not (y <= 7.4e+36): tmp = y * -math.sqrt((z * 2.0)) else: tmp = x * math.sqrt((0.5 * z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2.4e-48) || !(y <= 7.4e+36)) tmp = Float64(y * Float64(-sqrt(Float64(z * 2.0)))); else tmp = Float64(x * sqrt(Float64(0.5 * z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -2.4e-48) || ~((y <= 7.4e+36))) tmp = y * -sqrt((z * 2.0)); else tmp = x * sqrt((0.5 * z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2.4e-48], N[Not[LessEqual[y, 7.4e+36]], $MachinePrecision]], N[(y * (-N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(x * N[Sqrt[N[(0.5 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.4 \cdot 10^{-48} \lor \neg \left(y \leq 7.4 \cdot 10^{+36}\right):\\
\;\;\;\;y \cdot \left(-\sqrt{z \cdot 2}\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \sqrt{0.5 \cdot z}\\
\end{array}
\end{array}
if y < -2.4e-48 or 7.40000000000000058e36 < y Initial program 99.8%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in t around 0 60.8%
sqrt-unprod60.9%
*-commutative60.9%
Applied egg-rr60.9%
Taylor expanded in x around 0 51.8%
mul-1-neg51.8%
associate-*l*51.8%
distribute-rgt-neg-in51.8%
*-commutative51.8%
distribute-rgt-neg-in51.8%
Simplified51.8%
associate-*r*51.7%
sqrt-prod51.9%
*-commutative51.9%
distribute-rgt-neg-out51.9%
Applied egg-rr51.9%
distribute-rgt-neg-in51.9%
*-commutative51.9%
Simplified51.9%
if -2.4e-48 < y < 7.40000000000000058e36Initial program 98.9%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in t around 0 51.4%
add-sqr-sqrt25.1%
sqrt-unprod20.8%
*-commutative20.8%
*-commutative20.8%
swap-sqr23.3%
sqrt-unprod23.3%
sqrt-unprod23.4%
add-sqr-sqrt23.4%
*-commutative23.4%
pow223.4%
Applied egg-rr23.4%
Taylor expanded in x around inf 21.8%
associate-*r*21.8%
*-commutative21.8%
unpow221.8%
Simplified21.8%
*-commutative21.8%
sqrt-prod24.2%
*-commutative24.2%
sqrt-prod22.7%
add-sqr-sqrt43.2%
Applied egg-rr43.2%
Final simplification48.0%
(FPCore (x y z t) :precision binary64 (if (<= y -8.2e-47) (sqrt (* (* z 2.0) (* y y))) (if (<= y 3.3e+38) (* x (sqrt (* 0.5 z))) (* y (- (sqrt (* z 2.0)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -8.2e-47) {
tmp = sqrt(((z * 2.0) * (y * y)));
} else if (y <= 3.3e+38) {
tmp = x * sqrt((0.5 * z));
} else {
tmp = y * -sqrt((z * 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 (y <= (-8.2d-47)) then
tmp = sqrt(((z * 2.0d0) * (y * y)))
else if (y <= 3.3d+38) then
tmp = x * sqrt((0.5d0 * z))
else
tmp = y * -sqrt((z * 2.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -8.2e-47) {
tmp = Math.sqrt(((z * 2.0) * (y * y)));
} else if (y <= 3.3e+38) {
tmp = x * Math.sqrt((0.5 * z));
} else {
tmp = y * -Math.sqrt((z * 2.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -8.2e-47: tmp = math.sqrt(((z * 2.0) * (y * y))) elif y <= 3.3e+38: tmp = x * math.sqrt((0.5 * z)) else: tmp = y * -math.sqrt((z * 2.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -8.2e-47) tmp = sqrt(Float64(Float64(z * 2.0) * Float64(y * y))); elseif (y <= 3.3e+38) tmp = Float64(x * sqrt(Float64(0.5 * z))); else tmp = Float64(y * Float64(-sqrt(Float64(z * 2.0)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -8.2e-47) tmp = sqrt(((z * 2.0) * (y * y))); elseif (y <= 3.3e+38) tmp = x * sqrt((0.5 * z)); else tmp = y * -sqrt((z * 2.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -8.2e-47], N[Sqrt[N[(N[(z * 2.0), $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[y, 3.3e+38], N[(x * N[Sqrt[N[(0.5 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(y * (-N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.2 \cdot 10^{-47}:\\
\;\;\;\;\sqrt{\left(z \cdot 2\right) \cdot \left(y \cdot y\right)}\\
\mathbf{elif}\;y \leq 3.3 \cdot 10^{+38}:\\
\;\;\;\;x \cdot \sqrt{0.5 \cdot z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-\sqrt{z \cdot 2}\right)\\
\end{array}
\end{array}
if y < -8.20000000000000003e-47Initial program 99.8%
associate-*l*99.8%
exp-sqrt99.7%
Simplified99.7%
Taylor expanded in t around 0 58.3%
add-sqr-sqrt56.4%
sqrt-unprod61.2%
*-commutative61.2%
*-commutative61.2%
swap-sqr60.2%
sqrt-unprod60.2%
sqrt-unprod60.2%
add-sqr-sqrt60.2%
*-commutative60.2%
pow260.2%
Applied egg-rr60.2%
Taylor expanded in x around 0 54.5%
unpow254.5%
Simplified54.5%
if -8.20000000000000003e-47 < y < 3.2999999999999999e38Initial program 98.9%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in t around 0 51.4%
add-sqr-sqrt25.1%
sqrt-unprod20.8%
*-commutative20.8%
*-commutative20.8%
swap-sqr23.3%
sqrt-unprod23.3%
sqrt-unprod23.4%
add-sqr-sqrt23.4%
*-commutative23.4%
pow223.4%
Applied egg-rr23.4%
Taylor expanded in x around inf 21.8%
associate-*r*21.8%
*-commutative21.8%
unpow221.8%
Simplified21.8%
*-commutative21.8%
sqrt-prod24.2%
*-commutative24.2%
sqrt-prod22.7%
add-sqr-sqrt43.2%
Applied egg-rr43.2%
if 3.2999999999999999e38 < y Initial program 99.9%
associate-*l*99.9%
exp-sqrt99.9%
Simplified99.9%
Taylor expanded in t around 0 64.1%
sqrt-unprod64.3%
*-commutative64.3%
Applied egg-rr64.3%
Taylor expanded in x around 0 55.9%
mul-1-neg55.9%
associate-*l*55.9%
distribute-rgt-neg-in55.9%
*-commutative55.9%
distribute-rgt-neg-in55.9%
Simplified55.9%
associate-*r*55.9%
sqrt-prod56.1%
*-commutative56.1%
distribute-rgt-neg-out56.1%
Applied egg-rr56.1%
distribute-rgt-neg-in56.1%
*-commutative56.1%
Simplified56.1%
Final simplification49.9%
(FPCore (x y z t) :precision binary64 (* x (sqrt (* 0.5 z))))
double code(double x, double y, double z, double t) {
return x * sqrt((0.5 * z));
}
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 * sqrt((0.5d0 * z))
end function
public static double code(double x, double y, double z, double t) {
return x * Math.sqrt((0.5 * z));
}
def code(x, y, z, t): return x * math.sqrt((0.5 * z))
function code(x, y, z, t) return Float64(x * sqrt(Float64(0.5 * z))) end
function tmp = code(x, y, z, t) tmp = x * sqrt((0.5 * z)); end
code[x_, y_, z_, t_] := N[(x * N[Sqrt[N[(0.5 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \sqrt{0.5 \cdot z}
\end{array}
Initial program 99.4%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in t around 0 56.6%
add-sqr-sqrt30.4%
sqrt-unprod30.2%
*-commutative30.2%
*-commutative30.2%
swap-sqr31.0%
sqrt-unprod31.0%
sqrt-unprod31.0%
add-sqr-sqrt31.1%
*-commutative31.1%
pow231.1%
Applied egg-rr31.1%
Taylor expanded in x around inf 17.0%
associate-*r*17.0%
*-commutative17.0%
unpow217.0%
Simplified17.0%
*-commutative17.0%
sqrt-prod17.1%
*-commutative17.1%
sqrt-prod14.7%
add-sqr-sqrt26.2%
Applied egg-rr26.2%
Final simplification26.2%
(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 2023257
(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))))