
(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 (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(2.0 * Float64(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[(2.0 * N[(z * N[Exp[N[(t * t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 0.5 - y\right) \cdot \sqrt{2 \cdot \left(z \cdot e^{t \cdot t}\right)}
\end{array}
Initial program 99.9%
add-cube-cbrt99.3%
pow399.3%
Applied egg-rr99.3%
expm1-log1p-u55.4%
expm1-udef46.2%
Applied egg-rr46.2%
expm1-def55.6%
expm1-log1p99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x 0.5) y)))
(if (<= (* t t) 2e-23)
(* t_1 (sqrt (* 2.0 z)))
(if (<= (* t t) 2e+276)
(* (sqrt (* 2.0 (* z (exp (* t t))))) (- y))
(* t_1 (sqrt (* 2.0 (+ z (* z (* t t))))))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double tmp;
if ((t * t) <= 2e-23) {
tmp = t_1 * sqrt((2.0 * z));
} else if ((t * t) <= 2e+276) {
tmp = sqrt((2.0 * (z * exp((t * t))))) * -y;
} else {
tmp = t_1 * sqrt((2.0 * (z + (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 = (x * 0.5d0) - y
if ((t * t) <= 2d-23) then
tmp = t_1 * sqrt((2.0d0 * z))
else if ((t * t) <= 2d+276) then
tmp = sqrt((2.0d0 * (z * exp((t * t))))) * -y
else
tmp = t_1 * sqrt((2.0d0 * (z + (z * (t * t)))))
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 * t) <= 2e-23) {
tmp = t_1 * Math.sqrt((2.0 * z));
} else if ((t * t) <= 2e+276) {
tmp = Math.sqrt((2.0 * (z * Math.exp((t * t))))) * -y;
} else {
tmp = t_1 * Math.sqrt((2.0 * (z + (z * (t * t)))));
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * 0.5) - y tmp = 0 if (t * t) <= 2e-23: tmp = t_1 * math.sqrt((2.0 * z)) elif (t * t) <= 2e+276: tmp = math.sqrt((2.0 * (z * math.exp((t * t))))) * -y else: tmp = t_1 * math.sqrt((2.0 * (z + (z * (t * t))))) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * 0.5) - y) tmp = 0.0 if (Float64(t * t) <= 2e-23) tmp = Float64(t_1 * sqrt(Float64(2.0 * z))); elseif (Float64(t * t) <= 2e+276) tmp = Float64(sqrt(Float64(2.0 * Float64(z * exp(Float64(t * t))))) * Float64(-y)); else tmp = Float64(t_1 * sqrt(Float64(2.0 * Float64(z + Float64(z * Float64(t * t)))))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * 0.5) - y; tmp = 0.0; if ((t * t) <= 2e-23) tmp = t_1 * sqrt((2.0 * z)); elseif ((t * t) <= 2e+276) tmp = sqrt((2.0 * (z * exp((t * t))))) * -y; else tmp = t_1 * sqrt((2.0 * (z + (z * (t * t))))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[N[(t * t), $MachinePrecision], 2e-23], N[(t$95$1 * N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(t * t), $MachinePrecision], 2e+276], N[(N[Sqrt[N[(2.0 * N[(z * N[Exp[N[(t * t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-y)), $MachinePrecision], N[(t$95$1 * N[Sqrt[N[(2.0 * N[(z + N[(z * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
\mathbf{if}\;t \cdot t \leq 2 \cdot 10^{-23}:\\
\;\;\;\;t_1 \cdot \sqrt{2 \cdot z}\\
\mathbf{elif}\;t \cdot t \leq 2 \cdot 10^{+276}:\\
\;\;\;\;\sqrt{2 \cdot \left(z \cdot e^{t \cdot t}\right)} \cdot \left(-y\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \sqrt{2 \cdot \left(z + z \cdot \left(t \cdot t\right)\right)}\\
\end{array}
\end{array}
if (*.f64 t t) < 1.99999999999999992e-23Initial program 99.7%
Taylor expanded in t around 0 99.3%
associate-*r*99.2%
sqrt-prod99.7%
sub-neg99.7%
*-commutative99.7%
sub-neg99.7%
add-sqr-sqrt49.7%
sqrt-prod30.5%
unpow230.5%
sqrt-prod24.6%
pow1/224.6%
associate-*l*24.6%
Applied egg-rr24.6%
unpow1/224.6%
*-commutative24.6%
sqrt-prod30.5%
*-commutative30.5%
sqrt-prod30.5%
unpow230.5%
sqrt-prod49.5%
add-sqr-sqrt99.3%
associate-*r*99.2%
sqrt-unprod99.7%
Applied egg-rr99.7%
if 1.99999999999999992e-23 < (*.f64 t t) < 2.0000000000000001e276Initial program 100.0%
sqr-neg100.0%
associate-/l*100.0%
distribute-frac-neg100.0%
exp-neg100.0%
associate-*r/100.0%
*-rgt-identity100.0%
associate-*r/100.0%
*-rgt-identity100.0%
associate-*r/100.0%
exp-neg100.0%
distribute-frac-neg100.0%
associate-/l*100.0%
sqr-neg100.0%
exp-sqrt100.0%
Simplified100.0%
Taylor expanded in x around 0 66.7%
mul-1-neg66.7%
unpow266.7%
Simplified66.7%
expm1-log1p-u37.2%
expm1-udef37.2%
associate-*l*37.2%
sqrt-unprod37.2%
Applied egg-rr37.2%
expm1-def37.2%
expm1-log1p66.7%
Simplified66.7%
if 2.0000000000000001e276 < (*.f64 t t) Initial program 100.0%
add-cube-cbrt100.0%
pow3100.0%
Applied egg-rr100.0%
expm1-log1p-u49.3%
expm1-udef49.3%
Applied egg-rr49.3%
expm1-def49.3%
expm1-log1p100.0%
Simplified100.0%
Taylor expanded in t around 0 100.0%
*-commutative100.0%
unpow2100.0%
Simplified100.0%
Final simplification90.1%
(FPCore (x y z t) :precision binary64 (* (- (* x 0.5) y) (sqrt (* 2.0 (+ z (* z (* t t)))))))
double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * sqrt((2.0 * (z + (z * (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 + (z * (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 + (z * (t * t)))));
}
def code(x, y, z, t): return ((x * 0.5) - y) * math.sqrt((2.0 * (z + (z * (t * t)))))
function code(x, y, z, t) return Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(2.0 * Float64(z + Float64(z * Float64(t * t)))))) end
function tmp = code(x, y, z, t) tmp = ((x * 0.5) - y) * sqrt((2.0 * (z + (z * (t * t))))); end
code[x_, y_, z_, t_] := N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(2.0 * N[(z + N[(z * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 0.5 - y\right) \cdot \sqrt{2 \cdot \left(z + z \cdot \left(t \cdot t\right)\right)}
\end{array}
Initial program 99.9%
add-cube-cbrt99.3%
pow399.3%
Applied egg-rr99.3%
expm1-log1p-u55.4%
expm1-udef46.2%
Applied egg-rr46.2%
expm1-def55.6%
expm1-log1p99.9%
Simplified99.9%
Taylor expanded in t around 0 82.4%
*-commutative82.4%
unpow282.4%
Simplified82.4%
Final simplification82.4%
(FPCore (x y z t) :precision binary64 (if (<= (* x 0.5) 4e+184) (* (- (* x 0.5) y) (sqrt (* 2.0 z))) (pow (* (* 0.5 z) (* x x)) 0.5)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x * 0.5) <= 4e+184) {
tmp = ((x * 0.5) - y) * sqrt((2.0 * z));
} else {
tmp = pow(((0.5 * z) * (x * x)), 0.5);
}
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 * 0.5d0) <= 4d+184) then
tmp = ((x * 0.5d0) - y) * sqrt((2.0d0 * z))
else
tmp = ((0.5d0 * z) * (x * x)) ** 0.5d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x * 0.5) <= 4e+184) {
tmp = ((x * 0.5) - y) * Math.sqrt((2.0 * z));
} else {
tmp = Math.pow(((0.5 * z) * (x * x)), 0.5);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x * 0.5) <= 4e+184: tmp = ((x * 0.5) - y) * math.sqrt((2.0 * z)) else: tmp = math.pow(((0.5 * z) * (x * x)), 0.5) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x * 0.5) <= 4e+184) tmp = Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(2.0 * z))); else tmp = Float64(Float64(0.5 * z) * Float64(x * x)) ^ 0.5; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x * 0.5) <= 4e+184) tmp = ((x * 0.5) - y) * sqrt((2.0 * z)); else tmp = ((0.5 * z) * (x * x)) ^ 0.5; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x * 0.5), $MachinePrecision], 4e+184], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Power[N[(N[(0.5 * z), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot 0.5 \leq 4 \cdot 10^{+184}:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot \sqrt{2 \cdot z}\\
\mathbf{else}:\\
\;\;\;\;{\left(\left(0.5 \cdot z\right) \cdot \left(x \cdot x\right)\right)}^{0.5}\\
\end{array}
\end{array}
if (*.f64 x 1/2) < 4.00000000000000007e184Initial program 99.8%
Taylor expanded in t around 0 52.5%
associate-*r*52.5%
sqrt-prod52.7%
sub-neg52.7%
*-commutative52.7%
sub-neg52.7%
add-sqr-sqrt24.6%
sqrt-prod21.8%
unpow221.8%
sqrt-prod22.3%
pow1/222.3%
associate-*l*22.3%
Applied egg-rr22.3%
unpow1/222.3%
*-commutative22.3%
sqrt-prod21.8%
*-commutative21.8%
sqrt-prod21.8%
unpow221.8%
sqrt-prod24.5%
add-sqr-sqrt52.5%
associate-*r*52.5%
sqrt-unprod52.7%
Applied egg-rr52.7%
if 4.00000000000000007e184 < (*.f64 x 1/2) Initial program 100.0%
Taylor expanded in t around 0 49.7%
associate-*r*49.6%
sqrt-prod49.7%
sub-neg49.7%
*-commutative49.7%
sub-neg49.7%
add-sqr-sqrt49.2%
sqrt-prod83.8%
unpow283.8%
sqrt-prod83.8%
pow1/283.8%
associate-*l*83.8%
Applied egg-rr83.8%
Taylor expanded in x around inf 83.8%
*-commutative83.8%
associate-*r*83.8%
*-commutative83.8%
unpow283.8%
Simplified83.8%
Final simplification56.3%
(FPCore (x y z t)
:precision binary64
(if (<= y -6.5e-26)
(sqrt (* (* 2.0 z) (* y y)))
(if (<= y 1.25e-90)
(* x (sqrt (* 0.5 z)))
(- (sqrt (* y (* y (* 2.0 z))))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -6.5e-26) {
tmp = sqrt(((2.0 * z) * (y * y)));
} else if (y <= 1.25e-90) {
tmp = x * sqrt((0.5 * z));
} else {
tmp = -sqrt((y * (y * (2.0 * 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 <= (-6.5d-26)) then
tmp = sqrt(((2.0d0 * z) * (y * y)))
else if (y <= 1.25d-90) then
tmp = x * sqrt((0.5d0 * z))
else
tmp = -sqrt((y * (y * (2.0d0 * z))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -6.5e-26) {
tmp = Math.sqrt(((2.0 * z) * (y * y)));
} else if (y <= 1.25e-90) {
tmp = x * Math.sqrt((0.5 * z));
} else {
tmp = -Math.sqrt((y * (y * (2.0 * z))));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -6.5e-26: tmp = math.sqrt(((2.0 * z) * (y * y))) elif y <= 1.25e-90: tmp = x * math.sqrt((0.5 * z)) else: tmp = -math.sqrt((y * (y * (2.0 * z)))) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -6.5e-26) tmp = sqrt(Float64(Float64(2.0 * z) * Float64(y * y))); elseif (y <= 1.25e-90) tmp = Float64(x * sqrt(Float64(0.5 * z))); else tmp = Float64(-sqrt(Float64(y * Float64(y * Float64(2.0 * z))))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -6.5e-26) tmp = sqrt(((2.0 * z) * (y * y))); elseif (y <= 1.25e-90) tmp = x * sqrt((0.5 * z)); else tmp = -sqrt((y * (y * (2.0 * z)))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -6.5e-26], N[Sqrt[N[(N[(2.0 * z), $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[y, 1.25e-90], N[(x * N[Sqrt[N[(0.5 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], (-N[Sqrt[N[(y * N[(y * N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.5 \cdot 10^{-26}:\\
\;\;\;\;\sqrt{\left(2 \cdot z\right) \cdot \left(y \cdot y\right)}\\
\mathbf{elif}\;y \leq 1.25 \cdot 10^{-90}:\\
\;\;\;\;x \cdot \sqrt{0.5 \cdot z}\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{y \cdot \left(y \cdot \left(2 \cdot z\right)\right)}\\
\end{array}
\end{array}
if y < -6.5e-26Initial program 99.9%
Taylor expanded in t around 0 63.4%
associate-*r*63.2%
sqrt-prod63.6%
sub-neg63.6%
*-commutative63.6%
sub-neg63.6%
add-sqr-sqrt58.8%
sqrt-prod56.9%
unpow256.9%
sqrt-prod58.3%
pow1/258.3%
associate-*l*58.3%
Applied egg-rr58.3%
Taylor expanded in x around 0 52.8%
associate-*r*52.8%
*-commutative52.8%
associate-*r*52.8%
unpow252.8%
associate-*l*50.1%
Simplified50.1%
unpow1/250.1%
associate-*r*52.8%
Applied egg-rr52.8%
if -6.5e-26 < y < 1.25000000000000005e-90Initial program 99.9%
Taylor expanded in t around 0 45.8%
associate-*r*45.8%
sqrt-prod46.0%
sub-neg46.0%
*-commutative46.0%
sub-neg46.0%
add-sqr-sqrt22.7%
sqrt-prod27.0%
unpow227.0%
sqrt-prod27.0%
pow1/227.0%
associate-*l*27.0%
Applied egg-rr27.0%
Taylor expanded in x around inf 41.1%
expm1-log1p-u27.5%
expm1-udef15.5%
associate-*l*15.5%
pow1/215.5%
pow1/215.5%
pow-prod-down15.5%
Applied egg-rr15.5%
expm1-def27.5%
expm1-log1p41.2%
unpow1/241.2%
*-commutative41.2%
Simplified41.2%
if 1.25000000000000005e-90 < y Initial program 99.8%
sqr-neg99.8%
associate-/l*99.8%
distribute-frac-neg99.8%
exp-neg99.8%
associate-*r/99.8%
*-rgt-identity99.8%
associate-*r/99.8%
*-rgt-identity99.8%
associate-*r/99.8%
exp-neg99.8%
distribute-frac-neg99.8%
associate-/l*99.8%
sqr-neg99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in x around 0 86.8%
mul-1-neg86.8%
unpow286.8%
Simplified86.8%
Taylor expanded in t around 0 40.2%
associate-*l*40.2%
Simplified40.2%
add-sqr-sqrt40.2%
sqrt-unprod40.4%
swap-sqr44.4%
sqrt-unprod44.4%
sqrt-unprod44.4%
add-sqr-sqrt44.4%
Applied egg-rr44.4%
associate-*l*40.4%
Simplified40.4%
Final simplification44.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (* (* 2.0 z) (* y y)))))
(if (<= y -1.8e-25)
t_1
(if (<= y 1.85e-90) (* x (sqrt (* 0.5 z))) (- t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt(((2.0 * z) * (y * y)));
double tmp;
if (y <= -1.8e-25) {
tmp = t_1;
} else if (y <= 1.85e-90) {
tmp = x * sqrt((0.5 * z));
} else {
tmp = -t_1;
}
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) * (y * y)))
if (y <= (-1.8d-25)) then
tmp = t_1
else if (y <= 1.85d-90) then
tmp = x * sqrt((0.5d0 * z))
else
tmp = -t_1
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) * (y * y)));
double tmp;
if (y <= -1.8e-25) {
tmp = t_1;
} else if (y <= 1.85e-90) {
tmp = x * Math.sqrt((0.5 * z));
} else {
tmp = -t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt(((2.0 * z) * (y * y))) tmp = 0 if y <= -1.8e-25: tmp = t_1 elif y <= 1.85e-90: tmp = x * math.sqrt((0.5 * z)) else: tmp = -t_1 return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(Float64(2.0 * z) * Float64(y * y))) tmp = 0.0 if (y <= -1.8e-25) tmp = t_1; elseif (y <= 1.85e-90) tmp = Float64(x * sqrt(Float64(0.5 * z))); else tmp = Float64(-t_1); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt(((2.0 * z) * (y * y))); tmp = 0.0; if (y <= -1.8e-25) tmp = t_1; elseif (y <= 1.85e-90) tmp = x * sqrt((0.5 * z)); else tmp = -t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(N[(2.0 * z), $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, -1.8e-25], t$95$1, If[LessEqual[y, 1.85e-90], N[(x * N[Sqrt[N[(0.5 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], (-t$95$1)]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{\left(2 \cdot z\right) \cdot \left(y \cdot y\right)}\\
\mathbf{if}\;y \leq -1.8 \cdot 10^{-25}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 1.85 \cdot 10^{-90}:\\
\;\;\;\;x \cdot \sqrt{0.5 \cdot z}\\
\mathbf{else}:\\
\;\;\;\;-t_1\\
\end{array}
\end{array}
if y < -1.8e-25Initial program 99.9%
Taylor expanded in t around 0 63.4%
associate-*r*63.2%
sqrt-prod63.6%
sub-neg63.6%
*-commutative63.6%
sub-neg63.6%
add-sqr-sqrt58.8%
sqrt-prod56.9%
unpow256.9%
sqrt-prod58.3%
pow1/258.3%
associate-*l*58.3%
Applied egg-rr58.3%
Taylor expanded in x around 0 52.8%
associate-*r*52.8%
*-commutative52.8%
associate-*r*52.8%
unpow252.8%
associate-*l*50.1%
Simplified50.1%
unpow1/250.1%
associate-*r*52.8%
Applied egg-rr52.8%
if -1.8e-25 < y < 1.85000000000000009e-90Initial program 99.9%
Taylor expanded in t around 0 45.8%
associate-*r*45.8%
sqrt-prod46.0%
sub-neg46.0%
*-commutative46.0%
sub-neg46.0%
add-sqr-sqrt22.7%
sqrt-prod27.0%
unpow227.0%
sqrt-prod27.0%
pow1/227.0%
associate-*l*27.0%
Applied egg-rr27.0%
Taylor expanded in x around inf 41.1%
expm1-log1p-u27.5%
expm1-udef15.5%
associate-*l*15.5%
pow1/215.5%
pow1/215.5%
pow-prod-down15.5%
Applied egg-rr15.5%
expm1-def27.5%
expm1-log1p41.2%
unpow1/241.2%
*-commutative41.2%
Simplified41.2%
if 1.85000000000000009e-90 < y Initial program 99.8%
sqr-neg99.8%
associate-/l*99.8%
distribute-frac-neg99.8%
exp-neg99.8%
associate-*r/99.8%
*-rgt-identity99.8%
associate-*r/99.8%
*-rgt-identity99.8%
associate-*r/99.8%
exp-neg99.8%
distribute-frac-neg99.8%
associate-/l*99.8%
sqr-neg99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in x around 0 86.8%
mul-1-neg86.8%
unpow286.8%
Simplified86.8%
Taylor expanded in t around 0 40.2%
associate-*l*40.2%
Simplified40.2%
add-sqr-sqrt40.2%
sqrt-unprod40.4%
swap-sqr44.4%
sqrt-unprod44.4%
sqrt-unprod44.4%
add-sqr-sqrt44.4%
Applied egg-rr44.4%
Final simplification45.6%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2e-26) (not (<= y 1.25e-90))) (* (sqrt (* 2.0 z)) (- y)) (* x (sqrt (* 0.5 z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2e-26) || !(y <= 1.25e-90)) {
tmp = sqrt((2.0 * z)) * -y;
} 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 <= (-2d-26)) .or. (.not. (y <= 1.25d-90))) then
tmp = sqrt((2.0d0 * z)) * -y
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 <= -2e-26) || !(y <= 1.25e-90)) {
tmp = Math.sqrt((2.0 * z)) * -y;
} else {
tmp = x * Math.sqrt((0.5 * z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2e-26) or not (y <= 1.25e-90): tmp = math.sqrt((2.0 * z)) * -y else: tmp = x * math.sqrt((0.5 * z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2e-26) || !(y <= 1.25e-90)) tmp = Float64(sqrt(Float64(2.0 * z)) * Float64(-y)); 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 <= -2e-26) || ~((y <= 1.25e-90))) tmp = sqrt((2.0 * z)) * -y; else tmp = x * sqrt((0.5 * z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2e-26], N[Not[LessEqual[y, 1.25e-90]], $MachinePrecision]], N[(N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision] * (-y)), $MachinePrecision], N[(x * N[Sqrt[N[(0.5 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2 \cdot 10^{-26} \lor \neg \left(y \leq 1.25 \cdot 10^{-90}\right):\\
\;\;\;\;\sqrt{2 \cdot z} \cdot \left(-y\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \sqrt{0.5 \cdot z}\\
\end{array}
\end{array}
if y < -2.0000000000000001e-26 or 1.25000000000000005e-90 < y Initial program 99.8%
sqr-neg99.8%
associate-/l*99.8%
distribute-frac-neg99.8%
exp-neg99.8%
associate-*r/99.8%
*-rgt-identity99.8%
associate-*r/99.8%
*-rgt-identity99.8%
associate-*r/99.8%
exp-neg99.8%
distribute-frac-neg99.8%
associate-/l*99.8%
sqr-neg99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in x around 0 84.0%
mul-1-neg84.0%
unpow284.0%
Simplified84.0%
Taylor expanded in t around 0 44.5%
associate-*l*44.5%
Simplified44.5%
expm1-log1p-u43.5%
expm1-udef25.8%
sqrt-unprod25.8%
Applied egg-rr25.8%
expm1-def43.6%
expm1-log1p44.6%
Simplified44.6%
if -2.0000000000000001e-26 < y < 1.25000000000000005e-90Initial program 99.9%
Taylor expanded in t around 0 45.8%
associate-*r*45.8%
sqrt-prod46.0%
sub-neg46.0%
*-commutative46.0%
sub-neg46.0%
add-sqr-sqrt22.7%
sqrt-prod27.0%
unpow227.0%
sqrt-prod27.0%
pow1/227.0%
associate-*l*27.0%
Applied egg-rr27.0%
Taylor expanded in x around inf 41.1%
expm1-log1p-u27.5%
expm1-udef15.5%
associate-*l*15.5%
pow1/215.5%
pow1/215.5%
pow-prod-down15.5%
Applied egg-rr15.5%
expm1-def27.5%
expm1-log1p41.2%
unpow1/241.2%
*-commutative41.2%
Simplified41.2%
Final simplification43.3%
(FPCore (x y z t) :precision binary64 (if (<= y -1.1e-23) (sqrt (* (* 2.0 z) (* y y))) (if (<= y 1.85e-90) (* x (sqrt (* 0.5 z))) (* (sqrt (* 2.0 z)) (- y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.1e-23) {
tmp = sqrt(((2.0 * z) * (y * y)));
} else if (y <= 1.85e-90) {
tmp = x * sqrt((0.5 * z));
} else {
tmp = sqrt((2.0 * z)) * -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 (y <= (-1.1d-23)) then
tmp = sqrt(((2.0d0 * z) * (y * y)))
else if (y <= 1.85d-90) then
tmp = x * sqrt((0.5d0 * z))
else
tmp = sqrt((2.0d0 * z)) * -y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.1e-23) {
tmp = Math.sqrt(((2.0 * z) * (y * y)));
} else if (y <= 1.85e-90) {
tmp = x * Math.sqrt((0.5 * z));
} else {
tmp = Math.sqrt((2.0 * z)) * -y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.1e-23: tmp = math.sqrt(((2.0 * z) * (y * y))) elif y <= 1.85e-90: tmp = x * math.sqrt((0.5 * z)) else: tmp = math.sqrt((2.0 * z)) * -y return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.1e-23) tmp = sqrt(Float64(Float64(2.0 * z) * Float64(y * y))); elseif (y <= 1.85e-90) tmp = Float64(x * sqrt(Float64(0.5 * z))); else tmp = Float64(sqrt(Float64(2.0 * z)) * Float64(-y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.1e-23) tmp = sqrt(((2.0 * z) * (y * y))); elseif (y <= 1.85e-90) tmp = x * sqrt((0.5 * z)); else tmp = sqrt((2.0 * z)) * -y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.1e-23], N[Sqrt[N[(N[(2.0 * z), $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[y, 1.85e-90], N[(x * N[Sqrt[N[(0.5 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision] * (-y)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.1 \cdot 10^{-23}:\\
\;\;\;\;\sqrt{\left(2 \cdot z\right) \cdot \left(y \cdot y\right)}\\
\mathbf{elif}\;y \leq 1.85 \cdot 10^{-90}:\\
\;\;\;\;x \cdot \sqrt{0.5 \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2 \cdot z} \cdot \left(-y\right)\\
\end{array}
\end{array}
if y < -1.1e-23Initial program 99.9%
Taylor expanded in t around 0 63.4%
associate-*r*63.2%
sqrt-prod63.6%
sub-neg63.6%
*-commutative63.6%
sub-neg63.6%
add-sqr-sqrt58.8%
sqrt-prod56.9%
unpow256.9%
sqrt-prod58.3%
pow1/258.3%
associate-*l*58.3%
Applied egg-rr58.3%
Taylor expanded in x around 0 52.8%
associate-*r*52.8%
*-commutative52.8%
associate-*r*52.8%
unpow252.8%
associate-*l*50.1%
Simplified50.1%
unpow1/250.1%
associate-*r*52.8%
Applied egg-rr52.8%
if -1.1e-23 < y < 1.85000000000000009e-90Initial program 99.9%
Taylor expanded in t around 0 45.8%
associate-*r*45.8%
sqrt-prod46.0%
sub-neg46.0%
*-commutative46.0%
sub-neg46.0%
add-sqr-sqrt22.7%
sqrt-prod27.0%
unpow227.0%
sqrt-prod27.0%
pow1/227.0%
associate-*l*27.0%
Applied egg-rr27.0%
Taylor expanded in x around inf 41.1%
expm1-log1p-u27.5%
expm1-udef15.5%
associate-*l*15.5%
pow1/215.5%
pow1/215.5%
pow-prod-down15.5%
Applied egg-rr15.5%
expm1-def27.5%
expm1-log1p41.2%
unpow1/241.2%
*-commutative41.2%
Simplified41.2%
if 1.85000000000000009e-90 < y Initial program 99.8%
sqr-neg99.8%
associate-/l*99.8%
distribute-frac-neg99.8%
exp-neg99.8%
associate-*r/99.8%
*-rgt-identity99.8%
associate-*r/99.8%
*-rgt-identity99.8%
associate-*r/99.8%
exp-neg99.8%
distribute-frac-neg99.8%
associate-/l*99.8%
sqr-neg99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in x around 0 86.8%
mul-1-neg86.8%
unpow286.8%
Simplified86.8%
Taylor expanded in t around 0 40.2%
associate-*l*40.2%
Simplified40.2%
expm1-log1p-u39.2%
expm1-udef22.3%
sqrt-unprod22.3%
Applied egg-rr22.3%
expm1-def39.2%
expm1-log1p40.3%
Simplified40.3%
Final simplification44.2%
(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.9%
Taylor expanded in t around 0 52.2%
associate-*r*52.1%
sqrt-prod52.3%
sub-neg52.3%
*-commutative52.3%
sub-neg52.3%
add-sqr-sqrt27.5%
sqrt-prod29.1%
unpow229.1%
sqrt-prod29.5%
pow1/229.5%
associate-*l*29.5%
Applied egg-rr29.5%
Taylor expanded in x around inf 24.7%
expm1-log1p-u17.0%
expm1-udef11.8%
associate-*l*11.8%
pow1/211.8%
pow1/211.8%
pow-prod-down11.8%
Applied egg-rr11.8%
expm1-def17.0%
expm1-log1p24.8%
unpow1/224.8%
*-commutative24.8%
Simplified24.8%
Final simplification24.8%
(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 2023280
(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))))