
(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 (* (- (* x 0.5) y) (sqrt (* (exp (* t t)) (* 2.0 z)))))
double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * sqrt((exp((t * t)) * (2.0 * z)));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x * 0.5d0) - y) * sqrt((exp((t * t)) * (2.0d0 * z)))
end function
public static double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * Math.sqrt((Math.exp((t * t)) * (2.0 * z)));
}
def code(x, y, z, t): return ((x * 0.5) - y) * math.sqrt((math.exp((t * t)) * (2.0 * z)))
function code(x, y, z, t) return Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(exp(Float64(t * t)) * Float64(2.0 * z)))) end
function tmp = code(x, y, z, t) tmp = ((x * 0.5) - y) * sqrt((exp((t * t)) * (2.0 * z))); end
code[x_, y_, z_, t_] := N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(N[Exp[N[(t * t), $MachinePrecision]], $MachinePrecision] * N[(2.0 * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 0.5 - y\right) \cdot \sqrt{e^{t \cdot t} \cdot \left(2 \cdot z\right)}
\end{array}
Initial program 99.0%
sqr-neg99.0%
associate-/l*99.0%
distribute-frac-neg99.0%
exp-neg99.0%
associate-*r/99.0%
*-rgt-identity99.0%
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-udef79.4%
sqrt-unprod79.4%
associate-*l*79.4%
exp-prod79.4%
Applied egg-rr79.4%
expm1-def98.3%
expm1-log1p99.8%
associate-*r*99.8%
*-commutative99.8%
*-commutative99.8%
exp-prod99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x 0.5) y)))
(if (<= (* t t) 1.0)
(* t_1 (sqrt (* 2.0 z)))
(* t_1 (sqrt (* 2.0 (* (* t t) z)))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double tmp;
if ((t * t) <= 1.0) {
tmp = t_1 * sqrt((2.0 * z));
} else {
tmp = t_1 * sqrt((2.0 * ((t * t) * z)));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (x * 0.5d0) - y
if ((t * t) <= 1.0d0) then
tmp = t_1 * sqrt((2.0d0 * z))
else
tmp = t_1 * sqrt((2.0d0 * ((t * t) * z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double tmp;
if ((t * t) <= 1.0) {
tmp = t_1 * Math.sqrt((2.0 * z));
} else {
tmp = t_1 * Math.sqrt((2.0 * ((t * t) * z)));
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * 0.5) - y tmp = 0 if (t * t) <= 1.0: tmp = t_1 * math.sqrt((2.0 * z)) else: tmp = t_1 * math.sqrt((2.0 * ((t * t) * z))) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * 0.5) - y) tmp = 0.0 if (Float64(t * t) <= 1.0) tmp = Float64(t_1 * sqrt(Float64(2.0 * z))); else tmp = Float64(t_1 * sqrt(Float64(2.0 * Float64(Float64(t * t) * z)))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * 0.5) - y; tmp = 0.0; if ((t * t) <= 1.0) tmp = t_1 * sqrt((2.0 * z)); else tmp = t_1 * sqrt((2.0 * ((t * t) * z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[N[(t * t), $MachinePrecision], 1.0], N[(t$95$1 * N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Sqrt[N[(2.0 * N[(N[(t * t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
\mathbf{if}\;t \cdot t \leq 1:\\
\;\;\;\;t_1 \cdot \sqrt{2 \cdot z}\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \sqrt{2 \cdot \left(\left(t \cdot t\right) \cdot z\right)}\\
\end{array}
\end{array}
if (*.f64 t t) < 1Initial program 99.6%
sqr-neg99.6%
associate-/l*99.6%
distribute-frac-neg99.6%
exp-neg99.6%
associate-*r/99.6%
*-rgt-identity99.6%
associate-*r/99.6%
*-rgt-identity99.6%
associate-*r/99.6%
exp-neg99.6%
distribute-frac-neg99.6%
associate-/l*99.6%
sqr-neg99.6%
exp-sqrt99.6%
Simplified99.6%
expm1-log1p-u96.5%
expm1-udef60.7%
sqrt-unprod60.7%
associate-*l*60.7%
exp-prod60.7%
Applied egg-rr60.7%
expm1-def96.6%
expm1-log1p99.6%
associate-*r*99.6%
*-commutative99.6%
*-commutative99.6%
exp-prod99.6%
Simplified99.6%
Taylor expanded in t around 0 98.6%
if 1 < (*.f64 t t) Initial program 98.4%
sqr-neg98.4%
associate-/l*98.4%
distribute-frac-neg98.4%
exp-neg98.4%
associate-*r/98.4%
*-rgt-identity98.4%
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%
expm1-log1p-u100.0%
expm1-udef98.5%
sqrt-unprod98.5%
associate-*l*98.5%
exp-prod98.5%
Applied egg-rr98.5%
expm1-def100.0%
expm1-log1p100.0%
associate-*r*100.0%
*-commutative100.0%
*-commutative100.0%
exp-prod100.0%
Simplified100.0%
Taylor expanded in t around 0 70.9%
distribute-lft-out70.9%
*-commutative70.9%
unpow270.9%
Simplified70.9%
Taylor expanded in t around inf 70.9%
*-commutative70.9%
unpow270.9%
Simplified70.9%
Final simplification84.8%
(FPCore (x y z t) :precision binary64 (* (+ 1.0 (* 0.5 (* t t))) (* (- (* x 0.5) y) (sqrt (* 2.0 z)))))
double code(double x, double y, double z, double t) {
return (1.0 + (0.5 * (t * t))) * (((x * 0.5) - 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 = (1.0d0 + (0.5d0 * (t * t))) * (((x * 0.5d0) - y) * sqrt((2.0d0 * z)))
end function
public static double code(double x, double y, double z, double t) {
return (1.0 + (0.5 * (t * t))) * (((x * 0.5) - y) * Math.sqrt((2.0 * z)));
}
def code(x, y, z, t): return (1.0 + (0.5 * (t * t))) * (((x * 0.5) - y) * math.sqrt((2.0 * z)))
function code(x, y, z, t) return Float64(Float64(1.0 + Float64(0.5 * Float64(t * t))) * Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(2.0 * z)))) end
function tmp = code(x, y, z, t) tmp = (1.0 + (0.5 * (t * t))) * (((x * 0.5) - y) * sqrt((2.0 * z))); end
code[x_, y_, z_, t_] := N[(N[(1.0 + N[(0.5 * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(1 + 0.5 \cdot \left(t \cdot t\right)\right) \cdot \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{2 \cdot z}\right)
\end{array}
Initial program 99.0%
Taylor expanded in t around 0 85.1%
unpow285.1%
Simplified85.1%
Final simplification85.1%
(FPCore (x y z t) :precision binary64 (* (- (* x 0.5) y) (sqrt (* 2.0 (+ z (* (* t t) z))))))
double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * sqrt((2.0 * (z + ((t * t) * z))));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x * 0.5d0) - y) * sqrt((2.0d0 * (z + ((t * t) * z))))
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) * z))));
}
def code(x, y, z, t): return ((x * 0.5) - y) * math.sqrt((2.0 * (z + ((t * t) * z))))
function code(x, y, z, t) return Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(2.0 * Float64(z + Float64(Float64(t * t) * z))))) end
function tmp = code(x, y, z, t) tmp = ((x * 0.5) - y) * sqrt((2.0 * (z + ((t * t) * z)))); 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] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 0.5 - y\right) \cdot \sqrt{2 \cdot \left(z + \left(t \cdot t\right) \cdot z\right)}
\end{array}
Initial program 99.0%
sqr-neg99.0%
associate-/l*99.0%
distribute-frac-neg99.0%
exp-neg99.0%
associate-*r/99.0%
*-rgt-identity99.0%
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-udef79.4%
sqrt-unprod79.4%
associate-*l*79.4%
exp-prod79.4%
Applied egg-rr79.4%
expm1-def98.3%
expm1-log1p99.8%
associate-*r*99.8%
*-commutative99.8%
*-commutative99.8%
exp-prod99.8%
Simplified99.8%
Taylor expanded in t around 0 85.1%
distribute-lft-out85.1%
*-commutative85.1%
unpow285.1%
Simplified85.1%
Final simplification85.1%
(FPCore (x y z t)
:precision binary64
(if (<= t 9e+21)
(* (- (* x 0.5) y) (sqrt (* 2.0 z)))
(if (<= t 2.5e+105)
(sqrt (* (* 2.0 z) (* (* x x) 0.25)))
(sqrt (* (* 2.0 z) (* y y))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 9e+21) {
tmp = ((x * 0.5) - y) * sqrt((2.0 * z));
} else if (t <= 2.5e+105) {
tmp = sqrt(((2.0 * z) * ((x * x) * 0.25)));
} else {
tmp = sqrt(((2.0 * z) * (y * y)));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= 9d+21) then
tmp = ((x * 0.5d0) - y) * sqrt((2.0d0 * z))
else if (t <= 2.5d+105) then
tmp = sqrt(((2.0d0 * z) * ((x * x) * 0.25d0)))
else
tmp = sqrt(((2.0d0 * z) * (y * y)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 9e+21) {
tmp = ((x * 0.5) - y) * Math.sqrt((2.0 * z));
} else if (t <= 2.5e+105) {
tmp = Math.sqrt(((2.0 * z) * ((x * x) * 0.25)));
} else {
tmp = Math.sqrt(((2.0 * z) * (y * y)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 9e+21: tmp = ((x * 0.5) - y) * math.sqrt((2.0 * z)) elif t <= 2.5e+105: tmp = math.sqrt(((2.0 * z) * ((x * x) * 0.25))) else: tmp = math.sqrt(((2.0 * z) * (y * y))) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 9e+21) tmp = Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(2.0 * z))); elseif (t <= 2.5e+105) tmp = sqrt(Float64(Float64(2.0 * z) * Float64(Float64(x * x) * 0.25))); else tmp = sqrt(Float64(Float64(2.0 * z) * Float64(y * y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 9e+21) tmp = ((x * 0.5) - y) * sqrt((2.0 * z)); elseif (t <= 2.5e+105) tmp = sqrt(((2.0 * z) * ((x * x) * 0.25))); else tmp = sqrt(((2.0 * z) * (y * y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 9e+21], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.5e+105], N[Sqrt[N[(N[(2.0 * z), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Sqrt[N[(N[(2.0 * z), $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 9 \cdot 10^{+21}:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot \sqrt{2 \cdot z}\\
\mathbf{elif}\;t \leq 2.5 \cdot 10^{+105}:\\
\;\;\;\;\sqrt{\left(2 \cdot z\right) \cdot \left(\left(x \cdot x\right) \cdot 0.25\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\left(2 \cdot z\right) \cdot \left(y \cdot y\right)}\\
\end{array}
\end{array}
if t < 9e21Initial program 98.7%
sqr-neg98.7%
associate-/l*98.7%
distribute-frac-neg98.7%
exp-neg98.7%
associate-*r/98.8%
*-rgt-identity98.8%
associate-*r/99.7%
*-rgt-identity99.7%
associate-*r/99.7%
exp-neg99.7%
distribute-frac-neg99.7%
associate-/l*99.7%
sqr-neg99.7%
exp-sqrt99.7%
Simplified99.7%
expm1-log1p-u97.8%
expm1-udef73.9%
sqrt-unprod73.9%
associate-*l*73.9%
exp-prod73.9%
Applied egg-rr73.9%
expm1-def97.8%
expm1-log1p99.7%
associate-*r*99.7%
*-commutative99.7%
*-commutative99.7%
exp-prod99.7%
Simplified99.7%
Taylor expanded in t around 0 68.4%
if 9e21 < t < 2.50000000000000023e105Initial program 100.0%
Taylor expanded in t around 0 5.8%
add-sqr-sqrt2.8%
sqrt-unprod38.7%
*-commutative38.7%
*-commutative38.7%
swap-sqr38.7%
add-sqr-sqrt38.7%
pow238.7%
Applied egg-rr38.7%
Taylor expanded in x around inf 39.0%
*-commutative39.0%
unpow239.0%
Simplified39.0%
if 2.50000000000000023e105 < t Initial program 100.0%
Taylor expanded in t around 0 11.6%
add-sqr-sqrt4.9%
sqrt-unprod30.3%
*-commutative30.3%
*-commutative30.3%
swap-sqr32.6%
add-sqr-sqrt32.6%
pow232.6%
Applied egg-rr32.6%
Taylor expanded in x around 0 25.6%
unpow225.6%
Simplified25.6%
Final simplification60.0%
(FPCore (x y z t) :precision binary64 (if (<= t 3.4e+46) (* (- (* x 0.5) y) (sqrt (* 2.0 z))) (sqrt (* (* 2.0 z) (* y y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 3.4e+46) {
tmp = ((x * 0.5) - y) * sqrt((2.0 * z));
} else {
tmp = sqrt(((2.0 * z) * (y * y)));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= 3.4d+46) then
tmp = ((x * 0.5d0) - y) * sqrt((2.0d0 * z))
else
tmp = sqrt(((2.0d0 * z) * (y * y)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 3.4e+46) {
tmp = ((x * 0.5) - y) * Math.sqrt((2.0 * z));
} else {
tmp = Math.sqrt(((2.0 * z) * (y * y)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 3.4e+46: tmp = ((x * 0.5) - y) * math.sqrt((2.0 * z)) else: tmp = math.sqrt(((2.0 * z) * (y * y))) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 3.4e+46) tmp = Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(2.0 * z))); else tmp = sqrt(Float64(Float64(2.0 * z) * Float64(y * y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 3.4e+46) tmp = ((x * 0.5) - y) * sqrt((2.0 * z)); else tmp = sqrt(((2.0 * z) * (y * y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 3.4e+46], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[(2.0 * z), $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 3.4 \cdot 10^{+46}:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot \sqrt{2 \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\left(2 \cdot z\right) \cdot \left(y \cdot y\right)}\\
\end{array}
\end{array}
if t < 3.3999999999999998e46Initial program 98.8%
sqr-neg98.8%
associate-/l*98.8%
distribute-frac-neg98.8%
exp-neg98.8%
associate-*r/98.8%
*-rgt-identity98.8%
associate-*r/99.7%
*-rgt-identity99.7%
associate-*r/99.7%
exp-neg99.7%
distribute-frac-neg99.7%
associate-/l*99.7%
sqr-neg99.7%
exp-sqrt99.7%
Simplified99.7%
expm1-log1p-u97.8%
expm1-udef74.4%
sqrt-unprod74.4%
associate-*l*74.4%
exp-prod74.4%
Applied egg-rr74.4%
expm1-def97.8%
expm1-log1p99.7%
associate-*r*99.7%
*-commutative99.7%
*-commutative99.7%
exp-prod99.7%
Simplified99.7%
Taylor expanded in t around 0 67.2%
if 3.3999999999999998e46 < t Initial program 100.0%
Taylor expanded in t around 0 10.6%
add-sqr-sqrt4.6%
sqrt-unprod32.9%
*-commutative32.9%
*-commutative32.9%
swap-sqr34.8%
add-sqr-sqrt34.8%
pow234.8%
Applied egg-rr34.8%
Taylor expanded in x around 0 23.2%
unpow223.2%
Simplified23.2%
Final simplification58.6%
(FPCore (x y z t) :precision binary64 (if (<= y -4.9e+60) (sqrt (* (* 2.0 z) (* y y))) (* (sqrt (* 2.0 z)) (* x 0.5))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -4.9e+60) {
tmp = sqrt(((2.0 * z) * (y * y)));
} else {
tmp = sqrt((2.0 * z)) * (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 (y <= (-4.9d+60)) then
tmp = sqrt(((2.0d0 * z) * (y * y)))
else
tmp = sqrt((2.0d0 * z)) * (x * 0.5d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -4.9e+60) {
tmp = Math.sqrt(((2.0 * z) * (y * y)));
} else {
tmp = Math.sqrt((2.0 * z)) * (x * 0.5);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -4.9e+60: tmp = math.sqrt(((2.0 * z) * (y * y))) else: tmp = math.sqrt((2.0 * z)) * (x * 0.5) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -4.9e+60) tmp = sqrt(Float64(Float64(2.0 * z) * Float64(y * y))); else tmp = Float64(sqrt(Float64(2.0 * z)) * Float64(x * 0.5)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -4.9e+60) tmp = sqrt(((2.0 * z) * (y * y))); else tmp = sqrt((2.0 * z)) * (x * 0.5); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -4.9e+60], N[Sqrt[N[(N[(2.0 * z), $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision] * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.9 \cdot 10^{+60}:\\
\;\;\;\;\sqrt{\left(2 \cdot z\right) \cdot \left(y \cdot y\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2 \cdot z} \cdot \left(x \cdot 0.5\right)\\
\end{array}
\end{array}
if y < -4.9000000000000003e60Initial program 99.8%
Taylor expanded in t around 0 54.0%
add-sqr-sqrt49.5%
sqrt-unprod63.0%
*-commutative63.0%
*-commutative63.0%
swap-sqr61.6%
add-sqr-sqrt61.6%
pow261.6%
Applied egg-rr61.6%
Taylor expanded in x around 0 59.7%
unpow259.7%
Simplified59.7%
if -4.9000000000000003e60 < y Initial program 98.8%
sqr-neg98.8%
associate-/l*98.8%
distribute-frac-neg98.8%
exp-neg98.8%
associate-*r/98.8%
*-rgt-identity98.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-udef79.4%
sqrt-unprod79.4%
associate-*l*79.4%
exp-prod79.4%
Applied egg-rr79.4%
expm1-def98.1%
expm1-log1p99.8%
associate-*r*99.8%
*-commutative99.8%
*-commutative99.8%
exp-prod99.8%
Simplified99.8%
Taylor expanded in t around 0 56.6%
Taylor expanded in x around inf 37.3%
associate-*l*37.4%
associate-*r*37.4%
Simplified37.4%
sqrt-prod37.5%
pow1/237.5%
Applied egg-rr37.5%
unpow1/237.5%
Simplified37.5%
Final simplification41.8%
(FPCore (x y z t) :precision binary64 (* (sqrt (* 2.0 z)) (* x 0.5)))
double code(double x, double y, double z, double t) {
return sqrt((2.0 * z)) * (x * 0.5);
}
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)) * (x * 0.5d0)
end function
public static double code(double x, double y, double z, double t) {
return Math.sqrt((2.0 * z)) * (x * 0.5);
}
def code(x, y, z, t): return math.sqrt((2.0 * z)) * (x * 0.5)
function code(x, y, z, t) return Float64(sqrt(Float64(2.0 * z)) * Float64(x * 0.5)) end
function tmp = code(x, y, z, t) tmp = sqrt((2.0 * z)) * (x * 0.5); end
code[x_, y_, z_, t_] := N[(N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision] * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{2 \cdot z} \cdot \left(x \cdot 0.5\right)
\end{array}
Initial program 99.0%
sqr-neg99.0%
associate-/l*99.0%
distribute-frac-neg99.0%
exp-neg99.0%
associate-*r/99.0%
*-rgt-identity99.0%
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-udef79.4%
sqrt-unprod79.4%
associate-*l*79.4%
exp-prod79.4%
Applied egg-rr79.4%
expm1-def98.3%
expm1-log1p99.8%
associate-*r*99.8%
*-commutative99.8%
*-commutative99.8%
exp-prod99.8%
Simplified99.8%
Taylor expanded in t around 0 56.1%
Taylor expanded in x around inf 32.5%
associate-*l*32.5%
associate-*r*32.5%
Simplified32.5%
sqrt-prod32.6%
pow1/232.6%
Applied egg-rr32.6%
unpow1/232.6%
Simplified32.6%
Final simplification32.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 2023293
(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))))