
(FPCore (x y z t) :precision binary64 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (exp (/ (* t t) 2.0))))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * exp(((t * t) / 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * Math.exp(((t * t) / 2.0));
}
def code(x, y, z, t): return (((x * 0.5) - y) * math.sqrt((z * 2.0))) * math.exp(((t * t) / 2.0))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * exp(Float64(Float64(t * t) / 2.0))) end
function tmp = code(x, y, z, t) tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (exp (/ (* t t) 2.0))))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * exp(((t * t) / 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * Math.exp(((t * t) / 2.0));
}
def code(x, y, z, t): return (((x * 0.5) - y) * math.sqrt((z * 2.0))) * math.exp(((t * t) / 2.0))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * exp(Float64(Float64(t * t) / 2.0))) end
function tmp = code(x, y, z, t) tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}}
\end{array}
(FPCore (x y z t) :precision binary64 (* (exp (/ (* t t) 2.0)) (* (- (* x 0.5) y) (sqrt (* z 2.0)))))
double code(double x, double y, double z, double t) {
return exp(((t * t) / 2.0)) * (((x * 0.5) - 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 = exp(((t * t) / 2.0d0)) * (((x * 0.5d0) - y) * sqrt((z * 2.0d0)))
end function
public static double code(double x, double y, double z, double t) {
return Math.exp(((t * t) / 2.0)) * (((x * 0.5) - y) * Math.sqrt((z * 2.0)));
}
def code(x, y, z, t): return math.exp(((t * t) / 2.0)) * (((x * 0.5) - y) * math.sqrt((z * 2.0)))
function code(x, y, z, t) return Float64(exp(Float64(Float64(t * t) / 2.0)) * Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0)))) end
function tmp = code(x, y, z, t) tmp = exp(((t * t) / 2.0)) * (((x * 0.5) - y) * sqrt((z * 2.0))); end
code[x_, y_, z_, t_] := N[(N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{\frac{t \cdot t}{2}} \cdot \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right)
\end{array}
Initial program 99.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(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.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%
expm1-log1p-u98.5%
expm1-udef74.0%
sqrt-unprod74.0%
associate-*l*74.0%
exp-prod74.0%
Applied egg-rr74.0%
expm1-def98.5%
expm1-log1p99.8%
*-commutative99.8%
associate-*l*99.8%
*-commutative99.8%
exp-prod99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (* (- (* x 0.5) y) (* (sqrt (* z 2.0)) (+ 1.0 (* 0.5 (* t t))))))
double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * (sqrt((z * 2.0)) * (1.0 + (0.5 * (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((z * 2.0d0)) * (1.0d0 + (0.5d0 * (t * t))))
end function
public static double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * (Math.sqrt((z * 2.0)) * (1.0 + (0.5 * (t * t))));
}
def code(x, y, z, t): return ((x * 0.5) - y) * (math.sqrt((z * 2.0)) * (1.0 + (0.5 * (t * t))))
function code(x, y, z, t) return Float64(Float64(Float64(x * 0.5) - y) * Float64(sqrt(Float64(z * 2.0)) * Float64(1.0 + Float64(0.5 * Float64(t * t))))) end
function tmp = code(x, y, z, t) tmp = ((x * 0.5) - y) * (sqrt((z * 2.0)) * (1.0 + (0.5 * (t * t)))); end
code[x_, y_, z_, t_] := N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[(N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(0.5 * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 0.5 - y\right) \cdot \left(\sqrt{z \cdot 2} \cdot \left(1 + 0.5 \cdot \left(t \cdot t\right)\right)\right)
\end{array}
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 t around 0 87.0%
unpow287.0%
Simplified87.0%
Final simplification87.0%
(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(2.0 * Float64(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[(2.0 * N[(z * N[(N[(t * t), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 0.5 - y\right) \cdot \sqrt{2 \cdot \left(z \cdot \left(t \cdot t + 1\right)\right)}
\end{array}
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%
expm1-log1p-u98.5%
expm1-udef74.0%
sqrt-unprod74.0%
associate-*l*74.0%
exp-prod74.0%
Applied egg-rr74.0%
expm1-def98.5%
expm1-log1p99.8%
*-commutative99.8%
associate-*l*99.8%
*-commutative99.8%
exp-prod99.8%
Simplified99.8%
Taylor expanded in t around 0 85.0%
distribute-rgt1-in85.0%
unpow285.0%
Simplified85.0%
Final simplification85.0%
(FPCore (x y z t) :precision binary64 (if (<= t 1.45e+79) (* (- (* x 0.5) y) (sqrt (* z 2.0))) (sqrt (* 2.0 (* (* t t) (* y (* y z)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.45e+79) {
tmp = ((x * 0.5) - y) * sqrt((z * 2.0));
} else {
tmp = sqrt((2.0 * ((t * t) * (y * (y * 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 (t <= 1.45d+79) then
tmp = ((x * 0.5d0) - y) * sqrt((z * 2.0d0))
else
tmp = sqrt((2.0d0 * ((t * t) * (y * (y * z)))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.45e+79) {
tmp = ((x * 0.5) - y) * Math.sqrt((z * 2.0));
} else {
tmp = Math.sqrt((2.0 * ((t * t) * (y * (y * z)))));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 1.45e+79: tmp = ((x * 0.5) - y) * math.sqrt((z * 2.0)) else: tmp = math.sqrt((2.0 * ((t * t) * (y * (y * z))))) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 1.45e+79) tmp = Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))); else tmp = sqrt(Float64(2.0 * Float64(Float64(t * t) * Float64(y * Float64(y * z))))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 1.45e+79) tmp = ((x * 0.5) - y) * sqrt((z * 2.0)); else tmp = sqrt((2.0 * ((t * t) * (y * (y * z))))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 1.45e+79], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(2.0 * N[(N[(t * t), $MachinePrecision] * N[(y * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.45 \cdot 10^{+79}:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2 \cdot \left(\left(t \cdot t\right) \cdot \left(y \cdot \left(y \cdot z\right)\right)\right)}\\
\end{array}
\end{array}
if t < 1.44999999999999996e79Initial 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%
expm1-log1p-u98.1%
expm1-udef68.7%
sqrt-unprod68.7%
associate-*l*68.7%
exp-prod68.7%
Applied egg-rr68.7%
expm1-def98.2%
expm1-log1p99.8%
*-commutative99.8%
associate-*l*99.8%
*-commutative99.8%
exp-prod99.8%
Simplified99.8%
Taylor expanded in t around 0 66.3%
if 1.44999999999999996e79 < t Initial program 100.0%
associate-*r*100.0%
exp-sqrt100.0%
add-sqr-sqrt46.5%
sqrt-unprod46.5%
exp-sqrt46.5%
associate-*r*46.5%
exp-sqrt46.5%
Applied egg-rr41.9%
*-commutative41.9%
associate-*l*41.9%
associate-*l*41.9%
*-commutative41.9%
exp-prod41.9%
Simplified41.9%
Taylor expanded in x around 0 30.2%
unpow230.2%
Simplified30.2%
Taylor expanded in t around 0 23.6%
distribute-lft-out23.6%
*-commutative23.6%
distribute-lft1-in23.6%
unpow223.6%
unpow223.6%
Simplified23.6%
Taylor expanded in t around inf 28.1%
associate-*r*23.6%
*-commutative23.6%
associate-*l*21.3%
unpow221.3%
unpow221.3%
associate-*l*25.9%
Simplified25.9%
Final simplification59.5%
(FPCore (x y z t) :precision binary64 (if (<= t 1.36e+79) (* (- (* x 0.5) y) (sqrt (* z 2.0))) (sqrt (* (* 2.0 (* y y)) (* z (* t t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.36e+79) {
tmp = ((x * 0.5) - y) * sqrt((z * 2.0));
} else {
tmp = sqrt(((2.0 * (y * y)) * (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) :: tmp
if (t <= 1.36d+79) then
tmp = ((x * 0.5d0) - y) * sqrt((z * 2.0d0))
else
tmp = sqrt(((2.0d0 * (y * y)) * (z * (t * t))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.36e+79) {
tmp = ((x * 0.5) - y) * Math.sqrt((z * 2.0));
} else {
tmp = Math.sqrt(((2.0 * (y * y)) * (z * (t * t))));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 1.36e+79: tmp = ((x * 0.5) - y) * math.sqrt((z * 2.0)) else: tmp = math.sqrt(((2.0 * (y * y)) * (z * (t * t)))) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 1.36e+79) tmp = Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))); else tmp = sqrt(Float64(Float64(2.0 * Float64(y * y)) * Float64(z * Float64(t * t)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 1.36e+79) tmp = ((x * 0.5) - y) * sqrt((z * 2.0)); else tmp = sqrt(((2.0 * (y * y)) * (z * (t * t)))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 1.36e+79], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[(2.0 * N[(y * y), $MachinePrecision]), $MachinePrecision] * N[(z * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.36 \cdot 10^{+79}:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\left(2 \cdot \left(y \cdot y\right)\right) \cdot \left(z \cdot \left(t \cdot t\right)\right)}\\
\end{array}
\end{array}
if t < 1.36000000000000003e79Initial 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%
expm1-log1p-u98.1%
expm1-udef68.7%
sqrt-unprod68.7%
associate-*l*68.7%
exp-prod68.7%
Applied egg-rr68.7%
expm1-def98.2%
expm1-log1p99.8%
*-commutative99.8%
associate-*l*99.8%
*-commutative99.8%
exp-prod99.8%
Simplified99.8%
Taylor expanded in t around 0 66.3%
if 1.36000000000000003e79 < t Initial program 100.0%
associate-*r*100.0%
exp-sqrt100.0%
add-sqr-sqrt46.5%
sqrt-unprod46.5%
exp-sqrt46.5%
associate-*r*46.5%
exp-sqrt46.5%
Applied egg-rr41.9%
*-commutative41.9%
associate-*l*41.9%
associate-*l*41.9%
*-commutative41.9%
exp-prod41.9%
Simplified41.9%
Taylor expanded in x around 0 30.2%
unpow230.2%
Simplified30.2%
Taylor expanded in t around 0 23.6%
distribute-lft-out23.6%
*-commutative23.6%
distribute-lft1-in23.6%
unpow223.6%
unpow223.6%
Simplified23.6%
Taylor expanded in t around inf 28.1%
associate-*r*28.1%
unpow228.1%
*-commutative28.1%
unpow228.1%
Simplified28.1%
Final simplification59.9%
(FPCore (x y z t) :precision binary64 (if (<= y -2.65e+154) (sqrt (* 2.0 (* z (* y y)))) (* (- (* x 0.5) y) (sqrt (* z 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.65e+154) {
tmp = sqrt((2.0 * (z * (y * y))));
} else {
tmp = ((x * 0.5) - y) * sqrt((z * 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 (y <= (-2.65d+154)) then
tmp = sqrt((2.0d0 * (z * (y * y))))
else
tmp = ((x * 0.5d0) - y) * sqrt((z * 2.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.65e+154) {
tmp = Math.sqrt((2.0 * (z * (y * y))));
} else {
tmp = ((x * 0.5) - y) * Math.sqrt((z * 2.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -2.65e+154: tmp = math.sqrt((2.0 * (z * (y * y)))) else: tmp = ((x * 0.5) - y) * math.sqrt((z * 2.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -2.65e+154) tmp = sqrt(Float64(2.0 * Float64(z * Float64(y * y)))); else tmp = Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -2.65e+154) tmp = sqrt((2.0 * (z * (y * y)))); else tmp = ((x * 0.5) - y) * sqrt((z * 2.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -2.65e+154], N[Sqrt[N[(2.0 * N[(z * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.65 \cdot 10^{+154}:\\
\;\;\;\;\sqrt{2 \cdot \left(z \cdot \left(y \cdot y\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\\
\end{array}
\end{array}
if y < -2.65000000000000012e154Initial program 99.9%
associate-*r*99.9%
exp-sqrt99.9%
add-sqr-sqrt94.8%
sqrt-unprod80.9%
exp-sqrt80.9%
associate-*r*80.9%
exp-sqrt80.9%
Applied egg-rr80.9%
*-commutative80.9%
associate-*l*80.9%
associate-*l*80.9%
*-commutative80.9%
exp-prod80.9%
Simplified80.9%
Taylor expanded in x around 0 80.9%
unpow280.9%
Simplified80.9%
Taylor expanded in t around 0 80.9%
*-commutative80.9%
unpow280.9%
Simplified80.9%
if -2.65000000000000012e154 < 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%
expm1-log1p-u98.3%
expm1-udef73.0%
sqrt-unprod73.0%
associate-*l*73.0%
exp-prod73.0%
Applied egg-rr73.0%
expm1-def98.3%
expm1-log1p99.8%
*-commutative99.8%
associate-*l*99.8%
*-commutative99.8%
exp-prod99.8%
Simplified99.8%
Taylor expanded in t around 0 58.9%
Final simplification60.6%
(FPCore (x y z t) :precision binary64 (sqrt (* 2.0 (* z (* y y)))))
double code(double x, double y, double z, double t) {
return sqrt((2.0 * (z * (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((2.0d0 * (z * (y * y))))
end function
public static double code(double x, double y, double z, double t) {
return Math.sqrt((2.0 * (z * (y * y))));
}
def code(x, y, z, t): return math.sqrt((2.0 * (z * (y * y))))
function code(x, y, z, t) return sqrt(Float64(2.0 * Float64(z * Float64(y * y)))) end
function tmp = code(x, y, z, t) tmp = sqrt((2.0 * (z * (y * y)))); end
code[x_, y_, z_, t_] := N[Sqrt[N[(2.0 * N[(z * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{2 \cdot \left(z \cdot \left(y \cdot y\right)\right)}
\end{array}
Initial program 99.8%
associate-*r*99.8%
exp-sqrt99.8%
add-sqr-sqrt49.4%
sqrt-unprod42.1%
exp-sqrt42.1%
associate-*r*42.1%
exp-sqrt42.2%
Applied egg-rr38.3%
*-commutative38.3%
associate-*l*38.3%
associate-*l*38.7%
*-commutative38.7%
exp-prod38.7%
Simplified38.7%
Taylor expanded in x around 0 25.0%
unpow225.0%
Simplified25.0%
Taylor expanded in t around 0 14.3%
*-commutative14.3%
unpow214.3%
Simplified14.3%
Final simplification14.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 2023274
(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))))