
(FPCore (x y z t) :precision binary64 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (exp (/ (* t t) 2.0))))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * exp(((t * t) / 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * Math.exp(((t * t) / 2.0));
}
def code(x, y, z, t): return (((x * 0.5) - y) * math.sqrt((z * 2.0))) * math.exp(((t * t) / 2.0))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * exp(Float64(Float64(t * t) / 2.0))) end
function tmp = code(x, y, z, t) tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (exp (/ (* t t) 2.0))))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * exp(((t * t) / 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * Math.exp(((t * t) / 2.0));
}
def code(x, y, z, t): return (((x * 0.5) - y) * math.sqrt((z * 2.0))) * math.exp(((t * t) / 2.0))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * exp(Float64(Float64(t * t) / 2.0))) end
function tmp = code(x, y, z, t) tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}}
\end{array}
NOTE: t should be positive before calling this function (FPCore (x y z t) :precision binary64 (* (- (* x 0.5) y) (sqrt (* (pow (exp t) t) (* 2.0 z)))))
t = abs(t);
double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * sqrt((pow(exp(t), t) * (2.0 * z)));
}
NOTE: t should be positive before calling this function
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
t = Math.abs(t);
public static double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * Math.sqrt((Math.pow(Math.exp(t), t) * (2.0 * z)));
}
t = abs(t) def code(x, y, z, t): return ((x * 0.5) - y) * math.sqrt((math.pow(math.exp(t), t) * (2.0 * z)))
t = abs(t) function code(x, y, z, t) return Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64((exp(t) ^ t) * Float64(2.0 * z)))) end
t = abs(t) function tmp = code(x, y, z, t) tmp = ((x * 0.5) - y) * sqrt(((exp(t) ^ t) * (2.0 * z))); end
NOTE: t should be positive before calling this function code[x_, y_, z_, t_] := N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(N[Power[N[Exp[t], $MachinePrecision], t], $MachinePrecision] * N[(2.0 * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
t = |t|\\
\\
\left(x \cdot 0.5 - y\right) \cdot \sqrt{{\left(e^{t}\right)}^{t} \cdot \left(2 \cdot z\right)}
\end{array}
Initial program 99.4%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
expm1-log1p-u98.3%
expm1-udef78.3%
sqrt-unprod78.3%
associate-*l*78.3%
exp-prod78.3%
Applied egg-rr78.3%
expm1-def98.3%
expm1-log1p99.8%
*-commutative99.8%
*-commutative99.8%
associate-*r*99.8%
Simplified99.8%
Final simplification99.8%
NOTE: t should be positive before calling this function (FPCore (x y z t) :precision binary64 (* (- (* x 0.5) y) (sqrt (* (* 2.0 z) (exp (* t t))))))
t = abs(t);
double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * sqrt(((2.0 * z) * exp((t * t))));
}
NOTE: t should be positive before calling this function
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
t = Math.abs(t);
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))));
}
t = abs(t) def code(x, y, z, t): return ((x * 0.5) - y) * math.sqrt(((2.0 * z) * math.exp((t * t))))
t = abs(t) function code(x, y, z, t) return Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(Float64(2.0 * z) * exp(Float64(t * t))))) end
t = abs(t) function tmp = code(x, y, z, t) tmp = ((x * 0.5) - y) * sqrt(((2.0 * z) * exp((t * t)))); end
NOTE: t should be positive before calling this function code[x_, y_, z_, t_] := N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(N[(2.0 * z), $MachinePrecision] * N[Exp[N[(t * t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
t = |t|\\
\\
\left(x \cdot 0.5 - y\right) \cdot \sqrt{\left(2 \cdot z\right) \cdot e^{t \cdot t}}
\end{array}
Initial program 99.4%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
expm1-log1p-u98.3%
expm1-udef78.3%
sqrt-unprod78.3%
associate-*l*78.3%
exp-prod78.3%
Applied egg-rr78.3%
expm1-def98.3%
expm1-log1p99.8%
*-commutative99.8%
*-commutative99.8%
associate-*r*99.8%
Simplified99.8%
pow-exp99.8%
Applied egg-rr99.8%
Final simplification99.8%
NOTE: t should be positive before calling this function
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x 0.5) y)))
(if (<= (* 2.0 z) 5e+80)
(* (* t_1 (sqrt (* 2.0 z))) (+ 1.0 (* 0.5 (* t t))))
(* t_1 (sqrt (* (* 2.0 z) (+ (* t t) 1.0)))))))t = abs(t);
double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double tmp;
if ((2.0 * z) <= 5e+80) {
tmp = (t_1 * sqrt((2.0 * z))) * (1.0 + (0.5 * (t * t)));
} else {
tmp = t_1 * sqrt(((2.0 * z) * ((t * t) + 1.0)));
}
return tmp;
}
NOTE: t should be positive before calling this function
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 ((2.0d0 * z) <= 5d+80) then
tmp = (t_1 * sqrt((2.0d0 * z))) * (1.0d0 + (0.5d0 * (t * t)))
else
tmp = t_1 * sqrt(((2.0d0 * z) * ((t * t) + 1.0d0)))
end if
code = tmp
end function
t = Math.abs(t);
public static double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double tmp;
if ((2.0 * z) <= 5e+80) {
tmp = (t_1 * Math.sqrt((2.0 * z))) * (1.0 + (0.5 * (t * t)));
} else {
tmp = t_1 * Math.sqrt(((2.0 * z) * ((t * t) + 1.0)));
}
return tmp;
}
t = abs(t) def code(x, y, z, t): t_1 = (x * 0.5) - y tmp = 0 if (2.0 * z) <= 5e+80: tmp = (t_1 * math.sqrt((2.0 * z))) * (1.0 + (0.5 * (t * t))) else: tmp = t_1 * math.sqrt(((2.0 * z) * ((t * t) + 1.0))) return tmp
t = abs(t) function code(x, y, z, t) t_1 = Float64(Float64(x * 0.5) - y) tmp = 0.0 if (Float64(2.0 * z) <= 5e+80) tmp = Float64(Float64(t_1 * sqrt(Float64(2.0 * z))) * Float64(1.0 + Float64(0.5 * Float64(t * t)))); else tmp = Float64(t_1 * sqrt(Float64(Float64(2.0 * z) * Float64(Float64(t * t) + 1.0)))); end return tmp end
t = abs(t) function tmp_2 = code(x, y, z, t) t_1 = (x * 0.5) - y; tmp = 0.0; if ((2.0 * z) <= 5e+80) tmp = (t_1 * sqrt((2.0 * z))) * (1.0 + (0.5 * (t * t))); else tmp = t_1 * sqrt(((2.0 * z) * ((t * t) + 1.0))); end tmp_2 = tmp; end
NOTE: t should be positive before calling this function
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[N[(2.0 * z), $MachinePrecision], 5e+80], N[(N[(t$95$1 * N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(0.5 * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Sqrt[N[(N[(2.0 * z), $MachinePrecision] * N[(N[(t * t), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t = |t|\\
\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
\mathbf{if}\;2 \cdot z \leq 5 \cdot 10^{+80}:\\
\;\;\;\;\left(t_1 \cdot \sqrt{2 \cdot z}\right) \cdot \left(1 + 0.5 \cdot \left(t \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \sqrt{\left(2 \cdot z\right) \cdot \left(t \cdot t + 1\right)}\\
\end{array}
\end{array}
if (*.f64 z 2) < 4.99999999999999961e80Initial program 99.1%
Taylor expanded in t around 0 81.7%
unpow281.7%
Simplified81.7%
if 4.99999999999999961e80 < (*.f64 z 2) Initial program 99.9%
associate-*l*99.9%
exp-sqrt99.9%
Simplified99.9%
expm1-log1p-u96.8%
expm1-udef96.8%
sqrt-unprod96.8%
associate-*l*96.8%
exp-prod96.8%
Applied egg-rr96.8%
expm1-def96.8%
expm1-log1p99.9%
*-commutative99.9%
*-commutative99.9%
associate-*r*99.9%
Simplified99.9%
Taylor expanded in t around 0 98.1%
+-commutative98.1%
unpow298.1%
Simplified98.1%
Final simplification88.6%
NOTE: t should be positive before calling this function
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x 0.5) y)))
(if (<= (* t t) 0.0095)
(* t_1 (sqrt (* (* 2.0 z) (+ (* t t) 1.0))))
(* t_1 (* (sqrt (* 2.0 z)) (* 0.5 (* t t)))))))t = abs(t);
double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double tmp;
if ((t * t) <= 0.0095) {
tmp = t_1 * sqrt(((2.0 * z) * ((t * t) + 1.0)));
} else {
tmp = t_1 * (sqrt((2.0 * z)) * (0.5 * (t * t)));
}
return tmp;
}
NOTE: t should be positive before calling this function
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) <= 0.0095d0) then
tmp = t_1 * sqrt(((2.0d0 * z) * ((t * t) + 1.0d0)))
else
tmp = t_1 * (sqrt((2.0d0 * z)) * (0.5d0 * (t * t)))
end if
code = tmp
end function
t = Math.abs(t);
public static double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double tmp;
if ((t * t) <= 0.0095) {
tmp = t_1 * Math.sqrt(((2.0 * z) * ((t * t) + 1.0)));
} else {
tmp = t_1 * (Math.sqrt((2.0 * z)) * (0.5 * (t * t)));
}
return tmp;
}
t = abs(t) def code(x, y, z, t): t_1 = (x * 0.5) - y tmp = 0 if (t * t) <= 0.0095: tmp = t_1 * math.sqrt(((2.0 * z) * ((t * t) + 1.0))) else: tmp = t_1 * (math.sqrt((2.0 * z)) * (0.5 * (t * t))) return tmp
t = abs(t) function code(x, y, z, t) t_1 = Float64(Float64(x * 0.5) - y) tmp = 0.0 if (Float64(t * t) <= 0.0095) tmp = Float64(t_1 * sqrt(Float64(Float64(2.0 * z) * Float64(Float64(t * t) + 1.0)))); else tmp = Float64(t_1 * Float64(sqrt(Float64(2.0 * z)) * Float64(0.5 * Float64(t * t)))); end return tmp end
t = abs(t) function tmp_2 = code(x, y, z, t) t_1 = (x * 0.5) - y; tmp = 0.0; if ((t * t) <= 0.0095) tmp = t_1 * sqrt(((2.0 * z) * ((t * t) + 1.0))); else tmp = t_1 * (sqrt((2.0 * z)) * (0.5 * (t * t))); end tmp_2 = tmp; end
NOTE: t should be positive before calling this function
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[N[(t * t), $MachinePrecision], 0.0095], N[(t$95$1 * N[Sqrt[N[(N[(2.0 * z), $MachinePrecision] * N[(N[(t * t), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision] * N[(0.5 * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t = |t|\\
\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
\mathbf{if}\;t \cdot t \leq 0.0095:\\
\;\;\;\;t_1 \cdot \sqrt{\left(2 \cdot z\right) \cdot \left(t \cdot t + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(\sqrt{2 \cdot z} \cdot \left(0.5 \cdot \left(t \cdot t\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 t t) < 0.00949999999999999976Initial program 99.7%
associate-*l*99.7%
exp-sqrt99.7%
Simplified99.7%
expm1-log1p-u96.7%
expm1-udef56.6%
sqrt-unprod56.6%
associate-*l*56.6%
exp-prod56.6%
Applied egg-rr56.6%
expm1-def96.7%
expm1-log1p99.7%
*-commutative99.7%
*-commutative99.7%
associate-*r*99.7%
Simplified99.7%
Taylor expanded in t around 0 99.4%
+-commutative99.4%
unpow299.4%
Simplified99.4%
if 0.00949999999999999976 < (*.f64 t t) Initial program 99.2%
associate-*l*99.9%
associate-*l/99.9%
exp-prod100.0%
exp-sqrt100.0%
Simplified100.0%
add-exp-log100.0%
pow1/2100.0%
log-pow100.0%
add-log-exp100.0%
Applied egg-rr100.0%
Taylor expanded in t around 0 77.1%
*-commutative77.1%
unpow277.1%
associate-*l*77.1%
Simplified77.1%
Taylor expanded in t around inf 77.1%
unpow277.1%
Simplified77.1%
Final simplification88.2%
NOTE: t should be positive before calling this function (FPCore (x y z t) :precision binary64 (* (- (* x 0.5) y) (* (sqrt (* 2.0 z)) (+ 1.0 (* t (* 0.5 t))))))
t = abs(t);
double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * (sqrt((2.0 * z)) * (1.0 + (t * (0.5 * t))));
}
NOTE: t should be positive before calling this function
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)) * (1.0d0 + (t * (0.5d0 * t))))
end function
t = Math.abs(t);
public static double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * (Math.sqrt((2.0 * z)) * (1.0 + (t * (0.5 * t))));
}
t = abs(t) def code(x, y, z, t): return ((x * 0.5) - y) * (math.sqrt((2.0 * z)) * (1.0 + (t * (0.5 * t))))
t = abs(t) function code(x, y, z, t) return Float64(Float64(Float64(x * 0.5) - y) * Float64(sqrt(Float64(2.0 * z)) * Float64(1.0 + Float64(t * Float64(0.5 * t))))) end
t = abs(t) function tmp = code(x, y, z, t) tmp = ((x * 0.5) - y) * (sqrt((2.0 * z)) * (1.0 + (t * (0.5 * t)))); end
NOTE: t should be positive before calling this function code[x_, y_, z_, t_] := N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[(N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(t * N[(0.5 * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
t = |t|\\
\\
\left(x \cdot 0.5 - y\right) \cdot \left(\sqrt{2 \cdot z} \cdot \left(1 + t \cdot \left(0.5 \cdot t\right)\right)\right)
\end{array}
Initial program 99.4%
associate-*l*99.8%
associate-*l/99.8%
exp-prod99.8%
exp-sqrt99.8%
Simplified99.8%
add-exp-log99.8%
pow1/299.8%
log-pow99.8%
add-log-exp99.8%
Applied egg-rr99.8%
Taylor expanded in t around 0 88.2%
*-commutative88.2%
unpow288.2%
associate-*l*88.2%
Simplified88.2%
Final simplification88.2%
NOTE: t should be positive before calling this function (FPCore (x y z t) :precision binary64 (* (- (* x 0.5) y) (sqrt (* (* 2.0 z) (+ (* t t) 1.0)))))
t = abs(t);
double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * sqrt(((2.0 * z) * ((t * t) + 1.0)));
}
NOTE: t should be positive before calling this function
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
t = Math.abs(t);
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)));
}
t = abs(t) def code(x, y, z, t): return ((x * 0.5) - y) * math.sqrt(((2.0 * z) * ((t * t) + 1.0)))
t = abs(t) function code(x, y, z, t) return Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(Float64(2.0 * z) * Float64(Float64(t * t) + 1.0)))) end
t = abs(t) function tmp = code(x, y, z, t) tmp = ((x * 0.5) - y) * sqrt(((2.0 * z) * ((t * t) + 1.0))); end
NOTE: t should be positive before calling this function code[x_, y_, z_, t_] := N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(N[(2.0 * z), $MachinePrecision] * N[(N[(t * t), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
t = |t|\\
\\
\left(x \cdot 0.5 - y\right) \cdot \sqrt{\left(2 \cdot z\right) \cdot \left(t \cdot t + 1\right)}
\end{array}
Initial program 99.4%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
expm1-log1p-u98.3%
expm1-udef78.3%
sqrt-unprod78.3%
associate-*l*78.3%
exp-prod78.3%
Applied egg-rr78.3%
expm1-def98.3%
expm1-log1p99.8%
*-commutative99.8%
*-commutative99.8%
associate-*r*99.8%
Simplified99.8%
Taylor expanded in t around 0 85.9%
+-commutative85.9%
unpow285.9%
Simplified85.9%
Final simplification85.9%
NOTE: t should be positive before calling this function
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (* 2.0 z))))
(if (<= y -6200000000.0)
(sqrt (* z (* 2.0 (* y y))))
(if (<= y 1.1e+14) (* (* x 0.5) t_1) (* t_1 (- y))))))t = abs(t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((2.0 * z));
double tmp;
if (y <= -6200000000.0) {
tmp = sqrt((z * (2.0 * (y * y))));
} else if (y <= 1.1e+14) {
tmp = (x * 0.5) * t_1;
} else {
tmp = t_1 * -y;
}
return tmp;
}
NOTE: t should be positive before calling this function
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))
if (y <= (-6200000000.0d0)) then
tmp = sqrt((z * (2.0d0 * (y * y))))
else if (y <= 1.1d+14) then
tmp = (x * 0.5d0) * t_1
else
tmp = t_1 * -y
end if
code = tmp
end function
t = Math.abs(t);
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((2.0 * z));
double tmp;
if (y <= -6200000000.0) {
tmp = Math.sqrt((z * (2.0 * (y * y))));
} else if (y <= 1.1e+14) {
tmp = (x * 0.5) * t_1;
} else {
tmp = t_1 * -y;
}
return tmp;
}
t = abs(t) def code(x, y, z, t): t_1 = math.sqrt((2.0 * z)) tmp = 0 if y <= -6200000000.0: tmp = math.sqrt((z * (2.0 * (y * y)))) elif y <= 1.1e+14: tmp = (x * 0.5) * t_1 else: tmp = t_1 * -y return tmp
t = abs(t) function code(x, y, z, t) t_1 = sqrt(Float64(2.0 * z)) tmp = 0.0 if (y <= -6200000000.0) tmp = sqrt(Float64(z * Float64(2.0 * Float64(y * y)))); elseif (y <= 1.1e+14) tmp = Float64(Float64(x * 0.5) * t_1); else tmp = Float64(t_1 * Float64(-y)); end return tmp end
t = abs(t) function tmp_2 = code(x, y, z, t) t_1 = sqrt((2.0 * z)); tmp = 0.0; if (y <= -6200000000.0) tmp = sqrt((z * (2.0 * (y * y)))); elseif (y <= 1.1e+14) tmp = (x * 0.5) * t_1; else tmp = t_1 * -y; end tmp_2 = tmp; end
NOTE: t should be positive before calling this function
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, -6200000000.0], N[Sqrt[N[(z * N[(2.0 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[y, 1.1e+14], N[(N[(x * 0.5), $MachinePrecision] * t$95$1), $MachinePrecision], N[(t$95$1 * (-y)), $MachinePrecision]]]]
\begin{array}{l}
t = |t|\\
\\
\begin{array}{l}
t_1 := \sqrt{2 \cdot z}\\
\mathbf{if}\;y \leq -6200000000:\\
\;\;\;\;\sqrt{z \cdot \left(2 \cdot \left(y \cdot y\right)\right)}\\
\mathbf{elif}\;y \leq 1.1 \cdot 10^{+14}:\\
\;\;\;\;\left(x \cdot 0.5\right) \cdot t_1\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(-y\right)\\
\end{array}
\end{array}
if y < -6.2e9Initial program 99.9%
Taylor expanded in t around 0 68.8%
Taylor expanded in x around 0 54.7%
mul-1-neg54.7%
distribute-rgt-neg-in54.7%
Simplified54.7%
add-sqr-sqrt54.4%
sqrt-unprod55.4%
*-commutative55.4%
*-commutative55.4%
swap-sqr55.4%
add-sqr-sqrt55.4%
swap-sqr55.3%
add-sqr-sqrt55.5%
sqr-neg55.5%
Applied egg-rr55.5%
if -6.2e9 < y < 1.1e14Initial program 99.0%
Taylor expanded in t around 0 53.1%
add-sqr-sqrt27.9%
sqrt-unprod24.2%
*-commutative24.2%
*-commutative24.2%
swap-sqr23.4%
add-sqr-sqrt23.4%
pow223.4%
Applied egg-rr23.4%
Taylor expanded in x around inf 20.7%
unpow220.7%
*-commutative20.7%
associate-*l*20.7%
Simplified20.7%
*-commutative20.7%
sqrt-prod21.5%
sqrt-prod22.1%
sqrt-prod22.1%
metadata-eval22.1%
associate-*l*22.1%
add-sqr-sqrt43.7%
Applied egg-rr43.7%
if 1.1e14 < y Initial program 99.8%
Taylor expanded in t around 0 64.1%
Taylor expanded in x around 0 52.8%
mul-1-neg52.8%
distribute-rgt-neg-in52.8%
Simplified52.8%
distribute-rgt-neg-out52.8%
distribute-lft-neg-out52.8%
add-sqr-sqrt52.7%
sqrt-unprod56.9%
sqr-neg56.9%
sqrt-unprod0.0%
add-sqr-sqrt0.8%
*-commutative0.8%
associate-*r*0.8%
sqrt-prod0.8%
*-commutative0.8%
add-sqr-sqrt0.0%
sqrt-unprod57.0%
sqr-neg57.0%
sqrt-unprod52.6%
add-sqr-sqrt52.8%
Applied egg-rr52.8%
distribute-rgt-neg-in52.8%
Simplified52.8%
Final simplification49.1%
NOTE: t should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= x 3.05e+72) (* (sqrt (* 2.0 z)) (- y)) (sqrt (* 0.5 (* z (* x x))))))
t = abs(t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 3.05e+72) {
tmp = sqrt((2.0 * z)) * -y;
} else {
tmp = sqrt((0.5 * (z * (x * x))));
}
return tmp;
}
NOTE: t should be positive before calling this function
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 <= 3.05d+72) then
tmp = sqrt((2.0d0 * z)) * -y
else
tmp = sqrt((0.5d0 * (z * (x * x))))
end if
code = tmp
end function
t = Math.abs(t);
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 3.05e+72) {
tmp = Math.sqrt((2.0 * z)) * -y;
} else {
tmp = Math.sqrt((0.5 * (z * (x * x))));
}
return tmp;
}
t = abs(t) def code(x, y, z, t): tmp = 0 if x <= 3.05e+72: tmp = math.sqrt((2.0 * z)) * -y else: tmp = math.sqrt((0.5 * (z * (x * x)))) return tmp
t = abs(t) function code(x, y, z, t) tmp = 0.0 if (x <= 3.05e+72) tmp = Float64(sqrt(Float64(2.0 * z)) * Float64(-y)); else tmp = sqrt(Float64(0.5 * Float64(z * Float64(x * x)))); end return tmp end
t = abs(t) function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= 3.05e+72) tmp = sqrt((2.0 * z)) * -y; else tmp = sqrt((0.5 * (z * (x * x)))); end tmp_2 = tmp; end
NOTE: t should be positive before calling this function code[x_, y_, z_, t_] := If[LessEqual[x, 3.05e+72], N[(N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision] * (-y)), $MachinePrecision], N[Sqrt[N[(0.5 * N[(z * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
t = |t|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.05 \cdot 10^{+72}:\\
\;\;\;\;\sqrt{2 \cdot z} \cdot \left(-y\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{0.5 \cdot \left(z \cdot \left(x \cdot x\right)\right)}\\
\end{array}
\end{array}
if x < 3.04999999999999996e72Initial program 99.3%
Taylor expanded in t around 0 60.7%
Taylor expanded in x around 0 38.4%
mul-1-neg38.4%
distribute-rgt-neg-in38.4%
Simplified38.4%
distribute-rgt-neg-out38.4%
distribute-lft-neg-out38.4%
add-sqr-sqrt18.0%
sqrt-unprod19.9%
sqr-neg19.9%
sqrt-unprod1.6%
add-sqr-sqrt2.6%
*-commutative2.6%
associate-*r*2.6%
sqrt-prod2.6%
*-commutative2.6%
add-sqr-sqrt1.6%
sqrt-unprod19.9%
sqr-neg19.9%
sqrt-unprod17.9%
add-sqr-sqrt38.5%
Applied egg-rr38.5%
distribute-rgt-neg-in38.5%
Simplified38.5%
if 3.04999999999999996e72 < x Initial program 99.8%
Taylor expanded in t around 0 56.3%
add-sqr-sqrt49.1%
sqrt-unprod41.3%
*-commutative41.3%
*-commutative41.3%
swap-sqr51.5%
add-sqr-sqrt51.5%
pow251.5%
Applied egg-rr51.5%
Taylor expanded in x around inf 51.5%
unpow251.5%
Simplified51.5%
Final simplification40.9%
NOTE: t should be positive before calling this function (FPCore (x y z t) :precision binary64 (* (- (* x 0.5) y) (sqrt (* 2.0 z))))
t = abs(t);
double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * sqrt((2.0 * z));
}
NOTE: t should be positive before calling this function
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))
end function
t = Math.abs(t);
public static double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * Math.sqrt((2.0 * z));
}
t = abs(t) def code(x, y, z, t): return ((x * 0.5) - y) * math.sqrt((2.0 * z))
t = abs(t) function code(x, y, z, t) return Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(2.0 * z))) end
t = abs(t) function tmp = code(x, y, z, t) tmp = ((x * 0.5) - y) * sqrt((2.0 * z)); end
NOTE: t should be positive before calling this function code[x_, y_, z_, t_] := N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
t = |t|\\
\\
\left(x \cdot 0.5 - y\right) \cdot \sqrt{2 \cdot z}
\end{array}
Initial program 99.4%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
expm1-log1p-u98.3%
expm1-udef78.3%
sqrt-unprod78.3%
associate-*l*78.3%
exp-prod78.3%
Applied egg-rr78.3%
expm1-def98.3%
expm1-log1p99.8%
*-commutative99.8%
*-commutative99.8%
associate-*r*99.8%
Simplified99.8%
Taylor expanded in t around 0 60.0%
Final simplification60.0%
NOTE: t should be positive before calling this function (FPCore (x y z t) :precision binary64 (* (sqrt (* 2.0 z)) (- y)))
t = abs(t);
double code(double x, double y, double z, double t) {
return sqrt((2.0 * z)) * -y;
}
NOTE: t should be positive before calling this function
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
end function
t = Math.abs(t);
public static double code(double x, double y, double z, double t) {
return Math.sqrt((2.0 * z)) * -y;
}
t = abs(t) def code(x, y, z, t): return math.sqrt((2.0 * z)) * -y
t = abs(t) function code(x, y, z, t) return Float64(sqrt(Float64(2.0 * z)) * Float64(-y)) end
t = abs(t) function tmp = code(x, y, z, t) tmp = sqrt((2.0 * z)) * -y; end
NOTE: t should be positive before calling this function code[x_, y_, z_, t_] := N[(N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision] * (-y)), $MachinePrecision]
\begin{array}{l}
t = |t|\\
\\
\sqrt{2 \cdot z} \cdot \left(-y\right)
\end{array}
Initial program 99.4%
Taylor expanded in t around 0 59.9%
Taylor expanded in x around 0 33.4%
mul-1-neg33.4%
distribute-rgt-neg-in33.4%
Simplified33.4%
distribute-rgt-neg-out33.4%
distribute-lft-neg-out33.4%
add-sqr-sqrt16.0%
sqrt-unprod18.1%
sqr-neg18.1%
sqrt-unprod1.4%
add-sqr-sqrt2.5%
*-commutative2.5%
associate-*r*2.5%
sqrt-prod2.5%
*-commutative2.5%
add-sqr-sqrt1.4%
sqrt-unprod18.1%
sqr-neg18.1%
sqrt-unprod16.0%
add-sqr-sqrt33.4%
Applied egg-rr33.4%
distribute-rgt-neg-in33.4%
Simplified33.4%
Final simplification33.4%
NOTE: t should be positive before calling this function (FPCore (x y z t) :precision binary64 (* y (sqrt (* 2.0 z))))
t = abs(t);
double code(double x, double y, double z, double t) {
return y * sqrt((2.0 * z));
}
NOTE: t should be positive before calling this function
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = y * sqrt((2.0d0 * z))
end function
t = Math.abs(t);
public static double code(double x, double y, double z, double t) {
return y * Math.sqrt((2.0 * z));
}
t = abs(t) def code(x, y, z, t): return y * math.sqrt((2.0 * z))
t = abs(t) function code(x, y, z, t) return Float64(y * sqrt(Float64(2.0 * z))) end
t = abs(t) function tmp = code(x, y, z, t) tmp = y * sqrt((2.0 * z)); end
NOTE: t should be positive before calling this function code[x_, y_, z_, t_] := N[(y * N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
t = |t|\\
\\
y \cdot \sqrt{2 \cdot z}
\end{array}
Initial program 99.4%
Taylor expanded in t around 0 59.9%
Taylor expanded in x around 0 33.4%
mul-1-neg33.4%
distribute-rgt-neg-in33.4%
Simplified33.4%
expm1-log1p-u19.5%
expm1-udef14.9%
*-commutative14.9%
associate-*r*14.9%
sqrt-prod14.9%
*-commutative14.9%
add-sqr-sqrt14.0%
sqrt-unprod15.7%
sqr-neg15.7%
sqrt-unprod1.2%
add-sqr-sqrt1.9%
Applied egg-rr1.9%
expm1-def1.9%
expm1-log1p2.5%
*-commutative2.5%
Simplified2.5%
Final simplification2.5%
(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 2023224
(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))))