
(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 11 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 (* (- (* 0.5 x) y) (sqrt (* (* 2.0 z) (pow E (* t t))))))
double code(double x, double y, double z, double t) {
return ((0.5 * x) - y) * sqrt(((2.0 * z) * pow(((double) M_E), (t * t))));
}
public static double code(double x, double y, double z, double t) {
return ((0.5 * x) - y) * Math.sqrt(((2.0 * z) * Math.pow(Math.E, (t * t))));
}
def code(x, y, z, t): return ((0.5 * x) - y) * math.sqrt(((2.0 * z) * math.pow(math.e, (t * t))))
function code(x, y, z, t) return Float64(Float64(Float64(0.5 * x) - y) * sqrt(Float64(Float64(2.0 * z) * (exp(1) ^ Float64(t * t))))) end
function tmp = code(x, y, z, t) tmp = ((0.5 * x) - y) * sqrt(((2.0 * z) * (2.71828182845904523536 ^ (t * t)))); end
code[x_, y_, z_, t_] := N[(N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(N[(2.0 * z), $MachinePrecision] * N[Power[E, N[(t * t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot x - y\right) \cdot \sqrt{\left(2 \cdot z\right) \cdot {e}^{\left(t \cdot t\right)}}
\end{array}
Initial program 99.1%
associate-*r*99.8%
exp-sqrt99.8%
*-commutative99.8%
sub-neg99.8%
distribute-lft-in76.4%
pow-exp76.4%
sqrt-unprod76.4%
pow-exp76.4%
sqrt-unprod76.4%
Applied egg-rr76.4%
distribute-lft-out99.8%
*-commutative99.8%
sub-neg99.8%
*-commutative99.8%
*-commutative99.8%
exp-prod99.8%
Simplified99.8%
*-un-lft-identity99.8%
exp-prod99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (* (- (* 0.5 x) y) (sqrt (* z (* 2.0 (pow (exp t) t))))))
double code(double x, double y, double z, double t) {
return ((0.5 * x) - 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 = ((0.5d0 * x) - y) * sqrt((z * (2.0d0 * (exp(t) ** t))))
end function
public static double code(double x, double y, double z, double t) {
return ((0.5 * x) - y) * Math.sqrt((z * (2.0 * Math.pow(Math.exp(t), t))));
}
def code(x, y, z, t): return ((0.5 * x) - y) * math.sqrt((z * (2.0 * math.pow(math.exp(t), t))))
function code(x, y, z, t) return Float64(Float64(Float64(0.5 * x) - y) * sqrt(Float64(z * Float64(2.0 * (exp(t) ^ t))))) end
function tmp = code(x, y, z, t) tmp = ((0.5 * x) - y) * sqrt((z * (2.0 * (exp(t) ^ t)))); end
code[x_, y_, z_, t_] := N[(N[(N[(0.5 * x), $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(0.5 \cdot x - y\right) \cdot \sqrt{z \cdot \left(2 \cdot {\left(e^{t}\right)}^{t}\right)}
\end{array}
Initial program 99.1%
associate-*r*99.8%
exp-sqrt99.8%
*-commutative99.8%
sub-neg99.8%
distribute-lft-in76.4%
pow-exp76.4%
sqrt-unprod76.4%
pow-exp76.4%
sqrt-unprod76.4%
Applied egg-rr76.4%
distribute-lft-out99.8%
*-commutative99.8%
sub-neg99.8%
*-commutative99.8%
associate-*l*99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (* (- (* 0.5 x) y) (sqrt (* (* 2.0 z) (exp (* t t))))))
double code(double x, double y, double z, double t) {
return ((0.5 * x) - 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 = ((0.5d0 * x) - y) * sqrt(((2.0d0 * z) * exp((t * t))))
end function
public static double code(double x, double y, double z, double t) {
return ((0.5 * x) - y) * Math.sqrt(((2.0 * z) * Math.exp((t * t))));
}
def code(x, y, z, t): return ((0.5 * x) - y) * math.sqrt(((2.0 * z) * math.exp((t * t))))
function code(x, y, z, t) return Float64(Float64(Float64(0.5 * x) - y) * sqrt(Float64(Float64(2.0 * z) * exp(Float64(t * t))))) end
function tmp = code(x, y, z, t) tmp = ((0.5 * x) - y) * sqrt(((2.0 * z) * exp((t * t)))); end
code[x_, y_, z_, t_] := N[(N[(N[(0.5 * x), $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(0.5 \cdot x - y\right) \cdot \sqrt{\left(2 \cdot z\right) \cdot e^{t \cdot t}}
\end{array}
Initial program 99.1%
associate-*r*99.8%
exp-sqrt99.8%
*-commutative99.8%
sub-neg99.8%
distribute-lft-in76.4%
pow-exp76.4%
sqrt-unprod76.4%
pow-exp76.4%
sqrt-unprod76.4%
Applied egg-rr76.4%
distribute-lft-out99.8%
*-commutative99.8%
sub-neg99.8%
*-commutative99.8%
*-commutative99.8%
exp-prod99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* 0.5 x) y)))
(if (<= (* t t) 0.002)
(* t_1 (sqrt (* 2.0 z)))
(* t_1 (sqrt (* 2.0 (* z (* t t))))))))
double code(double x, double y, double z, double t) {
double t_1 = (0.5 * x) - y;
double tmp;
if ((t * t) <= 0.002) {
tmp = t_1 * sqrt((2.0 * z));
} else {
tmp = t_1 * sqrt((2.0 * (z * (t * t))));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (0.5d0 * x) - y
if ((t * t) <= 0.002d0) then
tmp = t_1 * sqrt((2.0d0 * z))
else
tmp = t_1 * sqrt((2.0d0 * (z * (t * t))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (0.5 * x) - y;
double tmp;
if ((t * t) <= 0.002) {
tmp = t_1 * Math.sqrt((2.0 * z));
} else {
tmp = t_1 * Math.sqrt((2.0 * (z * (t * t))));
}
return tmp;
}
def code(x, y, z, t): t_1 = (0.5 * x) - y tmp = 0 if (t * t) <= 0.002: tmp = t_1 * math.sqrt((2.0 * z)) else: tmp = t_1 * math.sqrt((2.0 * (z * (t * t)))) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(0.5 * x) - y) tmp = 0.0 if (Float64(t * t) <= 0.002) tmp = Float64(t_1 * sqrt(Float64(2.0 * z))); else tmp = Float64(t_1 * sqrt(Float64(2.0 * Float64(z * Float64(t * t))))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (0.5 * x) - y; tmp = 0.0; if ((t * t) <= 0.002) tmp = t_1 * sqrt((2.0 * z)); else tmp = t_1 * sqrt((2.0 * (z * (t * t)))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[N[(t * t), $MachinePrecision], 0.002], N[(t$95$1 * N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Sqrt[N[(2.0 * N[(z * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 0.5 \cdot x - y\\
\mathbf{if}\;t \cdot t \leq 0.002:\\
\;\;\;\;t_1 \cdot \sqrt{2 \cdot z}\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \sqrt{2 \cdot \left(z \cdot \left(t \cdot t\right)\right)}\\
\end{array}
\end{array}
if (*.f64 t t) < 2e-3Initial program 99.7%
Taylor expanded in t around 0 99.0%
associate-*l*98.7%
Simplified98.7%
*-commutative98.7%
associate-*r*98.8%
sqrt-prod99.2%
*-commutative99.2%
pow1/299.2%
metadata-eval99.2%
pow-pow68.8%
pow1/372.4%
sub-neg72.4%
distribute-lft-in65.7%
pow1/364.1%
pow-pow73.9%
metadata-eval73.9%
pow1/273.9%
pow1/371.8%
pow-pow99.2%
metadata-eval99.2%
pow1/299.2%
Applied egg-rr99.2%
distribute-lft-out99.2%
sub-neg99.2%
*-commutative99.2%
*-commutative99.2%
Simplified99.2%
if 2e-3 < (*.f64 t t) Initial program 98.4%
associate-*r*100.0%
exp-sqrt100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in54.2%
pow-exp54.2%
sqrt-unprod54.2%
pow-exp54.2%
sqrt-unprod54.2%
Applied egg-rr54.2%
distribute-lft-out100.0%
*-commutative100.0%
sub-neg100.0%
*-commutative100.0%
*-commutative100.0%
exp-prod100.0%
Simplified100.0%
Taylor expanded in t around 0 67.1%
+-commutative67.1%
unpow267.1%
Simplified67.1%
Taylor expanded in t around inf 67.1%
unpow267.1%
*-commutative67.1%
Simplified67.1%
Final simplification82.8%
(FPCore (x y z t) :precision binary64 (* (- (* 0.5 x) y) (sqrt (* (* 2.0 z) (+ 1.0 (* t t))))))
double code(double x, double y, double z, double t) {
return ((0.5 * x) - y) * sqrt(((2.0 * z) * (1.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 = ((0.5d0 * x) - y) * sqrt(((2.0d0 * z) * (1.0d0 + (t * t))))
end function
public static double code(double x, double y, double z, double t) {
return ((0.5 * x) - y) * Math.sqrt(((2.0 * z) * (1.0 + (t * t))));
}
def code(x, y, z, t): return ((0.5 * x) - y) * math.sqrt(((2.0 * z) * (1.0 + (t * t))))
function code(x, y, z, t) return Float64(Float64(Float64(0.5 * x) - y) * sqrt(Float64(Float64(2.0 * z) * Float64(1.0 + Float64(t * t))))) end
function tmp = code(x, y, z, t) tmp = ((0.5 * x) - y) * sqrt(((2.0 * z) * (1.0 + (t * t)))); end
code[x_, y_, z_, t_] := N[(N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(N[(2.0 * z), $MachinePrecision] * N[(1.0 + N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot x - y\right) \cdot \sqrt{\left(2 \cdot z\right) \cdot \left(1 + t \cdot t\right)}
\end{array}
Initial program 99.1%
associate-*r*99.8%
exp-sqrt99.8%
*-commutative99.8%
sub-neg99.8%
distribute-lft-in76.4%
pow-exp76.4%
sqrt-unprod76.4%
pow-exp76.4%
sqrt-unprod76.4%
Applied egg-rr76.4%
distribute-lft-out99.8%
*-commutative99.8%
sub-neg99.8%
*-commutative99.8%
*-commutative99.8%
exp-prod99.8%
Simplified99.8%
Taylor expanded in t around 0 82.8%
+-commutative82.8%
unpow282.8%
Simplified82.8%
Final simplification82.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- (sqrt (* 2.0 z))))))
(if (<= y -3.6e+134)
t_1
(if (<= y -1.2e+43)
(sqrt (* 2.0 (* y (* y z))))
(if (or (<= y -6.5e-99) (not (<= y 3.1e+93)))
t_1
(* x (sqrt (* 0.5 z))))))))
double code(double x, double y, double z, double t) {
double t_1 = y * -sqrt((2.0 * z));
double tmp;
if (y <= -3.6e+134) {
tmp = t_1;
} else if (y <= -1.2e+43) {
tmp = sqrt((2.0 * (y * (y * z))));
} else if ((y <= -6.5e-99) || !(y <= 3.1e+93)) {
tmp = t_1;
} else {
tmp = x * sqrt((0.5 * z));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = y * -sqrt((2.0d0 * z))
if (y <= (-3.6d+134)) then
tmp = t_1
else if (y <= (-1.2d+43)) then
tmp = sqrt((2.0d0 * (y * (y * z))))
else if ((y <= (-6.5d-99)) .or. (.not. (y <= 3.1d+93))) then
tmp = t_1
else
tmp = x * sqrt((0.5d0 * z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * -Math.sqrt((2.0 * z));
double tmp;
if (y <= -3.6e+134) {
tmp = t_1;
} else if (y <= -1.2e+43) {
tmp = Math.sqrt((2.0 * (y * (y * z))));
} else if ((y <= -6.5e-99) || !(y <= 3.1e+93)) {
tmp = t_1;
} else {
tmp = x * Math.sqrt((0.5 * z));
}
return tmp;
}
def code(x, y, z, t): t_1 = y * -math.sqrt((2.0 * z)) tmp = 0 if y <= -3.6e+134: tmp = t_1 elif y <= -1.2e+43: tmp = math.sqrt((2.0 * (y * (y * z)))) elif (y <= -6.5e-99) or not (y <= 3.1e+93): tmp = t_1 else: tmp = x * math.sqrt((0.5 * z)) return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(-sqrt(Float64(2.0 * z)))) tmp = 0.0 if (y <= -3.6e+134) tmp = t_1; elseif (y <= -1.2e+43) tmp = sqrt(Float64(2.0 * Float64(y * Float64(y * z)))); elseif ((y <= -6.5e-99) || !(y <= 3.1e+93)) tmp = t_1; else tmp = Float64(x * sqrt(Float64(0.5 * z))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * -sqrt((2.0 * z)); tmp = 0.0; if (y <= -3.6e+134) tmp = t_1; elseif (y <= -1.2e+43) tmp = sqrt((2.0 * (y * (y * z)))); elseif ((y <= -6.5e-99) || ~((y <= 3.1e+93))) tmp = t_1; else tmp = x * sqrt((0.5 * z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * (-N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]}, If[LessEqual[y, -3.6e+134], t$95$1, If[LessEqual[y, -1.2e+43], N[Sqrt[N[(2.0 * N[(y * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[y, -6.5e-99], N[Not[LessEqual[y, 3.1e+93]], $MachinePrecision]], t$95$1, N[(x * N[Sqrt[N[(0.5 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(-\sqrt{2 \cdot z}\right)\\
\mathbf{if}\;y \leq -3.6 \cdot 10^{+134}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -1.2 \cdot 10^{+43}:\\
\;\;\;\;\sqrt{2 \cdot \left(y \cdot \left(y \cdot z\right)\right)}\\
\mathbf{elif}\;y \leq -6.5 \cdot 10^{-99} \lor \neg \left(y \leq 3.1 \cdot 10^{+93}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \sqrt{0.5 \cdot z}\\
\end{array}
\end{array}
if y < -3.59999999999999988e134 or -1.20000000000000012e43 < y < -6.50000000000000033e-99 or 3.10000000000000019e93 < y Initial program 99.8%
Taylor expanded in t around 0 66.9%
associate-*l*66.7%
Simplified66.7%
Taylor expanded in x around 0 59.4%
mul-1-neg59.4%
associate-*l*59.2%
distribute-rgt-neg-in59.2%
distribute-lft-neg-out59.2%
*-commutative59.2%
Simplified59.2%
associate-*r*59.3%
sqrt-prod59.5%
distribute-rgt-neg-out59.5%
Applied egg-rr59.5%
distribute-rgt-neg-in59.5%
Simplified59.5%
if -3.59999999999999988e134 < y < -1.20000000000000012e43Initial program 99.8%
Taylor expanded in t around 0 45.9%
associate-*l*45.8%
Simplified45.8%
Taylor expanded in x around 0 30.4%
mul-1-neg30.4%
associate-*l*30.3%
distribute-rgt-neg-in30.3%
distribute-lft-neg-out30.3%
*-commutative30.3%
Simplified30.3%
add-sqr-sqrt30.2%
sqrt-unprod52.1%
swap-sqr52.0%
add-sqr-sqrt52.2%
swap-sqr52.3%
add-sqr-sqrt52.2%
sqr-neg52.2%
Applied egg-rr52.2%
associate-*r*52.3%
Simplified52.3%
if -6.50000000000000033e-99 < y < 3.10000000000000019e93Initial program 98.1%
Taylor expanded in t around 0 50.3%
associate-*l*50.2%
Simplified50.2%
Taylor expanded in x around inf 39.3%
associate-*r*39.3%
Simplified39.3%
add-sqr-sqrt17.3%
sqrt-unprod23.3%
*-commutative23.3%
*-commutative23.3%
swap-sqr24.2%
add-sqr-sqrt24.2%
*-commutative24.2%
*-commutative24.2%
swap-sqr24.2%
swap-sqr24.2%
add-sqr-sqrt24.2%
metadata-eval24.2%
Applied egg-rr24.2%
*-commutative24.2%
associate-*r*24.2%
metadata-eval24.2%
Simplified24.2%
associate-*r*24.2%
sqrt-prod20.7%
sqrt-prod17.2%
add-sqr-sqrt39.4%
Applied egg-rr39.4%
Final simplification50.1%
(FPCore (x y z t) :precision binary64 (if (<= (* 0.5 x) 4e+136) (* (- (* 0.5 x) y) (sqrt (* 2.0 z))) (sqrt (* z (* 0.5 (* x x))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((0.5 * x) <= 4e+136) {
tmp = ((0.5 * x) - y) * sqrt((2.0 * z));
} else {
tmp = sqrt((z * (0.5 * (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 ((0.5d0 * x) <= 4d+136) then
tmp = ((0.5d0 * x) - y) * sqrt((2.0d0 * z))
else
tmp = sqrt((z * (0.5d0 * (x * x))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((0.5 * x) <= 4e+136) {
tmp = ((0.5 * x) - y) * Math.sqrt((2.0 * z));
} else {
tmp = Math.sqrt((z * (0.5 * (x * x))));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (0.5 * x) <= 4e+136: tmp = ((0.5 * x) - y) * math.sqrt((2.0 * z)) else: tmp = math.sqrt((z * (0.5 * (x * x)))) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(0.5 * x) <= 4e+136) tmp = Float64(Float64(Float64(0.5 * x) - y) * sqrt(Float64(2.0 * z))); else tmp = sqrt(Float64(z * Float64(0.5 * Float64(x * x)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((0.5 * x) <= 4e+136) tmp = ((0.5 * x) - y) * sqrt((2.0 * z)); else tmp = sqrt((z * (0.5 * (x * x)))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(0.5 * x), $MachinePrecision], 4e+136], N[(N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(z * N[(0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;0.5 \cdot x \leq 4 \cdot 10^{+136}:\\
\;\;\;\;\left(0.5 \cdot x - y\right) \cdot \sqrt{2 \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{z \cdot \left(0.5 \cdot \left(x \cdot x\right)\right)}\\
\end{array}
\end{array}
if (*.f64 x 1/2) < 4.00000000000000023e136Initial program 98.9%
Taylor expanded in t around 0 57.7%
associate-*l*57.6%
Simplified57.6%
*-commutative57.6%
associate-*r*57.6%
sqrt-prod58.2%
*-commutative58.2%
pow1/258.2%
metadata-eval58.2%
pow-pow45.4%
pow1/347.2%
sub-neg47.2%
distribute-lft-in41.3%
pow1/340.6%
pow-pow48.9%
metadata-eval48.9%
pow1/248.9%
pow1/347.7%
pow-pow58.2%
metadata-eval58.2%
pow1/258.2%
Applied egg-rr58.2%
distribute-lft-out58.2%
sub-neg58.2%
*-commutative58.2%
*-commutative58.2%
Simplified58.2%
if 4.00000000000000023e136 < (*.f64 x 1/2) Initial program 100.0%
Taylor expanded in t around 0 56.2%
associate-*l*56.2%
Simplified56.2%
Taylor expanded in x around inf 42.5%
associate-*r*42.5%
Simplified42.5%
add-sqr-sqrt42.4%
sqrt-unprod65.9%
*-commutative65.9%
*-commutative65.9%
swap-sqr72.7%
add-sqr-sqrt72.7%
*-commutative72.7%
*-commutative72.7%
swap-sqr72.7%
swap-sqr72.7%
add-sqr-sqrt72.7%
metadata-eval72.7%
Applied egg-rr72.7%
*-commutative72.7%
associate-*r*72.7%
metadata-eval72.7%
Simplified72.7%
Final simplification59.8%
(FPCore (x y z t)
:precision binary64
(if (<= x -7.8e+96)
(* x (sqrt (* 0.5 z)))
(if (<= x 7.5e+119)
(* y (- (sqrt (* 2.0 z))))
(sqrt (* z (* 0.5 (* x x)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -7.8e+96) {
tmp = x * sqrt((0.5 * z));
} else if (x <= 7.5e+119) {
tmp = y * -sqrt((2.0 * z));
} else {
tmp = sqrt((z * (0.5 * (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 <= (-7.8d+96)) then
tmp = x * sqrt((0.5d0 * z))
else if (x <= 7.5d+119) then
tmp = y * -sqrt((2.0d0 * z))
else
tmp = sqrt((z * (0.5d0 * (x * x))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -7.8e+96) {
tmp = x * Math.sqrt((0.5 * z));
} else if (x <= 7.5e+119) {
tmp = y * -Math.sqrt((2.0 * z));
} else {
tmp = Math.sqrt((z * (0.5 * (x * x))));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -7.8e+96: tmp = x * math.sqrt((0.5 * z)) elif x <= 7.5e+119: tmp = y * -math.sqrt((2.0 * z)) else: tmp = math.sqrt((z * (0.5 * (x * x)))) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -7.8e+96) tmp = Float64(x * sqrt(Float64(0.5 * z))); elseif (x <= 7.5e+119) tmp = Float64(y * Float64(-sqrt(Float64(2.0 * z)))); else tmp = sqrt(Float64(z * Float64(0.5 * Float64(x * x)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -7.8e+96) tmp = x * sqrt((0.5 * z)); elseif (x <= 7.5e+119) tmp = y * -sqrt((2.0 * z)); else tmp = sqrt((z * (0.5 * (x * x)))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -7.8e+96], N[(x * N[Sqrt[N[(0.5 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7.5e+119], N[(y * (-N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[Sqrt[N[(z * N[(0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.8 \cdot 10^{+96}:\\
\;\;\;\;x \cdot \sqrt{0.5 \cdot z}\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{+119}:\\
\;\;\;\;y \cdot \left(-\sqrt{2 \cdot z}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{z \cdot \left(0.5 \cdot \left(x \cdot x\right)\right)}\\
\end{array}
\end{array}
if x < -7.8e96Initial program 99.8%
Taylor expanded in t around 0 64.4%
associate-*l*64.3%
Simplified64.3%
Taylor expanded in x around inf 54.4%
associate-*r*54.4%
Simplified54.4%
add-sqr-sqrt0.0%
sqrt-unprod0.9%
*-commutative0.9%
*-commutative0.9%
swap-sqr5.7%
add-sqr-sqrt5.7%
*-commutative5.7%
*-commutative5.7%
swap-sqr5.7%
swap-sqr5.7%
add-sqr-sqrt5.7%
metadata-eval5.7%
Applied egg-rr5.7%
*-commutative5.7%
associate-*r*5.7%
metadata-eval5.7%
Simplified5.7%
associate-*r*5.7%
sqrt-prod5.6%
sqrt-prod0.0%
add-sqr-sqrt54.4%
Applied egg-rr54.4%
if -7.8e96 < x < 7.500000000000001e119Initial program 98.7%
Taylor expanded in t around 0 56.4%
associate-*l*56.3%
Simplified56.3%
Taylor expanded in x around 0 44.6%
mul-1-neg44.6%
associate-*l*44.4%
distribute-rgt-neg-in44.4%
distribute-lft-neg-out44.4%
*-commutative44.4%
Simplified44.4%
associate-*r*44.5%
sqrt-prod45.2%
distribute-rgt-neg-out45.2%
Applied egg-rr45.2%
distribute-rgt-neg-in45.2%
Simplified45.2%
if 7.500000000000001e119 < x Initial program 100.0%
Taylor expanded in t around 0 55.5%
associate-*l*55.5%
Simplified55.5%
Taylor expanded in x around inf 38.8%
associate-*r*38.8%
Simplified38.8%
add-sqr-sqrt38.8%
sqrt-unprod60.9%
*-commutative60.9%
*-commutative60.9%
swap-sqr66.5%
add-sqr-sqrt66.5%
*-commutative66.5%
*-commutative66.5%
swap-sqr66.5%
swap-sqr66.5%
add-sqr-sqrt66.5%
metadata-eval66.5%
Applied egg-rr66.5%
*-commutative66.5%
associate-*r*66.5%
metadata-eval66.5%
Simplified66.5%
Final simplification49.4%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.35e-100) (not (<= y 3.3e+93))) (* y (- (sqrt (* 2.0 z)))) (* x (sqrt (* 0.5 z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.35e-100) || !(y <= 3.3e+93)) {
tmp = y * -sqrt((2.0 * z));
} else {
tmp = x * sqrt((0.5 * z));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-1.35d-100)) .or. (.not. (y <= 3.3d+93))) then
tmp = y * -sqrt((2.0d0 * z))
else
tmp = x * sqrt((0.5d0 * z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.35e-100) || !(y <= 3.3e+93)) {
tmp = y * -Math.sqrt((2.0 * z));
} else {
tmp = x * Math.sqrt((0.5 * z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.35e-100) or not (y <= 3.3e+93): tmp = y * -math.sqrt((2.0 * z)) else: tmp = x * math.sqrt((0.5 * z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.35e-100) || !(y <= 3.3e+93)) tmp = Float64(y * Float64(-sqrt(Float64(2.0 * z)))); else tmp = Float64(x * sqrt(Float64(0.5 * z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.35e-100) || ~((y <= 3.3e+93))) tmp = y * -sqrt((2.0 * z)); else tmp = x * sqrt((0.5 * z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.35e-100], N[Not[LessEqual[y, 3.3e+93]], $MachinePrecision]], N[(y * (-N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(x * N[Sqrt[N[(0.5 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.35 \cdot 10^{-100} \lor \neg \left(y \leq 3.3 \cdot 10^{+93}\right):\\
\;\;\;\;y \cdot \left(-\sqrt{2 \cdot z}\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \sqrt{0.5 \cdot z}\\
\end{array}
\end{array}
if y < -1.35000000000000008e-100 or 3.30000000000000009e93 < y Initial program 99.8%
Taylor expanded in t around 0 63.1%
associate-*l*63.0%
Simplified63.0%
Taylor expanded in x around 0 54.2%
mul-1-neg54.2%
associate-*l*54.1%
distribute-rgt-neg-in54.1%
distribute-lft-neg-out54.1%
*-commutative54.1%
Simplified54.1%
associate-*r*54.1%
sqrt-prod54.2%
distribute-rgt-neg-out54.2%
Applied egg-rr54.2%
distribute-rgt-neg-in54.2%
Simplified54.2%
if -1.35000000000000008e-100 < y < 3.30000000000000009e93Initial program 98.1%
Taylor expanded in t around 0 50.3%
associate-*l*50.2%
Simplified50.2%
Taylor expanded in x around inf 39.3%
associate-*r*39.3%
Simplified39.3%
add-sqr-sqrt17.3%
sqrt-unprod23.3%
*-commutative23.3%
*-commutative23.3%
swap-sqr24.2%
add-sqr-sqrt24.2%
*-commutative24.2%
*-commutative24.2%
swap-sqr24.2%
swap-sqr24.2%
add-sqr-sqrt24.2%
metadata-eval24.2%
Applied egg-rr24.2%
*-commutative24.2%
associate-*r*24.2%
metadata-eval24.2%
Simplified24.2%
associate-*r*24.2%
sqrt-prod20.7%
sqrt-prod17.2%
add-sqr-sqrt39.4%
Applied egg-rr39.4%
Final simplification47.8%
(FPCore (x y z t) :precision binary64 (* y (sqrt (* 2.0 z))))
double code(double x, double y, double z, double t) {
return y * 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 = y * sqrt((2.0d0 * z))
end function
public static double code(double x, double y, double z, double t) {
return y * Math.sqrt((2.0 * z));
}
def code(x, y, z, t): return y * math.sqrt((2.0 * z))
function code(x, y, z, t) return Float64(y * sqrt(Float64(2.0 * z))) end
function tmp = code(x, y, z, t) tmp = y * sqrt((2.0 * z)); end
code[x_, y_, z_, t_] := N[(y * N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \sqrt{2 \cdot z}
\end{array}
Initial program 99.1%
Taylor expanded in t around 0 57.6%
associate-*l*57.5%
Simplified57.5%
Taylor expanded in x around 0 36.6%
mul-1-neg36.6%
associate-*l*36.5%
distribute-rgt-neg-in36.5%
distribute-lft-neg-out36.5%
*-commutative36.5%
Simplified36.5%
expm1-log1p-u21.1%
expm1-udef15.3%
associate-*r*15.3%
sqrt-prod15.7%
add-sqr-sqrt14.7%
sqrt-unprod14.2%
sqr-neg14.2%
sqrt-unprod1.2%
add-sqr-sqrt2.2%
Applied egg-rr2.2%
expm1-def2.2%
expm1-log1p2.5%
*-commutative2.5%
Simplified2.5%
Final simplification2.5%
(FPCore (x y z t) :precision binary64 (* x (sqrt (* 0.5 z))))
double code(double x, double y, double z, double t) {
return x * sqrt((0.5 * z));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x * sqrt((0.5d0 * z))
end function
public static double code(double x, double y, double z, double t) {
return x * Math.sqrt((0.5 * z));
}
def code(x, y, z, t): return x * math.sqrt((0.5 * z))
function code(x, y, z, t) return Float64(x * sqrt(Float64(0.5 * z))) end
function tmp = code(x, y, z, t) tmp = x * sqrt((0.5 * z)); end
code[x_, y_, z_, t_] := N[(x * N[Sqrt[N[(0.5 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \sqrt{0.5 \cdot z}
\end{array}
Initial program 99.1%
Taylor expanded in t around 0 57.6%
associate-*l*57.5%
Simplified57.5%
Taylor expanded in x around inf 23.9%
associate-*r*23.9%
Simplified23.9%
add-sqr-sqrt9.6%
sqrt-unprod15.7%
*-commutative15.7%
*-commutative15.7%
swap-sqr17.2%
add-sqr-sqrt17.2%
*-commutative17.2%
*-commutative17.2%
swap-sqr17.2%
swap-sqr17.2%
add-sqr-sqrt17.2%
metadata-eval17.2%
Applied egg-rr17.2%
*-commutative17.2%
associate-*r*17.2%
metadata-eval17.2%
Simplified17.2%
associate-*r*17.2%
sqrt-prod13.9%
sqrt-prod9.5%
add-sqr-sqrt24.0%
Applied egg-rr24.0%
Final simplification24.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 2023185
(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))))