
(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 10 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)) (sqrt (pow (exp (+ t t)) (/ t 2.0))))))
double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * (sqrt((z * 2.0)) * sqrt(pow(exp((t + 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)) * sqrt((exp((t + 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.sqrt(Math.pow(Math.exp((t + t)), (t / 2.0))));
}
def code(x, y, z, t): return ((x * 0.5) - y) * (math.sqrt((z * 2.0)) * math.sqrt(math.pow(math.exp((t + t)), (t / 2.0))))
function code(x, y, z, t) return Float64(Float64(Float64(x * 0.5) - y) * Float64(sqrt(Float64(z * 2.0)) * sqrt((exp(Float64(t + t)) ^ Float64(t / 2.0))))) end
function tmp = code(x, y, z, t) tmp = ((x * 0.5) - y) * (sqrt((z * 2.0)) * sqrt((exp((t + t)) ^ (t / 2.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[Sqrt[N[Power[N[Exp[N[(t + t), $MachinePrecision]], $MachinePrecision], N[(t / 2.0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 0.5 - y\right) \cdot \left(\sqrt{z \cdot 2} \cdot \sqrt{{\left(e^{t + t}\right)}^{\left(\frac{t}{2}\right)}}\right)
\end{array}
Initial program 99.8%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
exp-prod99.8%
sqr-pow99.8%
pow-prod-down99.8%
pow299.8%
add-log-exp99.8%
div-inv99.8%
metadata-eval99.8%
pow-exp99.8%
log-pow99.8%
add-log-exp99.8%
Applied egg-rr99.8%
unpow299.8%
prod-exp99.8%
/-rgt-identity99.8%
metadata-eval99.8%
associate-/l*99.8%
*-commutative99.8%
associate-*r*99.8%
metadata-eval99.8%
*-lft-identity99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (* (- (* x 0.5) y) (sqrt (* z (* 2.0 (pow (exp t) t))))))
double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * sqrt((z * (2.0 * 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 = ((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.pow(Math.exp(t), t))));
}
def code(x, y, z, t): return ((x * 0.5) - y) * math.sqrt((z * (2.0 * math.pow(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(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[Power[N[Exp[t], $MachinePrecision], t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot \left(2 \cdot {\left(e^{t}\right)}^{t}\right)}
\end{array}
Initial program 99.8%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
expm1-log1p-u98.7%
expm1-udef72.6%
sqrt-unprod72.6%
associate-*l*72.6%
exp-prod72.6%
Applied egg-rr72.6%
expm1-def98.7%
expm1-log1p99.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%
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%
add-sqr-sqrt99.5%
sqrt-unprod99.8%
swap-sqr99.8%
add-sqr-sqrt99.8%
*-commutative99.8%
metadata-eval99.8%
div-inv99.8%
exp-sqrt99.8%
*-commutative99.8%
metadata-eval99.8%
div-inv99.8%
exp-sqrt99.8%
add-sqr-sqrt99.8%
exp-prod99.8%
Applied egg-rr99.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) 2e+134)
(* (* t_1 (sqrt (* z 2.0))) (+ 1.0 (* 0.5 (* t t))))
(* t_1 (sqrt (* (* z 2.0) (+ (* t t) 1.0)))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double tmp;
if ((z * 2.0) <= 2e+134) {
tmp = (t_1 * sqrt((z * 2.0))) * (1.0 + (0.5 * (t * t)));
} else {
tmp = t_1 * 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) :: t_1
real(8) :: tmp
t_1 = (x * 0.5d0) - y
if ((z * 2.0d0) <= 2d+134) then
tmp = (t_1 * sqrt((z * 2.0d0))) * (1.0d0 + (0.5d0 * (t * t)))
else
tmp = t_1 * 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 t_1 = (x * 0.5) - y;
double tmp;
if ((z * 2.0) <= 2e+134) {
tmp = (t_1 * Math.sqrt((z * 2.0))) * (1.0 + (0.5 * (t * t)));
} else {
tmp = t_1 * Math.sqrt(((z * 2.0) * ((t * t) + 1.0)));
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * 0.5) - y tmp = 0 if (z * 2.0) <= 2e+134: tmp = (t_1 * math.sqrt((z * 2.0))) * (1.0 + (0.5 * (t * t))) else: tmp = t_1 * math.sqrt(((z * 2.0) * ((t * t) + 1.0))) 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+134) tmp = Float64(Float64(t_1 * sqrt(Float64(z * 2.0))) * Float64(1.0 + Float64(0.5 * Float64(t * t)))); else tmp = Float64(t_1 * sqrt(Float64(Float64(z * 2.0) * Float64(Float64(t * t) + 1.0)))); 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+134) tmp = (t_1 * sqrt((z * 2.0))) * (1.0 + (0.5 * (t * t))); else tmp = t_1 * sqrt(((z * 2.0) * ((t * t) + 1.0))); 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+134], N[(N[(t$95$1 * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(0.5 * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * 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}
t_1 := x \cdot 0.5 - y\\
\mathbf{if}\;z \cdot 2 \leq 2 \cdot 10^{+134}:\\
\;\;\;\;\left(t_1 \cdot \sqrt{z \cdot 2}\right) \cdot \left(1 + 0.5 \cdot \left(t \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \sqrt{\left(z \cdot 2\right) \cdot \left(t \cdot t + 1\right)}\\
\end{array}
\end{array}
if (*.f64 z 2) < 1.99999999999999984e134Initial program 99.7%
Taylor expanded in t around 0 84.0%
unpow284.0%
Simplified84.0%
if 1.99999999999999984e134 < (*.f64 z 2) Initial program 99.9%
associate-*l*99.9%
exp-sqrt99.9%
Simplified99.9%
add-exp-log99.9%
pow1/299.9%
log-pow99.9%
add-log-exp99.9%
Applied egg-rr99.9%
add-sqr-sqrt99.7%
sqrt-unprod99.9%
swap-sqr99.9%
add-sqr-sqrt99.9%
*-commutative99.9%
metadata-eval99.9%
div-inv99.9%
exp-sqrt99.9%
*-commutative99.9%
metadata-eval99.9%
div-inv99.9%
exp-sqrt99.9%
add-sqr-sqrt99.9%
exp-prod99.9%
Applied egg-rr99.9%
Taylor expanded in t around 0 99.9%
+-commutative99.9%
unpow299.9%
Simplified99.9%
Final simplification88.3%
(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%
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%
add-sqr-sqrt99.5%
sqrt-unprod99.8%
swap-sqr99.8%
add-sqr-sqrt99.8%
*-commutative99.8%
metadata-eval99.8%
div-inv99.8%
exp-sqrt99.8%
*-commutative99.8%
metadata-eval99.8%
div-inv99.8%
exp-sqrt99.8%
add-sqr-sqrt99.8%
exp-prod99.8%
Applied egg-rr99.8%
Taylor expanded in t around 0 86.0%
+-commutative86.0%
unpow286.0%
Simplified86.0%
Final simplification86.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x 3.6e-38) (and (not (<= x 1.85e-22)) (<= x 1.25e+14))) (* (sqrt (+ z z)) (- y)) (sqrt (* (* 0.5 z) (* x x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= 3.6e-38) || (!(x <= 1.85e-22) && (x <= 1.25e+14))) {
tmp = sqrt((z + z)) * -y;
} else {
tmp = sqrt(((0.5 * z) * (x * x)));
}
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 <= 3.6d-38) .or. (.not. (x <= 1.85d-22)) .and. (x <= 1.25d+14)) then
tmp = sqrt((z + z)) * -y
else
tmp = sqrt(((0.5d0 * z) * (x * x)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= 3.6e-38) || (!(x <= 1.85e-22) && (x <= 1.25e+14))) {
tmp = Math.sqrt((z + z)) * -y;
} else {
tmp = Math.sqrt(((0.5 * z) * (x * x)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= 3.6e-38) or (not (x <= 1.85e-22) and (x <= 1.25e+14)): tmp = math.sqrt((z + z)) * -y else: tmp = math.sqrt(((0.5 * z) * (x * x))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= 3.6e-38) || (!(x <= 1.85e-22) && (x <= 1.25e+14))) tmp = Float64(sqrt(Float64(z + z)) * Float64(-y)); else tmp = sqrt(Float64(Float64(0.5 * z) * Float64(x * x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= 3.6e-38) || (~((x <= 1.85e-22)) && (x <= 1.25e+14))) tmp = sqrt((z + z)) * -y; else tmp = sqrt(((0.5 * z) * (x * x))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, 3.6e-38], And[N[Not[LessEqual[x, 1.85e-22]], $MachinePrecision], LessEqual[x, 1.25e+14]]], N[(N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision] * (-y)), $MachinePrecision], N[Sqrt[N[(N[(0.5 * z), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.6 \cdot 10^{-38} \lor \neg \left(x \leq 1.85 \cdot 10^{-22}\right) \land x \leq 1.25 \cdot 10^{+14}:\\
\;\;\;\;\sqrt{z + z} \cdot \left(-y\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\left(0.5 \cdot z\right) \cdot \left(x \cdot x\right)}\\
\end{array}
\end{array}
if x < 3.6000000000000001e-38 or 1.85e-22 < x < 1.25e14Initial program 99.7%
Taylor expanded in t around 0 52.9%
Taylor expanded in x around 0 35.4%
mul-1-neg35.4%
*-commutative35.4%
distribute-rgt-neg-in35.4%
distribute-rgt-neg-in35.4%
Simplified35.4%
associate-*r*35.4%
sqrt-prod35.4%
distribute-rgt-neg-out35.4%
Applied egg-rr35.4%
distribute-rgt-neg-in35.4%
*-commutative35.4%
rem-log-exp28.8%
log-pow28.8%
unpow228.8%
prod-exp28.8%
rem-log-exp35.4%
Simplified35.4%
if 3.6000000000000001e-38 < x < 1.85e-22 or 1.25e14 < x Initial program 99.8%
Taylor expanded in t around 0 69.0%
add-sqr-sqrt63.8%
sqrt-unprod58.4%
*-commutative58.4%
*-commutative58.4%
swap-sqr55.2%
add-sqr-sqrt55.3%
pow255.3%
Applied egg-rr55.3%
Taylor expanded in x around inf 54.1%
associate-*r*54.1%
*-commutative54.1%
unpow254.1%
Simplified54.1%
Final simplification40.0%
(FPCore (x y z t) :precision binary64 (if (<= t 1400000.0) (* (- (* x 0.5) y) (sqrt (* z 2.0))) (sqrt (* (* z 2.0) (* y y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1400000.0) {
tmp = ((x * 0.5) - y) * sqrt((z * 2.0));
} else {
tmp = sqrt(((z * 2.0) * (y * 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 <= 1400000.0d0) then
tmp = ((x * 0.5d0) - y) * sqrt((z * 2.0d0))
else
tmp = sqrt(((z * 2.0d0) * (y * y)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1400000.0) {
tmp = ((x * 0.5) - y) * Math.sqrt((z * 2.0));
} else {
tmp = Math.sqrt(((z * 2.0) * (y * y)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 1400000.0: tmp = ((x * 0.5) - y) * math.sqrt((z * 2.0)) else: tmp = math.sqrt(((z * 2.0) * (y * y))) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 1400000.0) tmp = Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))); else tmp = sqrt(Float64(Float64(z * 2.0) * Float64(y * y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 1400000.0) tmp = ((x * 0.5) - y) * sqrt((z * 2.0)); else tmp = sqrt(((z * 2.0) * (y * y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 1400000.0], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[(z * 2.0), $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1400000:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\left(z \cdot 2\right) \cdot \left(y \cdot y\right)}\\
\end{array}
\end{array}
if t < 1.4e6Initial program 99.7%
Taylor expanded in t around 0 69.5%
if 1.4e6 < t Initial program 100.0%
Taylor expanded in t around 0 17.9%
Taylor expanded in x around 0 7.6%
mul-1-neg7.6%
*-commutative7.6%
distribute-rgt-neg-in7.6%
distribute-rgt-neg-in7.6%
Simplified7.6%
add-sqr-sqrt4.7%
sqrt-unprod18.8%
associate-*r*18.8%
sqrt-prod18.8%
associate-*r*18.8%
sqrt-prod18.8%
swap-sqr20.3%
add-sqr-sqrt20.3%
sqr-neg20.3%
Applied egg-rr20.3%
Final simplification57.4%
(FPCore (x y z t) :precision binary64 (if (<= t 950000.0) (* (sqrt (+ z z)) (- y)) (sqrt (* y (* 2.0 (* y z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 950000.0) {
tmp = sqrt((z + z)) * -y;
} else {
tmp = sqrt((y * (2.0 * (y * 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 (t <= 950000.0d0) then
tmp = sqrt((z + z)) * -y
else
tmp = sqrt((y * (2.0d0 * (y * z))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 950000.0) {
tmp = Math.sqrt((z + z)) * -y;
} else {
tmp = Math.sqrt((y * (2.0 * (y * z))));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 950000.0: tmp = math.sqrt((z + z)) * -y else: tmp = math.sqrt((y * (2.0 * (y * z)))) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 950000.0) tmp = Float64(sqrt(Float64(z + z)) * Float64(-y)); else tmp = sqrt(Float64(y * Float64(2.0 * Float64(y * z)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 950000.0) tmp = sqrt((z + z)) * -y; else tmp = sqrt((y * (2.0 * (y * z)))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 950000.0], N[(N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision] * (-y)), $MachinePrecision], N[Sqrt[N[(y * N[(2.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 950000:\\
\;\;\;\;\sqrt{z + z} \cdot \left(-y\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{y \cdot \left(2 \cdot \left(y \cdot z\right)\right)}\\
\end{array}
\end{array}
if t < 9.5e5Initial program 99.7%
Taylor expanded in t around 0 69.5%
Taylor expanded in x around 0 37.5%
mul-1-neg37.5%
*-commutative37.5%
distribute-rgt-neg-in37.5%
distribute-rgt-neg-in37.5%
Simplified37.5%
associate-*r*37.5%
sqrt-prod37.6%
distribute-rgt-neg-out37.6%
Applied egg-rr37.6%
distribute-rgt-neg-in37.6%
*-commutative37.6%
rem-log-exp25.0%
log-pow25.0%
unpow225.0%
prod-exp25.0%
rem-log-exp37.6%
Simplified37.6%
if 9.5e5 < t Initial program 100.0%
Taylor expanded in t around 0 17.9%
add-sqr-sqrt11.3%
sqrt-unprod27.9%
*-commutative27.9%
*-commutative27.9%
swap-sqr27.9%
add-sqr-sqrt27.9%
pow227.9%
Applied egg-rr27.9%
Taylor expanded in x around 0 20.3%
*-commutative20.3%
unpow220.3%
associate-*r*20.3%
associate-*l*18.8%
*-commutative18.8%
*-commutative18.8%
associate-*l*18.8%
*-commutative18.8%
Simplified18.8%
Final simplification32.9%
(FPCore (x y z t) :precision binary64 (* (sqrt (+ z z)) (- y)))
double code(double x, double y, double z, double t) {
return sqrt((z + z)) * -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 + z)) * -y
end function
public static double code(double x, double y, double z, double t) {
return Math.sqrt((z + z)) * -y;
}
def code(x, y, z, t): return math.sqrt((z + z)) * -y
function code(x, y, z, t) return Float64(sqrt(Float64(z + z)) * Float64(-y)) end
function tmp = code(x, y, z, t) tmp = sqrt((z + z)) * -y; end
code[x_, y_, z_, t_] := N[(N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision] * (-y)), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{z + z} \cdot \left(-y\right)
\end{array}
Initial program 99.8%
Taylor expanded in t around 0 56.8%
Taylor expanded in x around 0 30.1%
mul-1-neg30.1%
*-commutative30.1%
distribute-rgt-neg-in30.1%
distribute-rgt-neg-in30.1%
Simplified30.1%
associate-*r*30.1%
sqrt-prod30.2%
distribute-rgt-neg-out30.2%
Applied egg-rr30.2%
distribute-rgt-neg-in30.2%
*-commutative30.2%
rem-log-exp27.7%
log-pow27.7%
unpow227.7%
prod-exp27.7%
rem-log-exp30.2%
Simplified30.2%
Final simplification30.2%
(FPCore (x y z t) :precision binary64 (* y (sqrt (+ z z))))
double code(double x, double y, double z, double t) {
return y * sqrt((z + 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 = y * sqrt((z + z))
end function
public static double code(double x, double y, double z, double t) {
return y * Math.sqrt((z + z));
}
def code(x, y, z, t): return y * math.sqrt((z + z))
function code(x, y, z, t) return Float64(y * sqrt(Float64(z + z))) end
function tmp = code(x, y, z, t) tmp = y * sqrt((z + z)); end
code[x_, y_, z_, t_] := N[(y * N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \sqrt{z + z}
\end{array}
Initial program 99.8%
Taylor expanded in t around 0 56.8%
Taylor expanded in x around 0 30.1%
mul-1-neg30.1%
*-commutative30.1%
distribute-rgt-neg-in30.1%
distribute-rgt-neg-in30.1%
Simplified30.1%
expm1-log1p-u19.9%
expm1-udef12.1%
associate-*r*12.1%
sqrt-prod12.1%
add-sqr-sqrt11.0%
sqrt-unprod14.9%
sqr-neg14.9%
sqrt-unprod1.4%
add-sqr-sqrt2.9%
Applied egg-rr2.9%
expm1-def2.7%
expm1-log1p2.9%
*-commutative2.9%
*-commutative2.9%
rem-log-exp9.0%
log-pow9.0%
unpow29.0%
prod-exp9.0%
rem-log-exp2.9%
Simplified2.9%
Final simplification2.9%
(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 2023240
(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))))