
(FPCore (x y z t) :precision binary64 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (exp (/ (* t t) 2.0))))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * exp(((t * t) / 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * Math.exp(((t * t) / 2.0));
}
def code(x, y, z, t): return (((x * 0.5) - y) * math.sqrt((z * 2.0))) * math.exp(((t * t) / 2.0))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * exp(Float64(Float64(t * t) / 2.0))) end
function tmp = code(x, y, z, t) tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (exp (/ (* t t) 2.0))))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * exp(((t * t) / 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * Math.exp(((t * t) / 2.0));
}
def code(x, y, z, t): return (((x * 0.5) - y) * math.sqrt((z * 2.0))) * math.exp(((t * t) / 2.0))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * exp(Float64(Float64(t * t) / 2.0))) end
function tmp = code(x, y, z, t) tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}}
\end{array}
(FPCore (x y z t) :precision binary64 (let* ((t_1 (sqrt (* 2.0 z)))) (* (- (* (* 0.5 t_1) x) (* t_1 y)) (exp (/ (* t t) 2.0)))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((2.0 * z));
return (((0.5 * t_1) * x) - (t_1 * y)) * 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
real(8) :: t_1
t_1 = sqrt((2.0d0 * z))
code = (((0.5d0 * t_1) * x) - (t_1 * y)) * exp(((t * t) / 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((2.0 * z));
return (((0.5 * t_1) * x) - (t_1 * y)) * Math.exp(((t * t) / 2.0));
}
def code(x, y, z, t): t_1 = math.sqrt((2.0 * z)) return (((0.5 * t_1) * x) - (t_1 * y)) * math.exp(((t * t) / 2.0))
function code(x, y, z, t) t_1 = sqrt(Float64(2.0 * z)) return Float64(Float64(Float64(Float64(0.5 * t_1) * x) - Float64(t_1 * y)) * exp(Float64(Float64(t * t) / 2.0))) end
function tmp = code(x, y, z, t) t_1 = sqrt((2.0 * z)); tmp = (((0.5 * t_1) * x) - (t_1 * y)) * exp(((t * t) / 2.0)); end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]}, N[(N[(N[(N[(0.5 * t$95$1), $MachinePrecision] * x), $MachinePrecision] - N[(t$95$1 * y), $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{2 \cdot z}\\
\left(\left(0.5 \cdot t_1\right) \cdot x - t_1 \cdot y\right) \cdot e^{\frac{t \cdot t}{2}}
\end{array}
\end{array}
Initial program 99.8%
*-commutative99.8%
sub-neg99.8%
distribute-rgt-in99.8%
Applied egg-rr99.8%
add-sqr-sqrt49.8%
sqrt-unprod71.1%
sqr-neg71.1%
sqrt-unprod27.8%
add-sqr-sqrt51.2%
cancel-sign-sub51.2%
add-log-exp25.5%
add-log-exp17.2%
diff-log17.2%
associate-*l*17.2%
exp-prod15.8%
exp-prod14.3%
Applied egg-rr36.0%
log-div36.0%
log-pow37.0%
*-commutative37.0%
rem-log-exp67.4%
log-pow68.3%
rem-log-exp99.8%
*-commutative99.8%
*-commutative99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (* 2.0 z))) (t_2 (* t_1 y)))
(if (<= (* t t) 0.045)
(- (* t_1 (* 0.5 x)) t_2)
(* t_2 (- (exp (/ (* t t) 2.0)))))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((2.0 * z));
double t_2 = t_1 * y;
double tmp;
if ((t * t) <= 0.045) {
tmp = (t_1 * (0.5 * x)) - t_2;
} else {
tmp = t_2 * -exp(((t * t) / 2.0));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((2.0d0 * z))
t_2 = t_1 * y
if ((t * t) <= 0.045d0) then
tmp = (t_1 * (0.5d0 * x)) - t_2
else
tmp = t_2 * -exp(((t * t) / 2.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((2.0 * z));
double t_2 = t_1 * y;
double tmp;
if ((t * t) <= 0.045) {
tmp = (t_1 * (0.5 * x)) - t_2;
} else {
tmp = t_2 * -Math.exp(((t * t) / 2.0));
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((2.0 * z)) t_2 = t_1 * y tmp = 0 if (t * t) <= 0.045: tmp = (t_1 * (0.5 * x)) - t_2 else: tmp = t_2 * -math.exp(((t * t) / 2.0)) return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(2.0 * z)) t_2 = Float64(t_1 * y) tmp = 0.0 if (Float64(t * t) <= 0.045) tmp = Float64(Float64(t_1 * Float64(0.5 * x)) - t_2); else tmp = Float64(t_2 * Float64(-exp(Float64(Float64(t * t) / 2.0)))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt((2.0 * z)); t_2 = t_1 * y; tmp = 0.0; if ((t * t) <= 0.045) tmp = (t_1 * (0.5 * x)) - t_2; else tmp = t_2 * -exp(((t * t) / 2.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * y), $MachinePrecision]}, If[LessEqual[N[(t * t), $MachinePrecision], 0.045], N[(N[(t$95$1 * N[(0.5 * x), $MachinePrecision]), $MachinePrecision] - t$95$2), $MachinePrecision], N[(t$95$2 * (-N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{2 \cdot z}\\
t_2 := t_1 \cdot y\\
\mathbf{if}\;t \cdot t \leq 0.045:\\
\;\;\;\;t_1 \cdot \left(0.5 \cdot x\right) - t_2\\
\mathbf{else}:\\
\;\;\;\;t_2 \cdot \left(-e^{\frac{t \cdot t}{2}}\right)\\
\end{array}
\end{array}
if (*.f64 t t) < 0.044999999999999998Initial program 99.6%
Taylor expanded in x around 0 99.3%
+-commutative99.3%
associate-*r*99.3%
associate-*r*99.3%
distribute-rgt-out99.3%
associate-*r*99.3%
*-commutative99.3%
associate-*r*99.3%
neg-mul-199.3%
distribute-rgt-in99.3%
*-commutative99.3%
sub-neg99.3%
*-commutative99.3%
*-commutative99.3%
associate-*l*99.2%
*-commutative99.2%
Simplified99.2%
Taylor expanded in t around 0 97.7%
associate-*r*97.7%
sqrt-prod98.1%
*-commutative98.1%
sub-neg98.1%
distribute-rgt-in98.1%
*-commutative98.1%
associate-*r*98.1%
*-commutative98.1%
cancel-sign-sub-inv98.1%
*-commutative98.1%
associate-*r*98.1%
Applied egg-rr98.1%
if 0.044999999999999998 < (*.f64 t t) Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-rgt-in100.0%
Applied egg-rr100.0%
add-sqr-sqrt53.0%
sqrt-unprod76.1%
sqr-neg76.1%
sqrt-unprod24.8%
add-sqr-sqrt48.7%
cancel-sign-sub48.7%
add-log-exp47.9%
add-log-exp31.6%
diff-log31.6%
associate-*l*31.6%
exp-prod29.9%
exp-prod26.5%
Applied egg-rr65.8%
log-div65.8%
log-pow65.8%
*-commutative65.8%
rem-log-exp85.5%
log-pow86.3%
rem-log-exp100.0%
*-commutative100.0%
*-commutative100.0%
Simplified100.0%
cancel-sign-sub-inv100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
distribute-rgt-in100.0%
sub-neg100.0%
*-commutative100.0%
sqrt-prod100.0%
associate-*r*100.0%
*-commutative100.0%
*-commutative100.0%
associate-*r*100.0%
sqrt-prod100.0%
pow1/2100.0%
metadata-eval100.0%
pow-prod-up100.0%
associate-*r*100.0%
Applied egg-rr100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in x around 0 80.3%
mul-1-neg80.3%
associate-*l*80.3%
distribute-lft-neg-in80.3%
unpow1/280.3%
metadata-eval80.3%
pow-sqr80.3%
unpow1/280.3%
metadata-eval80.3%
pow-sqr80.3%
swap-sqr80.3%
exp-to-pow80.3%
exp-to-pow80.3%
exp-sum80.3%
distribute-rgt-in80.3%
log-prod80.3%
exp-to-pow80.3%
exp-to-pow80.3%
exp-sum80.3%
distribute-rgt-in80.3%
log-prod80.3%
Simplified80.3%
Final simplification90.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (* 2.0 z))))
(if (<= (* t t) 0.045)
(* t_1 (- (* 0.5 x) y))
(* (* t_1 y) (- (exp (/ (* t t) 2.0)))))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((2.0 * z));
double tmp;
if ((t * t) <= 0.045) {
tmp = t_1 * ((0.5 * x) - y);
} else {
tmp = (t_1 * y) * -exp(((t * t) / 2.0));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((2.0d0 * z))
if ((t * t) <= 0.045d0) then
tmp = t_1 * ((0.5d0 * x) - y)
else
tmp = (t_1 * y) * -exp(((t * t) / 2.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((2.0 * z));
double tmp;
if ((t * t) <= 0.045) {
tmp = t_1 * ((0.5 * x) - y);
} else {
tmp = (t_1 * y) * -Math.exp(((t * t) / 2.0));
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((2.0 * z)) tmp = 0 if (t * t) <= 0.045: tmp = t_1 * ((0.5 * x) - y) else: tmp = (t_1 * y) * -math.exp(((t * t) / 2.0)) return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(2.0 * z)) tmp = 0.0 if (Float64(t * t) <= 0.045) tmp = Float64(t_1 * Float64(Float64(0.5 * x) - y)); else tmp = Float64(Float64(t_1 * y) * Float64(-exp(Float64(Float64(t * t) / 2.0)))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt((2.0 * z)); tmp = 0.0; if ((t * t) <= 0.045) tmp = t_1 * ((0.5 * x) - y); else tmp = (t_1 * y) * -exp(((t * t) / 2.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t * t), $MachinePrecision], 0.045], N[(t$95$1 * N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 * y), $MachinePrecision] * (-N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{2 \cdot z}\\
\mathbf{if}\;t \cdot t \leq 0.045:\\
\;\;\;\;t_1 \cdot \left(0.5 \cdot x - y\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t_1 \cdot y\right) \cdot \left(-e^{\frac{t \cdot t}{2}}\right)\\
\end{array}
\end{array}
if (*.f64 t t) < 0.044999999999999998Initial program 99.6%
Taylor expanded in x around 0 99.3%
+-commutative99.3%
associate-*r*99.3%
associate-*r*99.3%
distribute-rgt-out99.3%
associate-*r*99.3%
*-commutative99.3%
associate-*r*99.3%
neg-mul-199.3%
distribute-rgt-in99.3%
*-commutative99.3%
sub-neg99.3%
*-commutative99.3%
*-commutative99.3%
associate-*l*99.2%
*-commutative99.2%
Simplified99.2%
Taylor expanded in t around 0 97.7%
associate-*r*97.7%
sqrt-prod98.1%
*-commutative98.1%
*-commutative98.1%
expm1-log1p-u56.8%
expm1-udef33.5%
log1p-udef33.5%
rem-exp-log74.8%
*-commutative74.8%
*-commutative74.8%
sub-neg74.8%
*-commutative74.8%
sub-neg74.8%
Applied egg-rr74.8%
add-exp-log33.5%
log1p-udef33.5%
*-commutative33.5%
pow1/233.5%
metadata-eval33.5%
pow-prod-up33.5%
associate-*r*33.5%
expm1-udef56.6%
associate-*r*56.7%
pow-prod-up56.8%
metadata-eval56.8%
Applied egg-rr98.1%
if 0.044999999999999998 < (*.f64 t t) Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-rgt-in100.0%
Applied egg-rr100.0%
add-sqr-sqrt53.0%
sqrt-unprod76.1%
sqr-neg76.1%
sqrt-unprod24.8%
add-sqr-sqrt48.7%
cancel-sign-sub48.7%
add-log-exp47.9%
add-log-exp31.6%
diff-log31.6%
associate-*l*31.6%
exp-prod29.9%
exp-prod26.5%
Applied egg-rr65.8%
log-div65.8%
log-pow65.8%
*-commutative65.8%
rem-log-exp85.5%
log-pow86.3%
rem-log-exp100.0%
*-commutative100.0%
*-commutative100.0%
Simplified100.0%
cancel-sign-sub-inv100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
distribute-rgt-in100.0%
sub-neg100.0%
*-commutative100.0%
sqrt-prod100.0%
associate-*r*100.0%
*-commutative100.0%
*-commutative100.0%
associate-*r*100.0%
sqrt-prod100.0%
pow1/2100.0%
metadata-eval100.0%
pow-prod-up100.0%
associate-*r*100.0%
Applied egg-rr100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in x around 0 80.3%
mul-1-neg80.3%
associate-*l*80.3%
distribute-lft-neg-in80.3%
unpow1/280.3%
metadata-eval80.3%
pow-sqr80.3%
unpow1/280.3%
metadata-eval80.3%
pow-sqr80.3%
swap-sqr80.3%
exp-to-pow80.3%
exp-to-pow80.3%
exp-sum80.3%
distribute-rgt-in80.3%
log-prod80.3%
exp-to-pow80.3%
exp-to-pow80.3%
exp-sum80.3%
distribute-rgt-in80.3%
log-prod80.3%
Simplified80.3%
Final simplification90.0%
(FPCore (x y z t) :precision binary64 (* (exp (/ (* t t) 2.0)) (* (sqrt (* 2.0 z)) (- (* 0.5 x) y))))
double code(double x, double y, double z, double t) {
return exp(((t * t) / 2.0)) * (sqrt((2.0 * z)) * ((0.5 * x) - 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 = exp(((t * t) / 2.0d0)) * (sqrt((2.0d0 * z)) * ((0.5d0 * x) - y))
end function
public static double code(double x, double y, double z, double t) {
return Math.exp(((t * t) / 2.0)) * (Math.sqrt((2.0 * z)) * ((0.5 * x) - y));
}
def code(x, y, z, t): return math.exp(((t * t) / 2.0)) * (math.sqrt((2.0 * z)) * ((0.5 * x) - y))
function code(x, y, z, t) return Float64(exp(Float64(Float64(t * t) / 2.0)) * Float64(sqrt(Float64(2.0 * z)) * Float64(Float64(0.5 * x) - y))) end
function tmp = code(x, y, z, t) tmp = exp(((t * t) / 2.0)) * (sqrt((2.0 * z)) * ((0.5 * x) - y)); end
code[x_, y_, z_, t_] := N[(N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision] * N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{\frac{t \cdot t}{2}} \cdot \left(\sqrt{2 \cdot z} \cdot \left(0.5 \cdot x - y\right)\right)
\end{array}
Initial program 99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (if (<= t 1e+40) (* (sqrt (* 2.0 z)) (- (* 0.5 x) y)) (* (sqrt z) (sqrt (* 2.0 (* y (- y x)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1e+40) {
tmp = sqrt((2.0 * z)) * ((0.5 * x) - y);
} else {
tmp = sqrt(z) * sqrt((2.0 * (y * (y - 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 (t <= 1d+40) then
tmp = sqrt((2.0d0 * z)) * ((0.5d0 * x) - y)
else
tmp = sqrt(z) * sqrt((2.0d0 * (y * (y - x))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1e+40) {
tmp = Math.sqrt((2.0 * z)) * ((0.5 * x) - y);
} else {
tmp = Math.sqrt(z) * Math.sqrt((2.0 * (y * (y - x))));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 1e+40: tmp = math.sqrt((2.0 * z)) * ((0.5 * x) - y) else: tmp = math.sqrt(z) * math.sqrt((2.0 * (y * (y - x)))) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 1e+40) tmp = Float64(sqrt(Float64(2.0 * z)) * Float64(Float64(0.5 * x) - y)); else tmp = Float64(sqrt(z) * sqrt(Float64(2.0 * Float64(y * Float64(y - x))))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 1e+40) tmp = sqrt((2.0 * z)) * ((0.5 * x) - y); else tmp = sqrt(z) * sqrt((2.0 * (y * (y - x)))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 1e+40], N[(N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision] * N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[z], $MachinePrecision] * N[Sqrt[N[(2.0 * N[(y * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 10^{+40}:\\
\;\;\;\;\sqrt{2 \cdot z} \cdot \left(0.5 \cdot x - y\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{z} \cdot \sqrt{2 \cdot \left(y \cdot \left(y - x\right)\right)}\\
\end{array}
\end{array}
if t < 1.00000000000000003e40Initial program 99.7%
Taylor expanded in x around 0 99.5%
+-commutative99.5%
associate-*r*99.5%
associate-*r*99.5%
distribute-rgt-out99.5%
associate-*r*99.5%
*-commutative99.5%
associate-*r*99.5%
neg-mul-199.5%
distribute-rgt-in99.5%
*-commutative99.5%
sub-neg99.5%
*-commutative99.5%
*-commutative99.5%
associate-*l*99.4%
*-commutative99.4%
Simplified99.4%
Taylor expanded in t around 0 71.9%
associate-*r*71.9%
sqrt-prod72.1%
*-commutative72.1%
*-commutative72.1%
expm1-log1p-u42.1%
expm1-udef26.0%
log1p-udef26.0%
rem-exp-log56.0%
*-commutative56.0%
*-commutative56.0%
sub-neg56.0%
*-commutative56.0%
sub-neg56.0%
Applied egg-rr56.0%
add-exp-log26.0%
log1p-udef26.0%
*-commutative26.0%
pow1/226.0%
metadata-eval26.0%
pow-prod-up26.0%
associate-*r*26.0%
expm1-udef42.0%
associate-*r*42.0%
pow-prod-up42.1%
metadata-eval42.1%
Applied egg-rr72.1%
if 1.00000000000000003e40 < t Initial program 100.0%
Taylor expanded in x around 0 100.0%
+-commutative100.0%
associate-*r*100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*r*100.0%
neg-mul-1100.0%
distribute-rgt-in100.0%
*-commutative100.0%
sub-neg100.0%
*-commutative100.0%
*-commutative100.0%
associate-*l*100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in t around 0 14.6%
add-sqr-sqrt5.6%
sqrt-unprod21.2%
swap-sqr21.2%
rem-square-sqrt21.2%
pow221.2%
Applied egg-rr21.2%
Taylor expanded in x around 0 13.8%
+-commutative13.8%
unpow213.8%
associate-*r*13.8%
distribute-rgt-out13.8%
mul-1-neg13.8%
unsub-neg13.8%
Simplified13.8%
Final simplification59.6%
(FPCore (x y z t) :precision binary64 (* (sqrt (* 2.0 z)) (- (* 0.5 x) y)))
double code(double x, double y, double z, double t) {
return sqrt((2.0 * z)) * ((0.5 * x) - 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((2.0d0 * z)) * ((0.5d0 * x) - y)
end function
public static double code(double x, double y, double z, double t) {
return Math.sqrt((2.0 * z)) * ((0.5 * x) - y);
}
def code(x, y, z, t): return math.sqrt((2.0 * z)) * ((0.5 * x) - y)
function code(x, y, z, t) return Float64(sqrt(Float64(2.0 * z)) * Float64(Float64(0.5 * x) - y)) end
function tmp = code(x, y, z, t) tmp = sqrt((2.0 * z)) * ((0.5 * x) - y); end
code[x_, y_, z_, t_] := N[(N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision] * N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{2 \cdot z} \cdot \left(0.5 \cdot x - y\right)
\end{array}
Initial program 99.8%
Taylor expanded in x around 0 99.6%
+-commutative99.6%
associate-*r*99.6%
associate-*r*99.6%
distribute-rgt-out99.6%
associate-*r*99.6%
*-commutative99.6%
associate-*r*99.6%
neg-mul-199.6%
distribute-rgt-in99.6%
*-commutative99.6%
sub-neg99.6%
*-commutative99.6%
*-commutative99.6%
associate-*l*99.6%
*-commutative99.6%
Simplified99.6%
Taylor expanded in t around 0 59.6%
associate-*r*59.6%
sqrt-prod59.8%
*-commutative59.8%
*-commutative59.8%
expm1-log1p-u34.3%
expm1-udef21.6%
log1p-udef21.6%
rem-exp-log47.0%
*-commutative47.0%
*-commutative47.0%
sub-neg47.0%
*-commutative47.0%
sub-neg47.0%
Applied egg-rr47.0%
add-exp-log21.6%
log1p-udef21.6%
*-commutative21.6%
pow1/221.6%
metadata-eval21.6%
pow-prod-up21.6%
associate-*r*21.6%
expm1-udef34.3%
associate-*r*34.3%
pow-prod-up34.3%
metadata-eval34.3%
Applied egg-rr59.8%
Final simplification59.8%
(FPCore (x y z t) :precision binary64 (* (* (sqrt (* 2.0 z)) x) -0.5))
double code(double x, double y, double z, double t) {
return (sqrt((2.0 * z)) * x) * -0.5;
}
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((2.0d0 * z)) * x) * (-0.5d0)
end function
public static double code(double x, double y, double z, double t) {
return (Math.sqrt((2.0 * z)) * x) * -0.5;
}
def code(x, y, z, t): return (math.sqrt((2.0 * z)) * x) * -0.5
function code(x, y, z, t) return Float64(Float64(sqrt(Float64(2.0 * z)) * x) * -0.5) end
function tmp = code(x, y, z, t) tmp = (sqrt((2.0 * z)) * x) * -0.5; end
code[x_, y_, z_, t_] := N[(N[(N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision] * -0.5), $MachinePrecision]
\begin{array}{l}
\\
\left(\sqrt{2 \cdot z} \cdot x\right) \cdot -0.5
\end{array}
Initial program 99.8%
Taylor expanded in x around 0 99.6%
+-commutative99.6%
associate-*r*99.6%
associate-*r*99.6%
distribute-rgt-out99.6%
associate-*r*99.6%
*-commutative99.6%
associate-*r*99.6%
neg-mul-199.6%
distribute-rgt-in99.6%
*-commutative99.6%
sub-neg99.6%
*-commutative99.6%
*-commutative99.6%
associate-*l*99.6%
*-commutative99.6%
Simplified99.6%
Taylor expanded in t around 0 59.6%
add-sqr-sqrt27.4%
sqrt-unprod29.0%
swap-sqr29.0%
rem-square-sqrt29.0%
pow229.0%
Applied egg-rr29.0%
Taylor expanded in x around -inf 2.1%
*-commutative2.1%
Simplified2.1%
Final simplification2.1%
(FPCore (x y z t) :precision binary64 (* (sqrt (* 2.0 z)) y))
double code(double x, double y, double z, double t) {
return sqrt((2.0 * 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((2.0d0 * z)) * y
end function
public static double code(double x, double y, double z, double t) {
return Math.sqrt((2.0 * z)) * y;
}
def code(x, y, z, t): return math.sqrt((2.0 * z)) * y
function code(x, y, z, t) return Float64(sqrt(Float64(2.0 * z)) * y) end
function tmp = code(x, y, z, t) tmp = sqrt((2.0 * z)) * y; end
code[x_, y_, z_, t_] := N[(N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision] * y), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{2 \cdot z} \cdot y
\end{array}
Initial program 99.8%
*-commutative99.8%
sub-neg99.8%
distribute-rgt-in99.8%
Applied egg-rr99.8%
distribute-rgt-out99.8%
sub-neg99.8%
*-commutative99.8%
add-sqr-sqrt99.5%
associate-*r*99.5%
fma-neg99.5%
add-sqr-sqrt49.8%
sqrt-unprod70.9%
sqr-neg70.9%
sqrt-unprod27.8%
add-sqr-sqrt51.5%
pow1/251.5%
sqrt-pow151.5%
metadata-eval51.5%
pow1/251.5%
sqrt-pow151.4%
metadata-eval51.4%
Applied egg-rr51.4%
*-commutative51.4%
*-commutative51.4%
*-commutative51.4%
Simplified51.4%
Taylor expanded in t around 0 32.0%
Taylor expanded in y around inf 2.0%
associate-*l*2.0%
unpow1/22.0%
metadata-eval2.0%
pow-sqr2.0%
unpow1/22.0%
metadata-eval2.0%
pow-sqr2.0%
swap-sqr2.0%
exp-to-pow2.0%
exp-to-pow2.0%
exp-sum2.0%
distribute-rgt-in2.0%
log-prod2.0%
exp-to-pow2.0%
exp-to-pow2.0%
exp-sum2.0%
distribute-rgt-in2.0%
log-prod2.0%
Simplified2.0%
Final simplification2.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 2024010
(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))))