
(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 (* (* 2.0 z) (pow (exp t) t)))))
double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * sqrt(((2.0 * z) * 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(((2.0d0 * z) * (exp(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) * Math.pow(Math.exp(t), t)));
}
def code(x, y, z, t): return ((x * 0.5) - y) * math.sqrt(((2.0 * z) * math.pow(math.exp(t), t)))
function code(x, y, z, t) return Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(Float64(2.0 * z) * (exp(t) ^ t)))) end
function tmp = code(x, y, z, t) tmp = ((x * 0.5) - y) * sqrt(((2.0 * z) * (exp(t) ^ t))); end
code[x_, y_, z_, t_] := N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(N[(2.0 * z), $MachinePrecision] * N[Power[N[Exp[t], $MachinePrecision], t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 0.5 - y\right) \cdot \sqrt{\left(2 \cdot z\right) \cdot {\left(e^{t}\right)}^{t}}
\end{array}
Initial program 99.4%
associate-*l*99.8%
associate-*l/99.8%
exp-prod99.8%
exp-sqrt99.8%
Simplified99.8%
sqrt-pow299.8%
sqrt-pow199.8%
exp-prod99.8%
expm1-log1p-u98.4%
expm1-udef79.5%
sqrt-unprod79.5%
associate-*l*79.5%
exp-prod79.5%
Applied egg-rr79.5%
expm1-def98.5%
expm1-log1p99.8%
associate-*r*99.8%
*-commutative99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (* (- (* x 0.5) y) (sqrt (* (* 2.0 z) (exp (* t t))))))
double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * sqrt(((2.0 * z) * 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(((2.0d0 * z) * exp((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) * Math.exp((t * t))));
}
def code(x, y, z, t): return ((x * 0.5) - y) * math.sqrt(((2.0 * z) * math.exp((t * t))))
function code(x, y, z, t) return Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(Float64(2.0 * z) * exp(Float64(t * t))))) end
function tmp = code(x, y, z, t) tmp = ((x * 0.5) - y) * sqrt(((2.0 * z) * exp((t * t)))); end
code[x_, y_, z_, t_] := N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(N[(2.0 * z), $MachinePrecision] * N[Exp[N[(t * t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 0.5 - y\right) \cdot \sqrt{\left(2 \cdot z\right) \cdot e^{t \cdot t}}
\end{array}
Initial program 99.4%
associate-*l*99.8%
associate-*l/99.8%
exp-prod99.8%
exp-sqrt99.8%
Simplified99.8%
sqrt-pow299.8%
sqrt-pow199.8%
exp-prod99.8%
expm1-log1p-u98.4%
expm1-udef79.5%
sqrt-unprod79.5%
associate-*l*79.5%
exp-prod79.5%
Applied egg-rr79.5%
expm1-def98.5%
expm1-log1p99.8%
associate-*r*99.8%
*-commutative99.8%
Simplified99.8%
pow-exp99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (* (- (* x 0.5) y) (* (+ 1.0 (* 0.5 (* t t))) (sqrt (* 2.0 z)))))
double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * ((1.0 + (0.5 * (t * t))) * sqrt((2.0 * 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 * 0.5d0) - y) * ((1.0d0 + (0.5d0 * (t * t))) * sqrt((2.0d0 * z)))
end function
public static double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * ((1.0 + (0.5 * (t * t))) * Math.sqrt((2.0 * z)));
}
def code(x, y, z, t): return ((x * 0.5) - y) * ((1.0 + (0.5 * (t * t))) * math.sqrt((2.0 * z)))
function code(x, y, z, t) return Float64(Float64(Float64(x * 0.5) - y) * Float64(Float64(1.0 + Float64(0.5 * Float64(t * t))) * sqrt(Float64(2.0 * z)))) end
function tmp = code(x, y, z, t) tmp = ((x * 0.5) - y) * ((1.0 + (0.5 * (t * t))) * sqrt((2.0 * z))); end
code[x_, y_, z_, t_] := N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[(N[(1.0 + N[(0.5 * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 0.5 - y\right) \cdot \left(\left(1 + 0.5 \cdot \left(t \cdot t\right)\right) \cdot \sqrt{2 \cdot z}\right)
\end{array}
Initial program 99.4%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in t around 0 83.2%
unpow283.2%
Simplified83.2%
Final simplification83.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x 0.5) y)))
(if (<= t 4.8e+25)
(* t_1 (sqrt (* 2.0 z)))
(if (<= t 7.2e+201)
(* t_1 (pow (* 4.0 (* z z)) 0.25))
(if (<= t 8.5e+266)
(sqrt (* z (* 2.0 (* y y))))
(sqrt (* (* x x) (* 0.5 z))))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double tmp;
if (t <= 4.8e+25) {
tmp = t_1 * sqrt((2.0 * z));
} else if (t <= 7.2e+201) {
tmp = t_1 * pow((4.0 * (z * z)), 0.25);
} else if (t <= 8.5e+266) {
tmp = sqrt((z * (2.0 * (y * y))));
} else {
tmp = sqrt(((x * x) * (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 = (x * 0.5d0) - y
if (t <= 4.8d+25) then
tmp = t_1 * sqrt((2.0d0 * z))
else if (t <= 7.2d+201) then
tmp = t_1 * ((4.0d0 * (z * z)) ** 0.25d0)
else if (t <= 8.5d+266) then
tmp = sqrt((z * (2.0d0 * (y * y))))
else
tmp = sqrt(((x * x) * (0.5d0 * z)))
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 <= 4.8e+25) {
tmp = t_1 * Math.sqrt((2.0 * z));
} else if (t <= 7.2e+201) {
tmp = t_1 * Math.pow((4.0 * (z * z)), 0.25);
} else if (t <= 8.5e+266) {
tmp = Math.sqrt((z * (2.0 * (y * y))));
} else {
tmp = Math.sqrt(((x * x) * (0.5 * z)));
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * 0.5) - y tmp = 0 if t <= 4.8e+25: tmp = t_1 * math.sqrt((2.0 * z)) elif t <= 7.2e+201: tmp = t_1 * math.pow((4.0 * (z * z)), 0.25) elif t <= 8.5e+266: tmp = math.sqrt((z * (2.0 * (y * y)))) else: tmp = math.sqrt(((x * x) * (0.5 * z))) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * 0.5) - y) tmp = 0.0 if (t <= 4.8e+25) tmp = Float64(t_1 * sqrt(Float64(2.0 * z))); elseif (t <= 7.2e+201) tmp = Float64(t_1 * (Float64(4.0 * Float64(z * z)) ^ 0.25)); elseif (t <= 8.5e+266) tmp = sqrt(Float64(z * Float64(2.0 * Float64(y * y)))); else tmp = sqrt(Float64(Float64(x * x) * Float64(0.5 * z))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * 0.5) - y; tmp = 0.0; if (t <= 4.8e+25) tmp = t_1 * sqrt((2.0 * z)); elseif (t <= 7.2e+201) tmp = t_1 * ((4.0 * (z * z)) ^ 0.25); elseif (t <= 8.5e+266) tmp = sqrt((z * (2.0 * (y * y)))); else tmp = sqrt(((x * x) * (0.5 * z))); 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, 4.8e+25], N[(t$95$1 * N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 7.2e+201], N[(t$95$1 * N[Power[N[(4.0 * N[(z * z), $MachinePrecision]), $MachinePrecision], 0.25], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 8.5e+266], N[Sqrt[N[(z * N[(2.0 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Sqrt[N[(N[(x * x), $MachinePrecision] * N[(0.5 * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
\mathbf{if}\;t \leq 4.8 \cdot 10^{+25}:\\
\;\;\;\;t_1 \cdot \sqrt{2 \cdot z}\\
\mathbf{elif}\;t \leq 7.2 \cdot 10^{+201}:\\
\;\;\;\;t_1 \cdot {\left(4 \cdot \left(z \cdot z\right)\right)}^{0.25}\\
\mathbf{elif}\;t \leq 8.5 \cdot 10^{+266}:\\
\;\;\;\;\sqrt{z \cdot \left(2 \cdot \left(y \cdot y\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\left(x \cdot x\right) \cdot \left(0.5 \cdot z\right)}\\
\end{array}
\end{array}
if t < 4.79999999999999992e25Initial program 99.8%
associate-*l*99.8%
exp-sqrt99.7%
Simplified99.7%
Taylor expanded in t around 0 84.0%
unpow284.0%
Simplified84.0%
Taylor expanded in t around 0 65.9%
unpow1/265.9%
metadata-eval65.9%
pow-sqr65.8%
unpow1/265.8%
metadata-eval65.8%
pow-sqr65.7%
swap-sqr65.7%
exp-to-pow65.7%
exp-to-pow63.4%
exp-sum63.1%
distribute-rgt-in63.1%
log-prod63.3%
*-commutative63.3%
exp-to-pow65.8%
exp-to-pow65.8%
exp-to-pow63.4%
exp-sum63.1%
distribute-rgt-in63.1%
log-prod63.3%
*-commutative63.3%
exp-to-pow65.8%
Simplified66.1%
if 4.79999999999999992e25 < t < 7.19999999999999951e201Initial program 96.4%
associate-*l*100.0%
associate-*l/100.0%
exp-prod100.0%
exp-sqrt100.0%
Simplified100.0%
Taylor expanded in t around 0 27.9%
*-commutative27.9%
sqrt-prod27.9%
pow1/227.9%
metadata-eval27.9%
pow-sqr27.9%
pow-prod-down37.7%
*-commutative37.7%
*-commutative37.7%
swap-sqr37.7%
metadata-eval37.7%
Applied egg-rr37.7%
if 7.19999999999999951e201 < t < 8.49999999999999955e266Initial program 100.0%
associate-*l*100.0%
associate-*l/100.0%
exp-prod100.0%
exp-sqrt100.0%
Simplified100.0%
Taylor expanded in t around 0 10.0%
add-sqr-sqrt2.8%
sqrt-unprod30.5%
*-commutative30.5%
*-commutative30.5%
sqrt-prod30.5%
*-commutative30.5%
*-commutative30.5%
sqrt-prod30.5%
swap-sqr30.4%
add-sqr-sqrt30.4%
*-commutative30.4%
pow230.4%
Applied egg-rr30.4%
Taylor expanded in x around 0 24.9%
associate-*r*24.9%
unpow224.9%
Simplified24.9%
if 8.49999999999999955e266 < t Initial program 100.0%
associate-*l*100.0%
associate-*l/100.0%
exp-prod100.0%
exp-sqrt100.0%
Simplified100.0%
Taylor expanded in t around 0 4.7%
add-sqr-sqrt3.2%
sqrt-unprod30.2%
*-commutative30.2%
*-commutative30.2%
sqrt-prod30.2%
*-commutative30.2%
*-commutative30.2%
sqrt-prod30.2%
swap-sqr43.8%
add-sqr-sqrt43.8%
*-commutative43.8%
pow243.8%
Applied egg-rr43.8%
Taylor expanded in x around inf 43.7%
*-commutative43.7%
*-commutative43.7%
associate-*l*43.7%
unpow243.7%
Simplified43.7%
Final simplification59.6%
(FPCore (x y z t) :precision binary64 (* (- (* x 0.5) y) (sqrt (* (* 2.0 z) (+ (* t t) 1.0)))))
double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * sqrt(((2.0 * z) * ((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(((2.0d0 * z) * ((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(((2.0 * z) * ((t * t) + 1.0)));
}
def code(x, y, z, t): return ((x * 0.5) - y) * math.sqrt(((2.0 * z) * ((t * t) + 1.0)))
function code(x, y, z, t) return Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(Float64(2.0 * z) * Float64(Float64(t * t) + 1.0)))) end
function tmp = code(x, y, z, t) tmp = ((x * 0.5) - y) * sqrt(((2.0 * z) * ((t * t) + 1.0))); end
code[x_, y_, z_, t_] := N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(N[(2.0 * z), $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(2 \cdot z\right) \cdot \left(t \cdot t + 1\right)}
\end{array}
Initial program 99.4%
associate-*l*99.8%
associate-*l/99.8%
exp-prod99.8%
exp-sqrt99.8%
Simplified99.8%
sqrt-pow299.8%
sqrt-pow199.8%
exp-prod99.8%
expm1-log1p-u98.4%
expm1-udef79.5%
sqrt-unprod79.5%
associate-*l*79.5%
exp-prod79.5%
Applied egg-rr79.5%
expm1-def98.5%
expm1-log1p99.8%
associate-*r*99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in t around 0 82.7%
unpow282.7%
Simplified82.7%
Final simplification82.7%
(FPCore (x y z t) :precision binary64 (if (<= t 2.3e+195) (* (- (* x 0.5) y) (sqrt (* 2.0 z))) (sqrt (* z (* 2.0 (* y y))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 2.3e+195) {
tmp = ((x * 0.5) - y) * sqrt((2.0 * z));
} 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 <= 2.3d+195) then
tmp = ((x * 0.5d0) - y) * sqrt((2.0d0 * z))
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 <= 2.3e+195) {
tmp = ((x * 0.5) - y) * Math.sqrt((2.0 * z));
} else {
tmp = Math.sqrt((z * (2.0 * (y * y))));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 2.3e+195: tmp = ((x * 0.5) - y) * math.sqrt((2.0 * z)) else: tmp = math.sqrt((z * (2.0 * (y * y)))) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 2.3e+195) tmp = Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(2.0 * z))); else tmp = sqrt(Float64(z * Float64(2.0 * Float64(y * y)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 2.3e+195) tmp = ((x * 0.5) - y) * sqrt((2.0 * z)); else tmp = sqrt((z * (2.0 * (y * y)))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 2.3e+195], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(z * N[(2.0 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 2.3 \cdot 10^{+195}:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot \sqrt{2 \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{z \cdot \left(2 \cdot \left(y \cdot y\right)\right)}\\
\end{array}
\end{array}
if t < 2.3000000000000001e195Initial program 99.3%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in t around 0 81.4%
unpow281.4%
Simplified81.4%
Taylor expanded in t around 0 61.6%
unpow1/261.6%
metadata-eval61.6%
pow-sqr61.4%
unpow1/261.4%
metadata-eval61.4%
pow-sqr61.4%
swap-sqr61.3%
exp-to-pow61.3%
exp-to-pow59.3%
exp-sum59.1%
distribute-rgt-in59.1%
log-prod59.3%
*-commutative59.3%
exp-to-pow61.5%
exp-to-pow61.5%
exp-to-pow59.3%
exp-sum59.1%
distribute-rgt-in59.1%
log-prod59.3%
*-commutative59.3%
exp-to-pow61.5%
Simplified61.7%
if 2.3000000000000001e195 < t Initial program 100.0%
associate-*l*100.0%
associate-*l/100.0%
exp-prod100.0%
exp-sqrt100.0%
Simplified100.0%
Taylor expanded in t around 0 8.2%
add-sqr-sqrt2.8%
sqrt-unprod29.2%
*-commutative29.2%
*-commutative29.2%
sqrt-prod29.2%
*-commutative29.2%
*-commutative29.2%
sqrt-prod29.2%
swap-sqr33.0%
add-sqr-sqrt33.0%
*-commutative33.0%
pow233.0%
Applied egg-rr33.0%
Taylor expanded in x around 0 17.6%
associate-*r*17.6%
unpow217.6%
Simplified17.6%
Final simplification57.4%
(FPCore (x y z t) :precision binary64 (if (<= x 1.12e+29) (sqrt (* z (* 2.0 (* y y)))) (sqrt (* (* x x) (* 0.5 z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.12e+29) {
tmp = sqrt((z * (2.0 * (y * y))));
} else {
tmp = sqrt(((x * x) * (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 (x <= 1.12d+29) then
tmp = sqrt((z * (2.0d0 * (y * y))))
else
tmp = sqrt(((x * x) * (0.5d0 * z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.12e+29) {
tmp = Math.sqrt((z * (2.0 * (y * y))));
} else {
tmp = Math.sqrt(((x * x) * (0.5 * z)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= 1.12e+29: tmp = math.sqrt((z * (2.0 * (y * y)))) else: tmp = math.sqrt(((x * x) * (0.5 * z))) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= 1.12e+29) tmp = sqrt(Float64(z * Float64(2.0 * Float64(y * y)))); else tmp = sqrt(Float64(Float64(x * x) * Float64(0.5 * z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= 1.12e+29) tmp = sqrt((z * (2.0 * (y * y)))); else tmp = sqrt(((x * x) * (0.5 * z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, 1.12e+29], N[Sqrt[N[(z * N[(2.0 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Sqrt[N[(N[(x * x), $MachinePrecision] * N[(0.5 * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.12 \cdot 10^{+29}:\\
\;\;\;\;\sqrt{z \cdot \left(2 \cdot \left(y \cdot y\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\left(x \cdot x\right) \cdot \left(0.5 \cdot z\right)}\\
\end{array}
\end{array}
if x < 1.1200000000000001e29Initial program 99.3%
associate-*l*99.8%
associate-*l/99.8%
exp-prod99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in t around 0 57.4%
add-sqr-sqrt19.6%
sqrt-unprod18.7%
*-commutative18.7%
*-commutative18.7%
sqrt-prod18.7%
*-commutative18.7%
*-commutative18.7%
sqrt-prod18.7%
swap-sqr18.7%
add-sqr-sqrt18.7%
*-commutative18.7%
pow218.7%
Applied egg-rr18.7%
Taylor expanded in x around 0 16.9%
associate-*r*16.9%
unpow216.9%
Simplified16.9%
if 1.1200000000000001e29 < x Initial program 99.9%
associate-*l*99.9%
associate-*l/99.9%
exp-prod99.9%
exp-sqrt99.9%
Simplified99.9%
Taylor expanded in t around 0 53.1%
add-sqr-sqrt47.5%
sqrt-unprod55.7%
*-commutative55.7%
*-commutative55.7%
sqrt-prod55.8%
*-commutative55.8%
*-commutative55.8%
sqrt-prod55.7%
swap-sqr55.8%
add-sqr-sqrt55.8%
*-commutative55.8%
pow255.8%
Applied egg-rr55.8%
Taylor expanded in x around inf 54.4%
*-commutative54.4%
*-commutative54.4%
associate-*l*54.4%
unpow254.4%
Simplified54.4%
Final simplification25.8%
(FPCore (x y z t) :precision binary64 (sqrt (* 2.0 (* y (* y z)))))
double code(double x, double y, double z, double t) {
return sqrt((2.0 * (y * (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 = sqrt((2.0d0 * (y * (y * z))))
end function
public static double code(double x, double y, double z, double t) {
return Math.sqrt((2.0 * (y * (y * z))));
}
def code(x, y, z, t): return math.sqrt((2.0 * (y * (y * z))))
function code(x, y, z, t) return sqrt(Float64(2.0 * Float64(y * Float64(y * z)))) end
function tmp = code(x, y, z, t) tmp = sqrt((2.0 * (y * (y * z)))); end
code[x_, y_, z_, t_] := N[Sqrt[N[(2.0 * N[(y * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{2 \cdot \left(y \cdot \left(y \cdot z\right)\right)}
\end{array}
Initial program 99.4%
associate-*l*99.8%
associate-*l/99.8%
exp-prod99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in t around 0 56.4%
add-sqr-sqrt26.2%
sqrt-unprod27.5%
*-commutative27.5%
*-commutative27.5%
sqrt-prod27.6%
*-commutative27.6%
*-commutative27.6%
sqrt-prod27.6%
swap-sqr27.5%
add-sqr-sqrt27.6%
*-commutative27.6%
pow227.6%
Applied egg-rr27.6%
Taylor expanded in x around 0 17.3%
unpow217.3%
associate-*l*17.3%
*-commutative17.3%
Simplified17.3%
Final simplification17.3%
(FPCore (x y z t) :precision binary64 (sqrt (* z (* 2.0 (* y y)))))
double code(double x, double y, double z, double t) {
return sqrt((z * (2.0 * (y * y))));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = sqrt((z * (2.0d0 * (y * y))))
end function
public static double code(double x, double y, double z, double t) {
return Math.sqrt((z * (2.0 * (y * y))));
}
def code(x, y, z, t): return math.sqrt((z * (2.0 * (y * y))))
function code(x, y, z, t) return sqrt(Float64(z * Float64(2.0 * Float64(y * y)))) end
function tmp = code(x, y, z, t) tmp = sqrt((z * (2.0 * (y * y)))); end
code[x_, y_, z_, t_] := N[Sqrt[N[(z * N[(2.0 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{z \cdot \left(2 \cdot \left(y \cdot y\right)\right)}
\end{array}
Initial program 99.4%
associate-*l*99.8%
associate-*l/99.8%
exp-prod99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in t around 0 56.4%
add-sqr-sqrt26.2%
sqrt-unprod27.5%
*-commutative27.5%
*-commutative27.5%
sqrt-prod27.6%
*-commutative27.6%
*-commutative27.6%
sqrt-prod27.6%
swap-sqr27.5%
add-sqr-sqrt27.6%
*-commutative27.6%
pow227.6%
Applied egg-rr27.6%
Taylor expanded in x around 0 17.3%
associate-*r*17.3%
unpow217.3%
Simplified17.3%
Final simplification17.3%
(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 2023208
(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))))