
(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) 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}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (exp (/ (* t t) 2.0))))
(if (or (<= (* x 0.5) -2e+82) (not (<= (* x 0.5) 2e-8)))
(* t_1 (* x (sqrt (* 0.5 z))))
(* t_1 (* y (- (sqrt (+ z z))))))))
double code(double x, double y, double z, double t) {
double t_1 = exp(((t * t) / 2.0));
double tmp;
if (((x * 0.5) <= -2e+82) || !((x * 0.5) <= 2e-8)) {
tmp = t_1 * (x * sqrt((0.5 * z)));
} else {
tmp = t_1 * (y * -sqrt((z + 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) :: t_1
real(8) :: tmp
t_1 = exp(((t * t) / 2.0d0))
if (((x * 0.5d0) <= (-2d+82)) .or. (.not. ((x * 0.5d0) <= 2d-8))) then
tmp = t_1 * (x * sqrt((0.5d0 * z)))
else
tmp = t_1 * (y * -sqrt((z + z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.exp(((t * t) / 2.0));
double tmp;
if (((x * 0.5) <= -2e+82) || !((x * 0.5) <= 2e-8)) {
tmp = t_1 * (x * Math.sqrt((0.5 * z)));
} else {
tmp = t_1 * (y * -Math.sqrt((z + z)));
}
return tmp;
}
def code(x, y, z, t): t_1 = math.exp(((t * t) / 2.0)) tmp = 0 if ((x * 0.5) <= -2e+82) or not ((x * 0.5) <= 2e-8): tmp = t_1 * (x * math.sqrt((0.5 * z))) else: tmp = t_1 * (y * -math.sqrt((z + z))) return tmp
function code(x, y, z, t) t_1 = exp(Float64(Float64(t * t) / 2.0)) tmp = 0.0 if ((Float64(x * 0.5) <= -2e+82) || !(Float64(x * 0.5) <= 2e-8)) tmp = Float64(t_1 * Float64(x * sqrt(Float64(0.5 * z)))); else tmp = Float64(t_1 * Float64(y * Float64(-sqrt(Float64(z + z))))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = exp(((t * t) / 2.0)); tmp = 0.0; if (((x * 0.5) <= -2e+82) || ~(((x * 0.5) <= 2e-8))) tmp = t_1 * (x * sqrt((0.5 * z))); else tmp = t_1 * (y * -sqrt((z + z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[N[(x * 0.5), $MachinePrecision], -2e+82], N[Not[LessEqual[N[(x * 0.5), $MachinePrecision], 2e-8]], $MachinePrecision]], N[(t$95$1 * N[(x * N[Sqrt[N[(0.5 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(y * (-N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := e^{\frac{t \cdot t}{2}}\\
\mathbf{if}\;x \cdot 0.5 \leq -2 \cdot 10^{+82} \lor \neg \left(x \cdot 0.5 \leq 2 \cdot 10^{-8}\right):\\
\;\;\;\;t_1 \cdot \left(x \cdot \sqrt{0.5 \cdot z}\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(y \cdot \left(-\sqrt{z + z}\right)\right)\\
\end{array}
\end{array}
if (*.f64 x 1/2) < -1.9999999999999999e82 or 2e-8 < (*.f64 x 1/2) Initial program 99.8%
add-sqr-sqrt57.9%
sqrt-unprod48.2%
*-commutative48.2%
*-commutative48.2%
swap-sqr45.1%
add-sqr-sqrt45.2%
add-log-exp23.9%
exp-lft-sqr23.9%
log-prod23.9%
add-log-exp36.8%
add-log-exp45.2%
pow245.2%
Applied egg-rr45.2%
Taylor expanded in x around inf 45.1%
*-commutative45.1%
unpow245.1%
Simplified45.1%
associate-*r*45.1%
sqrt-prod46.6%
sqrt-prod53.3%
add-sqr-sqrt86.2%
Applied egg-rr86.2%
if -1.9999999999999999e82 < (*.f64 x 1/2) < 2e-8Initial program 99.9%
Taylor expanded in x around 0 84.5%
mul-1-neg84.5%
associate-*l*84.6%
distribute-rgt-neg-in84.6%
*-commutative84.6%
distribute-rgt-neg-in84.6%
Simplified84.6%
distribute-rgt-neg-out84.6%
add-sqr-sqrt84.6%
sqr-neg84.6%
sqrt-unprod0.0%
add-sqr-sqrt3.2%
*-commutative3.2%
add-sqr-sqrt0.0%
sqrt-unprod84.6%
sqr-neg84.6%
add-sqr-sqrt84.6%
sqrt-prod84.7%
count-284.7%
Applied egg-rr84.7%
Final simplification85.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (exp (/ (* t t) 2.0))))
(if (<= y -2.45e+39)
(* t_1 (* y (* z -2.0)))
(if (<= y 1.55e+74)
(* t_1 (* x (sqrt (* 0.5 z))))
(- (sqrt (* 2.0 (* (* y (* y z)) (exp (* t t))))))))))
double code(double x, double y, double z, double t) {
double t_1 = exp(((t * t) / 2.0));
double tmp;
if (y <= -2.45e+39) {
tmp = t_1 * (y * (z * -2.0));
} else if (y <= 1.55e+74) {
tmp = t_1 * (x * sqrt((0.5 * z)));
} else {
tmp = -sqrt((2.0 * ((y * (y * z)) * exp((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 = exp(((t * t) / 2.0d0))
if (y <= (-2.45d+39)) then
tmp = t_1 * (y * (z * (-2.0d0)))
else if (y <= 1.55d+74) then
tmp = t_1 * (x * sqrt((0.5d0 * z)))
else
tmp = -sqrt((2.0d0 * ((y * (y * z)) * exp((t * t)))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.exp(((t * t) / 2.0));
double tmp;
if (y <= -2.45e+39) {
tmp = t_1 * (y * (z * -2.0));
} else if (y <= 1.55e+74) {
tmp = t_1 * (x * Math.sqrt((0.5 * z)));
} else {
tmp = -Math.sqrt((2.0 * ((y * (y * z)) * Math.exp((t * t)))));
}
return tmp;
}
def code(x, y, z, t): t_1 = math.exp(((t * t) / 2.0)) tmp = 0 if y <= -2.45e+39: tmp = t_1 * (y * (z * -2.0)) elif y <= 1.55e+74: tmp = t_1 * (x * math.sqrt((0.5 * z))) else: tmp = -math.sqrt((2.0 * ((y * (y * z)) * math.exp((t * t))))) return tmp
function code(x, y, z, t) t_1 = exp(Float64(Float64(t * t) / 2.0)) tmp = 0.0 if (y <= -2.45e+39) tmp = Float64(t_1 * Float64(y * Float64(z * -2.0))); elseif (y <= 1.55e+74) tmp = Float64(t_1 * Float64(x * sqrt(Float64(0.5 * z)))); else tmp = Float64(-sqrt(Float64(2.0 * Float64(Float64(y * Float64(y * z)) * exp(Float64(t * t)))))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = exp(((t * t) / 2.0)); tmp = 0.0; if (y <= -2.45e+39) tmp = t_1 * (y * (z * -2.0)); elseif (y <= 1.55e+74) tmp = t_1 * (x * sqrt((0.5 * z))); else tmp = -sqrt((2.0 * ((y * (y * z)) * exp((t * t))))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, -2.45e+39], N[(t$95$1 * N[(y * N[(z * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.55e+74], N[(t$95$1 * N[(x * N[Sqrt[N[(0.5 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-N[Sqrt[N[(2.0 * N[(N[(y * N[(y * z), $MachinePrecision]), $MachinePrecision] * N[Exp[N[(t * t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := e^{\frac{t \cdot t}{2}}\\
\mathbf{if}\;y \leq -2.45 \cdot 10^{+39}:\\
\;\;\;\;t_1 \cdot \left(y \cdot \left(z \cdot -2\right)\right)\\
\mathbf{elif}\;y \leq 1.55 \cdot 10^{+74}:\\
\;\;\;\;t_1 \cdot \left(x \cdot \sqrt{0.5 \cdot z}\right)\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{2 \cdot \left(\left(y \cdot \left(y \cdot z\right)\right) \cdot e^{t \cdot t}\right)}\\
\end{array}
\end{array}
if y < -2.44999999999999994e39Initial program 99.9%
Taylor expanded in x around 0 92.4%
mul-1-neg92.4%
associate-*l*92.6%
distribute-rgt-neg-in92.6%
*-commutative92.6%
distribute-rgt-neg-in92.6%
Simplified92.6%
*-commutative92.6%
add-sqr-sqrt0.0%
sqrt-unprod0.4%
sqr-neg0.4%
add-sqr-sqrt0.4%
sqrt-prod0.4%
count-20.4%
expm1-log1p-u0.4%
expm1-udef0.6%
Applied egg-rr0.6%
expm1-def0.4%
expm1-log1p0.4%
Simplified0.4%
add-sqr-sqrt0.0%
sqrt-unprod70.3%
sqr-neg70.3%
distribute-rgt-neg-out70.3%
distribute-rgt-neg-out70.3%
sqrt-unprod92.5%
add-sqr-sqrt92.8%
distribute-rgt-neg-out92.8%
neg-sub092.8%
add-sqr-sqrt0.0%
sqrt-unprod0.3%
sqr-neg0.3%
distribute-rgt-neg-out0.3%
distribute-rgt-neg-out0.3%
sqrt-unprod0.4%
add-sqr-sqrt0.4%
add-sqr-sqrt0.0%
Applied egg-rr64.0%
neg-sub064.0%
distribute-rgt-neg-in64.0%
count-264.0%
distribute-lft-neg-in64.0%
metadata-eval64.0%
Simplified64.0%
if -2.44999999999999994e39 < y < 1.55000000000000011e74Initial program 99.8%
add-sqr-sqrt54.3%
sqrt-unprod46.1%
*-commutative46.1%
*-commutative46.1%
swap-sqr42.8%
add-sqr-sqrt42.9%
add-log-exp18.4%
exp-lft-sqr18.4%
log-prod18.4%
add-log-exp27.9%
add-log-exp42.9%
pow242.9%
Applied egg-rr42.9%
Taylor expanded in x around inf 33.3%
*-commutative33.3%
unpow233.3%
Simplified33.3%
associate-*r*33.3%
sqrt-prod35.8%
sqrt-prod42.1%
add-sqr-sqrt77.5%
Applied egg-rr77.5%
if 1.55000000000000011e74 < y Initial program 99.9%
*-commutative99.9%
flip--67.0%
associate-*r/67.0%
add-log-exp35.0%
exp-lft-sqr35.0%
log-prod35.0%
add-log-exp59.7%
add-log-exp67.0%
swap-sqr67.0%
metadata-eval67.0%
fma-def67.0%
Applied egg-rr67.0%
*-commutative67.0%
associate-/l*54.7%
Simplified54.7%
Taylor expanded in x around 0 89.9%
mul-1-neg89.9%
distribute-rgt-neg-in89.9%
Simplified89.9%
distribute-rgt-neg-out89.9%
*-commutative89.9%
associate-*r*89.9%
distribute-lft-neg-out89.9%
add-sqr-sqrt89.9%
sqr-neg89.9%
sqrt-unprod0.0%
add-sqr-sqrt6.3%
associate-*l*6.3%
*-commutative6.3%
add-sqr-sqrt0.0%
sqrt-unprod76.9%
Applied egg-rr71.3%
*-commutative71.3%
associate-*l*71.3%
*-commutative71.3%
associate-*l*77.0%
exp-prod77.0%
Simplified77.0%
Final simplification74.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (exp (/ (* t t) 2.0))))
(if (or (<= y -2.6e+39) (not (<= y 9e+113)))
(* t_1 (* y (* z -2.0)))
(* t_1 (* x (sqrt (* 0.5 z)))))))
double code(double x, double y, double z, double t) {
double t_1 = exp(((t * t) / 2.0));
double tmp;
if ((y <= -2.6e+39) || !(y <= 9e+113)) {
tmp = t_1 * (y * (z * -2.0));
} else {
tmp = t_1 * (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) :: t_1
real(8) :: tmp
t_1 = exp(((t * t) / 2.0d0))
if ((y <= (-2.6d+39)) .or. (.not. (y <= 9d+113))) then
tmp = t_1 * (y * (z * (-2.0d0)))
else
tmp = t_1 * (x * sqrt((0.5d0 * z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.exp(((t * t) / 2.0));
double tmp;
if ((y <= -2.6e+39) || !(y <= 9e+113)) {
tmp = t_1 * (y * (z * -2.0));
} else {
tmp = t_1 * (x * Math.sqrt((0.5 * z)));
}
return tmp;
}
def code(x, y, z, t): t_1 = math.exp(((t * t) / 2.0)) tmp = 0 if (y <= -2.6e+39) or not (y <= 9e+113): tmp = t_1 * (y * (z * -2.0)) else: tmp = t_1 * (x * math.sqrt((0.5 * z))) return tmp
function code(x, y, z, t) t_1 = exp(Float64(Float64(t * t) / 2.0)) tmp = 0.0 if ((y <= -2.6e+39) || !(y <= 9e+113)) tmp = Float64(t_1 * Float64(y * Float64(z * -2.0))); else tmp = Float64(t_1 * Float64(x * sqrt(Float64(0.5 * z)))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = exp(((t * t) / 2.0)); tmp = 0.0; if ((y <= -2.6e+39) || ~((y <= 9e+113))) tmp = t_1 * (y * (z * -2.0)); else tmp = t_1 * (x * sqrt((0.5 * z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[y, -2.6e+39], N[Not[LessEqual[y, 9e+113]], $MachinePrecision]], N[(t$95$1 * N[(y * N[(z * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(x * N[Sqrt[N[(0.5 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := e^{\frac{t \cdot t}{2}}\\
\mathbf{if}\;y \leq -2.6 \cdot 10^{+39} \lor \neg \left(y \leq 9 \cdot 10^{+113}\right):\\
\;\;\;\;t_1 \cdot \left(y \cdot \left(z \cdot -2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(x \cdot \sqrt{0.5 \cdot z}\right)\\
\end{array}
\end{array}
if y < -2.6e39 or 9.0000000000000001e113 < y Initial program 99.9%
Taylor expanded in x around 0 93.6%
mul-1-neg93.6%
associate-*l*93.7%
distribute-rgt-neg-in93.7%
*-commutative93.7%
distribute-rgt-neg-in93.7%
Simplified93.7%
*-commutative93.7%
add-sqr-sqrt0.0%
sqrt-unprod1.3%
sqr-neg1.3%
add-sqr-sqrt1.3%
sqrt-prod1.3%
count-21.3%
expm1-log1p-u1.3%
expm1-udef1.5%
Applied egg-rr1.5%
expm1-def1.3%
expm1-log1p1.3%
Simplified1.3%
add-sqr-sqrt1.1%
sqrt-unprod41.1%
sqr-neg41.1%
distribute-rgt-neg-out41.1%
distribute-rgt-neg-out41.1%
sqrt-unprod52.6%
add-sqr-sqrt93.9%
distribute-rgt-neg-out93.9%
neg-sub093.9%
add-sqr-sqrt41.1%
sqrt-unprod35.4%
sqr-neg35.4%
distribute-rgt-neg-out35.4%
distribute-rgt-neg-out35.4%
sqrt-unprod0.2%
add-sqr-sqrt1.3%
add-sqr-sqrt0.0%
Applied egg-rr68.8%
neg-sub068.8%
distribute-rgt-neg-in68.8%
count-268.8%
distribute-lft-neg-in68.8%
metadata-eval68.8%
Simplified68.8%
if -2.6e39 < y < 9.0000000000000001e113Initial program 99.8%
add-sqr-sqrt53.1%
sqrt-unprod44.8%
*-commutative44.8%
*-commutative44.8%
swap-sqr41.7%
add-sqr-sqrt41.8%
add-log-exp18.1%
exp-lft-sqr18.1%
log-prod18.1%
add-log-exp27.7%
add-log-exp41.8%
pow241.8%
Applied egg-rr41.8%
Taylor expanded in x around inf 32.7%
*-commutative32.7%
unpow232.7%
Simplified32.7%
associate-*r*32.7%
sqrt-prod35.1%
sqrt-prod41.6%
add-sqr-sqrt75.1%
Applied egg-rr75.1%
Final simplification72.8%
(FPCore (x y z t) :precision binary64 (if (<= (* t t) 17500000.0) (* y (* (sqrt 2.0) (- (sqrt z)))) (* y (* -2.0 (* z (sqrt (exp (* t t))))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t * t) <= 17500000.0) {
tmp = y * (sqrt(2.0) * -sqrt(z));
} else {
tmp = y * (-2.0 * (z * sqrt(exp((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) :: tmp
if ((t * t) <= 17500000.0d0) then
tmp = y * (sqrt(2.0d0) * -sqrt(z))
else
tmp = y * ((-2.0d0) * (z * sqrt(exp((t * t)))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t * t) <= 17500000.0) {
tmp = y * (Math.sqrt(2.0) * -Math.sqrt(z));
} else {
tmp = y * (-2.0 * (z * Math.sqrt(Math.exp((t * t)))));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t * t) <= 17500000.0: tmp = y * (math.sqrt(2.0) * -math.sqrt(z)) else: tmp = y * (-2.0 * (z * math.sqrt(math.exp((t * t))))) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(t * t) <= 17500000.0) tmp = Float64(y * Float64(sqrt(2.0) * Float64(-sqrt(z)))); else tmp = Float64(y * Float64(-2.0 * Float64(z * sqrt(exp(Float64(t * t)))))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t * t) <= 17500000.0) tmp = y * (sqrt(2.0) * -sqrt(z)); else tmp = y * (-2.0 * (z * sqrt(exp((t * t))))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(t * t), $MachinePrecision], 17500000.0], N[(y * N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[z], $MachinePrecision])), $MachinePrecision]), $MachinePrecision], N[(y * N[(-2.0 * N[(z * N[Sqrt[N[Exp[N[(t * t), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \cdot t \leq 17500000:\\
\;\;\;\;y \cdot \left(\sqrt{2} \cdot \left(-\sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-2 \cdot \left(z \cdot \sqrt{e^{t \cdot t}}\right)\right)\\
\end{array}
\end{array}
if (*.f64 t t) < 1.75e7Initial program 99.7%
*-commutative99.7%
flip--61.0%
associate-*r/55.3%
add-log-exp15.6%
exp-lft-sqr15.6%
log-prod15.6%
add-log-exp19.5%
add-log-exp55.3%
swap-sqr55.3%
metadata-eval55.3%
fma-def55.3%
Applied egg-rr55.3%
*-commutative55.3%
associate-/l*60.4%
Simplified60.4%
Taylor expanded in x around 0 46.8%
mul-1-neg46.8%
distribute-rgt-neg-in46.8%
Simplified46.8%
Taylor expanded in t around 0 46.8%
mul-1-neg46.8%
associate-*r*46.8%
distribute-lft-neg-in46.8%
Simplified46.8%
if 1.75e7 < (*.f64 t t) Initial program 100.0%
Taylor expanded in x around 0 81.1%
mul-1-neg81.1%
associate-*l*81.1%
distribute-rgt-neg-in81.1%
*-commutative81.1%
distribute-rgt-neg-in81.1%
Simplified81.1%
*-commutative81.1%
add-sqr-sqrt0.0%
sqrt-unprod16.4%
sqr-neg16.4%
add-sqr-sqrt16.4%
sqrt-prod16.4%
count-216.4%
expm1-log1p-u16.4%
expm1-udef10.7%
Applied egg-rr10.7%
expm1-def16.4%
expm1-log1p16.4%
Simplified16.4%
add-sqr-sqrt12.3%
sqrt-unprod49.2%
sqr-neg49.2%
distribute-rgt-neg-out49.2%
distribute-rgt-neg-out49.2%
sqrt-unprod43.4%
add-sqr-sqrt81.1%
distribute-rgt-neg-out81.1%
neg-sub081.1%
add-sqr-sqrt37.7%
sqrt-unprod34.4%
sqr-neg34.4%
distribute-rgt-neg-out34.4%
distribute-rgt-neg-out34.4%
sqrt-unprod4.1%
add-sqr-sqrt16.4%
add-sqr-sqrt0.0%
Applied egg-rr78.7%
neg-sub078.7%
distribute-rgt-neg-in78.7%
count-278.7%
distribute-lft-neg-in78.7%
metadata-eval78.7%
Simplified78.7%
Taylor expanded in y around 0 82.8%
*-commutative82.8%
associate-*l*82.8%
*-commutative82.8%
exp-prod82.8%
unpow1/282.8%
unpow282.8%
Simplified82.8%
Final simplification64.0%
(FPCore (x y z t) :precision binary64 (if (<= (* t t) 17500000.0) (* y (* (sqrt 2.0) (- (sqrt z)))) (* (exp (/ (* t t) 2.0)) (* y (* z -2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t * t) <= 17500000.0) {
tmp = y * (sqrt(2.0) * -sqrt(z));
} else {
tmp = exp(((t * t) / 2.0)) * (y * (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 ((t * t) <= 17500000.0d0) then
tmp = y * (sqrt(2.0d0) * -sqrt(z))
else
tmp = exp(((t * t) / 2.0d0)) * (y * (z * (-2.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t * t) <= 17500000.0) {
tmp = y * (Math.sqrt(2.0) * -Math.sqrt(z));
} else {
tmp = Math.exp(((t * t) / 2.0)) * (y * (z * -2.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t * t) <= 17500000.0: tmp = y * (math.sqrt(2.0) * -math.sqrt(z)) else: tmp = math.exp(((t * t) / 2.0)) * (y * (z * -2.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(t * t) <= 17500000.0) tmp = Float64(y * Float64(sqrt(2.0) * Float64(-sqrt(z)))); else tmp = Float64(exp(Float64(Float64(t * t) / 2.0)) * Float64(y * Float64(z * -2.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t * t) <= 17500000.0) tmp = y * (sqrt(2.0) * -sqrt(z)); else tmp = exp(((t * t) / 2.0)) * (y * (z * -2.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(t * t), $MachinePrecision], 17500000.0], N[(y * N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[z], $MachinePrecision])), $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision] * N[(y * N[(z * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \cdot t \leq 17500000:\\
\;\;\;\;y \cdot \left(\sqrt{2} \cdot \left(-\sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{t \cdot t}{2}} \cdot \left(y \cdot \left(z \cdot -2\right)\right)\\
\end{array}
\end{array}
if (*.f64 t t) < 1.75e7Initial program 99.7%
*-commutative99.7%
flip--61.0%
associate-*r/55.3%
add-log-exp15.6%
exp-lft-sqr15.6%
log-prod15.6%
add-log-exp19.5%
add-log-exp55.3%
swap-sqr55.3%
metadata-eval55.3%
fma-def55.3%
Applied egg-rr55.3%
*-commutative55.3%
associate-/l*60.4%
Simplified60.4%
Taylor expanded in x around 0 46.8%
mul-1-neg46.8%
distribute-rgt-neg-in46.8%
Simplified46.8%
Taylor expanded in t around 0 46.8%
mul-1-neg46.8%
associate-*r*46.8%
distribute-lft-neg-in46.8%
Simplified46.8%
if 1.75e7 < (*.f64 t t) Initial program 100.0%
Taylor expanded in x around 0 81.1%
mul-1-neg81.1%
associate-*l*81.1%
distribute-rgt-neg-in81.1%
*-commutative81.1%
distribute-rgt-neg-in81.1%
Simplified81.1%
*-commutative81.1%
add-sqr-sqrt0.0%
sqrt-unprod16.4%
sqr-neg16.4%
add-sqr-sqrt16.4%
sqrt-prod16.4%
count-216.4%
expm1-log1p-u16.4%
expm1-udef10.7%
Applied egg-rr10.7%
expm1-def16.4%
expm1-log1p16.4%
Simplified16.4%
add-sqr-sqrt12.3%
sqrt-unprod49.2%
sqr-neg49.2%
distribute-rgt-neg-out49.2%
distribute-rgt-neg-out49.2%
sqrt-unprod43.4%
add-sqr-sqrt81.1%
distribute-rgt-neg-out81.1%
neg-sub081.1%
add-sqr-sqrt37.7%
sqrt-unprod34.4%
sqr-neg34.4%
distribute-rgt-neg-out34.4%
distribute-rgt-neg-out34.4%
sqrt-unprod4.1%
add-sqr-sqrt16.4%
add-sqr-sqrt0.0%
Applied egg-rr78.7%
neg-sub078.7%
distribute-rgt-neg-in78.7%
count-278.7%
distribute-lft-neg-in78.7%
metadata-eval78.7%
Simplified78.7%
Final simplification62.0%
(FPCore (x y z t) :precision binary64 (* (exp (/ (* t t) 2.0)) (* y (* z -2.0))))
double code(double x, double y, double z, double t) {
return exp(((t * t) / 2.0)) * (y * (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 = exp(((t * t) / 2.0d0)) * (y * (z * (-2.0d0)))
end function
public static double code(double x, double y, double z, double t) {
return Math.exp(((t * t) / 2.0)) * (y * (z * -2.0));
}
def code(x, y, z, t): return math.exp(((t * t) / 2.0)) * (y * (z * -2.0))
function code(x, y, z, t) return Float64(exp(Float64(Float64(t * t) / 2.0)) * Float64(y * Float64(z * -2.0))) end
function tmp = code(x, y, z, t) tmp = exp(((t * t) / 2.0)) * (y * (z * -2.0)); end
code[x_, y_, z_, t_] := N[(N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision] * N[(y * N[(z * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{\frac{t \cdot t}{2}} \cdot \left(y \cdot \left(z \cdot -2\right)\right)
\end{array}
Initial program 99.9%
Taylor expanded in x around 0 63.1%
mul-1-neg63.1%
associate-*l*63.2%
distribute-rgt-neg-in63.2%
*-commutative63.2%
distribute-rgt-neg-in63.2%
Simplified63.2%
*-commutative63.2%
add-sqr-sqrt0.0%
sqrt-unprod9.3%
sqr-neg9.3%
add-sqr-sqrt9.3%
sqrt-prod9.3%
count-29.3%
expm1-log1p-u9.3%
expm1-udef6.7%
Applied egg-rr6.7%
expm1-def9.3%
expm1-log1p9.3%
Simplified9.3%
add-sqr-sqrt6.9%
sqrt-unprod31.5%
sqr-neg31.5%
distribute-rgt-neg-out31.5%
distribute-rgt-neg-out31.5%
sqrt-unprod33.9%
add-sqr-sqrt63.3%
distribute-rgt-neg-out63.3%
neg-sub063.3%
add-sqr-sqrt29.7%
sqrt-unprod25.4%
sqr-neg25.4%
distribute-rgt-neg-out25.4%
distribute-rgt-neg-out25.4%
sqrt-unprod2.9%
add-sqr-sqrt9.3%
add-sqr-sqrt0.0%
Applied egg-rr44.5%
neg-sub044.5%
distribute-rgt-neg-in44.5%
count-244.5%
distribute-lft-neg-in44.5%
metadata-eval44.5%
Simplified44.5%
Final simplification44.5%
(FPCore (x y z t) :precision binary64 (* (* y z) (- -2.0 (* t t))))
double code(double x, double y, double z, double t) {
return (y * z) * (-2.0 - (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 = (y * z) * ((-2.0d0) - (t * t))
end function
public static double code(double x, double y, double z, double t) {
return (y * z) * (-2.0 - (t * t));
}
def code(x, y, z, t): return (y * z) * (-2.0 - (t * t))
function code(x, y, z, t) return Float64(Float64(y * z) * Float64(-2.0 - Float64(t * t))) end
function tmp = code(x, y, z, t) tmp = (y * z) * (-2.0 - (t * t)); end
code[x_, y_, z_, t_] := N[(N[(y * z), $MachinePrecision] * N[(-2.0 - N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(y \cdot z\right) \cdot \left(-2 - t \cdot t\right)
\end{array}
Initial program 99.9%
Taylor expanded in x around 0 63.1%
mul-1-neg63.1%
associate-*l*63.2%
distribute-rgt-neg-in63.2%
*-commutative63.2%
distribute-rgt-neg-in63.2%
Simplified63.2%
*-commutative63.2%
add-sqr-sqrt0.0%
sqrt-unprod9.3%
sqr-neg9.3%
add-sqr-sqrt9.3%
sqrt-prod9.3%
count-29.3%
expm1-log1p-u9.3%
expm1-udef6.7%
Applied egg-rr6.7%
expm1-def9.3%
expm1-log1p9.3%
Simplified9.3%
add-sqr-sqrt6.9%
sqrt-unprod31.5%
sqr-neg31.5%
distribute-rgt-neg-out31.5%
distribute-rgt-neg-out31.5%
sqrt-unprod33.9%
add-sqr-sqrt63.3%
distribute-rgt-neg-out63.3%
neg-sub063.3%
add-sqr-sqrt29.7%
sqrt-unprod25.4%
sqr-neg25.4%
distribute-rgt-neg-out25.4%
distribute-rgt-neg-out25.4%
sqrt-unprod2.9%
add-sqr-sqrt9.3%
add-sqr-sqrt0.0%
Applied egg-rr44.5%
neg-sub044.5%
distribute-rgt-neg-in44.5%
count-244.5%
distribute-lft-neg-in44.5%
metadata-eval44.5%
Simplified44.5%
Taylor expanded in t around 0 32.5%
associate-*r*32.5%
distribute-rgt-out33.8%
mul-1-neg33.8%
unsub-neg33.8%
unpow233.8%
Simplified33.8%
Final simplification33.8%
(FPCore (x y z t) :precision binary64 (* -2.0 (* y z)))
double code(double x, double y, double z, double t) {
return -2.0 * (y * 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 = (-2.0d0) * (y * z)
end function
public static double code(double x, double y, double z, double t) {
return -2.0 * (y * z);
}
def code(x, y, z, t): return -2.0 * (y * z)
function code(x, y, z, t) return Float64(-2.0 * Float64(y * z)) end
function tmp = code(x, y, z, t) tmp = -2.0 * (y * z); end
code[x_, y_, z_, t_] := N[(-2.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-2 \cdot \left(y \cdot z\right)
\end{array}
Initial program 99.9%
Taylor expanded in x around 0 63.1%
mul-1-neg63.1%
associate-*l*63.2%
distribute-rgt-neg-in63.2%
*-commutative63.2%
distribute-rgt-neg-in63.2%
Simplified63.2%
*-commutative63.2%
add-sqr-sqrt0.0%
sqrt-unprod9.3%
sqr-neg9.3%
add-sqr-sqrt9.3%
sqrt-prod9.3%
count-29.3%
expm1-log1p-u9.3%
expm1-udef6.7%
Applied egg-rr6.7%
expm1-def9.3%
expm1-log1p9.3%
Simplified9.3%
add-sqr-sqrt6.9%
sqrt-unprod31.5%
sqr-neg31.5%
distribute-rgt-neg-out31.5%
distribute-rgt-neg-out31.5%
sqrt-unprod33.9%
add-sqr-sqrt63.3%
distribute-rgt-neg-out63.3%
neg-sub063.3%
add-sqr-sqrt29.7%
sqrt-unprod25.4%
sqr-neg25.4%
distribute-rgt-neg-out25.4%
distribute-rgt-neg-out25.4%
sqrt-unprod2.9%
add-sqr-sqrt9.3%
add-sqr-sqrt0.0%
Applied egg-rr44.5%
neg-sub044.5%
distribute-rgt-neg-in44.5%
count-244.5%
distribute-lft-neg-in44.5%
metadata-eval44.5%
Simplified44.5%
Taylor expanded in t around 0 14.6%
Final simplification14.6%
(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 2023271
(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))))