
(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 7 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (exp (/ (* t t) 2.0))))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * exp(((t * t) / 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * Math.exp(((t * t) / 2.0));
}
def code(x, y, z, t): return (((x * 0.5) - y) * math.sqrt((z * 2.0))) * math.exp(((t * t) / 2.0))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * exp(Float64(Float64(t * t) / 2.0))) end
function tmp = code(x, y, z, t) tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}}
\end{array}
(FPCore (x y z t) :precision binary64 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (exp (/ (* t t) 2.0))))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * exp(((t * t) / 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * Math.exp(((t * t) / 2.0));
}
def code(x, y, z, t): return (((x * 0.5) - y) * math.sqrt((z * 2.0))) * math.exp(((t * t) / 2.0))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * exp(Float64(Float64(t * t) / 2.0))) end
function tmp = code(x, y, z, t) tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}}
\end{array}
Initial program 99.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (* z 2.0))) (t_2 (exp (/ (* t t) 2.0))))
(if (or (<= x -0.0122) (not (<= x 1.05e-69)))
(* t_2 (* 0.5 (* x t_1)))
(* t_2 (* t_1 (- y))))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z * 2.0));
double t_2 = exp(((t * t) / 2.0));
double tmp;
if ((x <= -0.0122) || !(x <= 1.05e-69)) {
tmp = t_2 * (0.5 * (x * t_1));
} else {
tmp = t_2 * (t_1 * -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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((z * 2.0d0))
t_2 = exp(((t * t) / 2.0d0))
if ((x <= (-0.0122d0)) .or. (.not. (x <= 1.05d-69))) then
tmp = t_2 * (0.5d0 * (x * t_1))
else
tmp = t_2 * (t_1 * -y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((z * 2.0));
double t_2 = Math.exp(((t * t) / 2.0));
double tmp;
if ((x <= -0.0122) || !(x <= 1.05e-69)) {
tmp = t_2 * (0.5 * (x * t_1));
} else {
tmp = t_2 * (t_1 * -y);
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((z * 2.0)) t_2 = math.exp(((t * t) / 2.0)) tmp = 0 if (x <= -0.0122) or not (x <= 1.05e-69): tmp = t_2 * (0.5 * (x * t_1)) else: tmp = t_2 * (t_1 * -y) return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(z * 2.0)) t_2 = exp(Float64(Float64(t * t) / 2.0)) tmp = 0.0 if ((x <= -0.0122) || !(x <= 1.05e-69)) tmp = Float64(t_2 * Float64(0.5 * Float64(x * t_1))); else tmp = Float64(t_2 * Float64(t_1 * Float64(-y))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt((z * 2.0)); t_2 = exp(((t * t) / 2.0)); tmp = 0.0; if ((x <= -0.0122) || ~((x <= 1.05e-69))) tmp = t_2 * (0.5 * (x * t_1)); else tmp = t_2 * (t_1 * -y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[x, -0.0122], N[Not[LessEqual[x, 1.05e-69]], $MachinePrecision]], N[(t$95$2 * N[(0.5 * N[(x * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$2 * N[(t$95$1 * (-y)), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
t_2 := e^{\frac{t \cdot t}{2}}\\
\mathbf{if}\;x \leq -0.0122 \lor \neg \left(x \leq 1.05 \cdot 10^{-69}\right):\\
\;\;\;\;t\_2 \cdot \left(0.5 \cdot \left(x \cdot t\_1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2 \cdot \left(t\_1 \cdot \left(-y\right)\right)\\
\end{array}
\end{array}
if x < -0.0122000000000000008 or 1.05e-69 < x Initial program 99.8%
Taylor expanded in x around inf 83.1%
*-commutative83.1%
associate-*l*83.1%
*-commutative83.1%
associate-*r*83.1%
associate-*l*83.1%
Simplified83.1%
pow183.1%
associate-*r*83.1%
sqrt-prod83.2%
*-commutative83.2%
Applied egg-rr83.2%
unpow183.2%
associate-*r*83.2%
*-commutative83.2%
Simplified83.2%
if -0.0122000000000000008 < x < 1.05e-69Initial program 99.9%
Taylor expanded in x around 0 83.3%
mul-1-neg83.3%
associate-*l*83.2%
*-commutative83.2%
distribute-rgt-neg-in83.2%
distribute-rgt-neg-in83.2%
Simplified83.2%
distribute-rgt-neg-out83.2%
sqrt-prod83.4%
*-commutative83.4%
Applied egg-rr83.4%
*-commutative83.4%
Simplified83.4%
Final simplification83.3%
(FPCore (x y z t)
:precision binary64
(if (<= x -1.65e+192)
(* 0.5 (* (* x (sqrt 2.0)) (sqrt z)))
(if (<= x 4.8e-18)
(* (exp (/ (* t t) 2.0)) (* (sqrt (* z 2.0)) (- y)))
(* 0.5 (* x (* (sqrt 2.0) (sqrt z)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.65e+192) {
tmp = 0.5 * ((x * sqrt(2.0)) * sqrt(z));
} else if (x <= 4.8e-18) {
tmp = exp(((t * t) / 2.0)) * (sqrt((z * 2.0)) * -y);
} else {
tmp = 0.5 * (x * (sqrt(2.0) * sqrt(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.65d+192)) then
tmp = 0.5d0 * ((x * sqrt(2.0d0)) * sqrt(z))
else if (x <= 4.8d-18) then
tmp = exp(((t * t) / 2.0d0)) * (sqrt((z * 2.0d0)) * -y)
else
tmp = 0.5d0 * (x * (sqrt(2.0d0) * sqrt(z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.65e+192) {
tmp = 0.5 * ((x * Math.sqrt(2.0)) * Math.sqrt(z));
} else if (x <= 4.8e-18) {
tmp = Math.exp(((t * t) / 2.0)) * (Math.sqrt((z * 2.0)) * -y);
} else {
tmp = 0.5 * (x * (Math.sqrt(2.0) * Math.sqrt(z)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.65e+192: tmp = 0.5 * ((x * math.sqrt(2.0)) * math.sqrt(z)) elif x <= 4.8e-18: tmp = math.exp(((t * t) / 2.0)) * (math.sqrt((z * 2.0)) * -y) else: tmp = 0.5 * (x * (math.sqrt(2.0) * math.sqrt(z))) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.65e+192) tmp = Float64(0.5 * Float64(Float64(x * sqrt(2.0)) * sqrt(z))); elseif (x <= 4.8e-18) tmp = Float64(exp(Float64(Float64(t * t) / 2.0)) * Float64(sqrt(Float64(z * 2.0)) * Float64(-y))); else tmp = Float64(0.5 * Float64(x * Float64(sqrt(2.0) * sqrt(z)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -1.65e+192) tmp = 0.5 * ((x * sqrt(2.0)) * sqrt(z)); elseif (x <= 4.8e-18) tmp = exp(((t * t) / 2.0)) * (sqrt((z * 2.0)) * -y); else tmp = 0.5 * (x * (sqrt(2.0) * sqrt(z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.65e+192], N[(0.5 * N[(N[(x * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] * N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.8e-18], N[(N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision] * (-y)), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(x * N[(N[Sqrt[2.0], $MachinePrecision] * N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.65 \cdot 10^{+192}:\\
\;\;\;\;0.5 \cdot \left(\left(x \cdot \sqrt{2}\right) \cdot \sqrt{z}\right)\\
\mathbf{elif}\;x \leq 4.8 \cdot 10^{-18}:\\
\;\;\;\;e^{\frac{t \cdot t}{2}} \cdot \left(\sqrt{z \cdot 2} \cdot \left(-y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \left(\sqrt{2} \cdot \sqrt{z}\right)\right)\\
\end{array}
\end{array}
if x < -1.65000000000000005e192Initial program 99.9%
Taylor expanded in x around 0 95.9%
+-commutative95.9%
mul-1-neg95.9%
unsub-neg95.9%
associate-*l*95.9%
*-commutative95.9%
associate-*l*95.9%
*-commutative95.9%
associate-*r*95.9%
*-commutative95.9%
distribute-rgt-out--99.6%
*-commutative99.6%
associate-*l*99.6%
*-commutative99.6%
Simplified99.6%
Taylor expanded in x around inf 92.2%
associate-*r*92.2%
Simplified92.2%
Taylor expanded in t around 0 67.8%
if -1.65000000000000005e192 < x < 4.79999999999999988e-18Initial program 99.8%
Taylor expanded in x around 0 74.5%
mul-1-neg74.5%
associate-*l*74.5%
*-commutative74.5%
distribute-rgt-neg-in74.5%
distribute-rgt-neg-in74.5%
Simplified74.5%
distribute-rgt-neg-out74.5%
sqrt-prod74.5%
*-commutative74.5%
Applied egg-rr74.5%
*-commutative74.5%
Simplified74.5%
if 4.79999999999999988e-18 < x Initial program 99.8%
Taylor expanded in x around 0 99.5%
+-commutative99.5%
mul-1-neg99.5%
unsub-neg99.5%
associate-*l*99.5%
*-commutative99.5%
associate-*l*99.6%
*-commutative99.6%
associate-*r*99.6%
*-commutative99.6%
distribute-rgt-out--99.6%
*-commutative99.6%
associate-*l*99.6%
*-commutative99.6%
Simplified99.6%
Taylor expanded in x around inf 84.0%
associate-*r*84.0%
Simplified84.0%
Taylor expanded in t around 0 49.7%
associate-*l*49.8%
Simplified49.8%
Final simplification67.6%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.45e-79) (not (<= y 3.6e+164))) (* (sqrt (* z 2.0)) (- y)) (* 0.5 (* x (* (sqrt 2.0) (sqrt z))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.45e-79) || !(y <= 3.6e+164)) {
tmp = sqrt((z * 2.0)) * -y;
} else {
tmp = 0.5 * (x * (sqrt(2.0) * sqrt(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.45d-79)) .or. (.not. (y <= 3.6d+164))) then
tmp = sqrt((z * 2.0d0)) * -y
else
tmp = 0.5d0 * (x * (sqrt(2.0d0) * sqrt(z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.45e-79) || !(y <= 3.6e+164)) {
tmp = Math.sqrt((z * 2.0)) * -y;
} else {
tmp = 0.5 * (x * (Math.sqrt(2.0) * Math.sqrt(z)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.45e-79) or not (y <= 3.6e+164): tmp = math.sqrt((z * 2.0)) * -y else: tmp = 0.5 * (x * (math.sqrt(2.0) * math.sqrt(z))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.45e-79) || !(y <= 3.6e+164)) tmp = Float64(sqrt(Float64(z * 2.0)) * Float64(-y)); else tmp = Float64(0.5 * Float64(x * Float64(sqrt(2.0) * sqrt(z)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.45e-79) || ~((y <= 3.6e+164))) tmp = sqrt((z * 2.0)) * -y; else tmp = 0.5 * (x * (sqrt(2.0) * sqrt(z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.45e-79], N[Not[LessEqual[y, 3.6e+164]], $MachinePrecision]], N[(N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision] * (-y)), $MachinePrecision], N[(0.5 * N[(x * N[(N[Sqrt[2.0], $MachinePrecision] * N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.45 \cdot 10^{-79} \lor \neg \left(y \leq 3.6 \cdot 10^{+164}\right):\\
\;\;\;\;\sqrt{z \cdot 2} \cdot \left(-y\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \left(\sqrt{2} \cdot \sqrt{z}\right)\right)\\
\end{array}
\end{array}
if y < -1.45e-79 or 3.5999999999999999e164 < y Initial program 99.9%
Taylor expanded in x around 0 84.5%
mul-1-neg84.5%
associate-*l*84.5%
*-commutative84.5%
distribute-rgt-neg-in84.5%
distribute-rgt-neg-in84.5%
Simplified84.5%
add-sqr-sqrt0.0%
sqrt-unprod6.9%
distribute-rgt-neg-out6.9%
sqrt-prod6.9%
distribute-rgt-neg-out6.9%
sqrt-prod6.9%
sqr-neg6.9%
add-sqr-sqrt6.9%
pow1/26.9%
*-commutative6.9%
Applied egg-rr6.9%
unpow1/26.9%
*-commutative6.9%
Simplified6.9%
Taylor expanded in t around 0 1.0%
*-commutative1.0%
associate-*r*1.0%
*-commutative1.0%
Simplified1.0%
associate-*r*1.0%
sqrt-prod1.0%
add-sqr-sqrt0.3%
sqrt-unprod32.1%
sqr-neg32.1%
sqrt-unprod34.8%
add-sqr-sqrt55.5%
distribute-rgt-neg-out55.5%
sqrt-prod55.4%
associate-*r*55.4%
neg-sub055.4%
*-commutative55.4%
*-commutative55.4%
associate-*l*55.4%
sqrt-prod55.5%
*-commutative55.5%
Applied egg-rr55.5%
neg-sub055.5%
distribute-lft-neg-in55.5%
Simplified55.5%
if -1.45e-79 < y < 3.5999999999999999e164Initial program 99.8%
Taylor expanded in x around 0 99.7%
+-commutative99.7%
mul-1-neg99.7%
unsub-neg99.7%
associate-*l*99.6%
*-commutative99.6%
associate-*l*99.7%
*-commutative99.7%
associate-*r*99.7%
*-commutative99.7%
distribute-rgt-out--99.7%
*-commutative99.7%
associate-*l*99.6%
*-commutative99.6%
Simplified99.6%
Taylor expanded in x around inf 81.7%
associate-*r*81.7%
Simplified81.7%
Taylor expanded in t around 0 43.3%
associate-*l*43.3%
Simplified43.3%
Final simplification47.9%
(FPCore (x y z t) :precision binary64 (if (<= t 3200000.0) (* (sqrt (* z 2.0)) (- y)) (sqrt (* (* z 2.0) (pow y 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 3200000.0) {
tmp = sqrt((z * 2.0)) * -y;
} else {
tmp = sqrt(((z * 2.0) * pow(y, 2.0)));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= 3200000.0d0) then
tmp = sqrt((z * 2.0d0)) * -y
else
tmp = sqrt(((z * 2.0d0) * (y ** 2.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 3200000.0) {
tmp = Math.sqrt((z * 2.0)) * -y;
} else {
tmp = Math.sqrt(((z * 2.0) * Math.pow(y, 2.0)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 3200000.0: tmp = math.sqrt((z * 2.0)) * -y else: tmp = math.sqrt(((z * 2.0) * math.pow(y, 2.0))) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 3200000.0) tmp = Float64(sqrt(Float64(z * 2.0)) * Float64(-y)); else tmp = sqrt(Float64(Float64(z * 2.0) * (y ^ 2.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 3200000.0) tmp = sqrt((z * 2.0)) * -y; else tmp = sqrt(((z * 2.0) * (y ^ 2.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 3200000.0], N[(N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision] * (-y)), $MachinePrecision], N[Sqrt[N[(N[(z * 2.0), $MachinePrecision] * N[Power[y, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 3200000:\\
\;\;\;\;\sqrt{z \cdot 2} \cdot \left(-y\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\left(z \cdot 2\right) \cdot {y}^{2}}\\
\end{array}
\end{array}
if t < 3.2e6Initial program 99.8%
Taylor expanded in x around 0 56.5%
mul-1-neg56.5%
associate-*l*56.5%
*-commutative56.5%
distribute-rgt-neg-in56.5%
distribute-rgt-neg-in56.5%
Simplified56.5%
add-sqr-sqrt0.0%
sqrt-unprod8.6%
distribute-rgt-neg-out8.6%
sqrt-prod8.6%
distribute-rgt-neg-out8.6%
sqrt-prod8.6%
sqr-neg8.6%
add-sqr-sqrt8.6%
pow1/28.6%
*-commutative8.6%
Applied egg-rr8.6%
unpow1/28.6%
*-commutative8.6%
Simplified8.6%
Taylor expanded in t around 0 3.0%
*-commutative3.0%
associate-*r*3.0%
*-commutative3.0%
Simplified3.0%
associate-*r*3.0%
sqrt-prod3.0%
add-sqr-sqrt1.1%
sqrt-unprod16.9%
sqr-neg16.9%
sqrt-unprod19.1%
add-sqr-sqrt35.7%
distribute-rgt-neg-out35.7%
sqrt-prod35.6%
associate-*r*35.6%
neg-sub035.6%
*-commutative35.6%
*-commutative35.6%
associate-*l*35.6%
sqrt-prod35.7%
*-commutative35.7%
Applied egg-rr35.7%
neg-sub035.7%
distribute-lft-neg-in35.7%
Simplified35.7%
if 3.2e6 < t Initial program 100.0%
Taylor expanded in x around 0 64.3%
mul-1-neg64.3%
associate-*l*64.3%
*-commutative64.3%
distribute-rgt-neg-in64.3%
distribute-rgt-neg-in64.3%
Simplified64.3%
add-sqr-sqrt0.0%
sqrt-unprod30.4%
distribute-rgt-neg-out30.4%
sqrt-prod30.4%
distribute-rgt-neg-out30.4%
sqrt-prod30.4%
sqr-neg30.4%
add-sqr-sqrt30.4%
pow1/230.4%
*-commutative30.4%
Applied egg-rr30.4%
unpow1/230.4%
*-commutative30.4%
Simplified30.4%
Taylor expanded in t around 0 1.4%
*-commutative1.4%
associate-*r*1.4%
*-commutative1.4%
Simplified1.4%
add-sqr-sqrt1.0%
sqrt-unprod6.8%
associate-*r*6.8%
sqrt-prod6.8%
associate-*r*6.8%
sqrt-prod6.8%
swap-sqr12.0%
add-sqr-sqrt12.0%
pow212.0%
Applied egg-rr12.0%
Final simplification30.5%
(FPCore (x y z t) :precision binary64 (* (sqrt (* z 2.0)) (- y)))
double code(double x, double y, double z, double t) {
return sqrt((z * 2.0)) * -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
end function
public static double code(double x, double y, double z, double t) {
return Math.sqrt((z * 2.0)) * -y;
}
def code(x, y, z, t): return math.sqrt((z * 2.0)) * -y
function code(x, y, z, t) return Float64(sqrt(Float64(z * 2.0)) * Float64(-y)) end
function tmp = code(x, y, z, t) tmp = sqrt((z * 2.0)) * -y; end
code[x_, y_, z_, t_] := N[(N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision] * (-y)), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{z \cdot 2} \cdot \left(-y\right)
\end{array}
Initial program 99.8%
Taylor expanded in x around 0 58.2%
mul-1-neg58.2%
associate-*l*58.2%
*-commutative58.2%
distribute-rgt-neg-in58.2%
distribute-rgt-neg-in58.2%
Simplified58.2%
add-sqr-sqrt0.0%
sqrt-unprod13.4%
distribute-rgt-neg-out13.4%
sqrt-prod13.4%
distribute-rgt-neg-out13.4%
sqrt-prod13.4%
sqr-neg13.4%
add-sqr-sqrt13.4%
pow1/213.4%
*-commutative13.4%
Applied egg-rr13.4%
unpow1/213.4%
*-commutative13.4%
Simplified13.4%
Taylor expanded in t around 0 2.6%
*-commutative2.6%
associate-*r*2.6%
*-commutative2.6%
Simplified2.6%
associate-*r*2.6%
sqrt-prod2.6%
add-sqr-sqrt1.1%
sqrt-unprod15.5%
sqr-neg15.5%
sqrt-unprod15.5%
add-sqr-sqrt29.1%
distribute-rgt-neg-out29.1%
sqrt-prod29.1%
associate-*r*29.1%
neg-sub029.1%
*-commutative29.1%
*-commutative29.1%
associate-*l*29.1%
sqrt-prod29.1%
*-commutative29.1%
Applied egg-rr29.1%
neg-sub029.1%
distribute-lft-neg-in29.1%
Simplified29.1%
Final simplification29.1%
(FPCore (x y z t) :precision binary64 (* y (sqrt (* z 2.0))))
double code(double x, double y, double z, double t) {
return y * sqrt((z * 2.0));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = y * sqrt((z * 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
return y * Math.sqrt((z * 2.0));
}
def code(x, y, z, t): return y * math.sqrt((z * 2.0))
function code(x, y, z, t) return Float64(y * sqrt(Float64(z * 2.0))) end
function tmp = code(x, y, z, t) tmp = y * sqrt((z * 2.0)); end
code[x_, y_, z_, t_] := N[(y * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \sqrt{z \cdot 2}
\end{array}
Initial program 99.8%
Taylor expanded in x around 0 58.2%
mul-1-neg58.2%
associate-*l*58.2%
*-commutative58.2%
distribute-rgt-neg-in58.2%
distribute-rgt-neg-in58.2%
Simplified58.2%
add-sqr-sqrt0.0%
sqrt-unprod13.4%
distribute-rgt-neg-out13.4%
sqrt-prod13.4%
distribute-rgt-neg-out13.4%
sqrt-prod13.4%
sqr-neg13.4%
add-sqr-sqrt13.4%
pow1/213.4%
*-commutative13.4%
Applied egg-rr13.4%
unpow1/213.4%
*-commutative13.4%
Simplified13.4%
Taylor expanded in t around 0 2.6%
*-commutative2.6%
associate-*r*2.6%
*-commutative2.6%
Simplified2.6%
associate-*r*2.6%
sqrt-prod2.6%
add-sqr-sqrt1.1%
sqrt-unprod15.5%
sqr-neg15.5%
sqrt-unprod15.5%
add-sqr-sqrt29.1%
expm1-log1p-u19.3%
expm1-undefine12.3%
Applied egg-rr2.6%
log1p-undefine2.6%
rem-exp-log2.8%
+-commutative2.8%
associate--l+2.6%
metadata-eval2.6%
+-rgt-identity2.6%
Simplified2.6%
Final simplification2.6%
(FPCore (x y z t) :precision binary64 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (pow (exp 1.0) (/ (* t t) 2.0))))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((z * 2.0))) * pow(exp(1.0), ((t * t) / 2.0));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * (exp(1.0d0) ** ((t * t) / 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * Math.pow(Math.exp(1.0), ((t * t) / 2.0));
}
def code(x, y, z, t): return (((x * 0.5) - y) * math.sqrt((z * 2.0))) * math.pow(math.exp(1.0), ((t * t) / 2.0))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * (exp(1.0) ^ Float64(Float64(t * t) / 2.0))) end
function tmp = code(x, y, z, t) tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * (exp(1.0) ^ ((t * t) / 2.0)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Power[N[Exp[1.0], $MachinePrecision], N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot {\left(e^{1}\right)}^{\left(\frac{t \cdot t}{2}\right)}
\end{array}
herbie shell --seed 2024119
(FPCore (x y z t)
:name "Data.Number.Erf:$cinvnormcdf from erf-2.0.0.0, A"
:precision binary64
:alt
(* (* (- (* 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))))