
(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 10 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
(let* ((t_1 (- (* x 0.5) y)) (t_2 (sqrt (* z 2.0))))
(if (<= t 200000.0)
(* t_1 t_2)
(if (<= t 2.8e+92)
(* x (* t_2 (- 0.5 (/ y x))))
(* t_1 (pow (* (pow z 2.0) 4.0) 0.25))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double t_2 = sqrt((z * 2.0));
double tmp;
if (t <= 200000.0) {
tmp = t_1 * t_2;
} else if (t <= 2.8e+92) {
tmp = x * (t_2 * (0.5 - (y / x)));
} else {
tmp = t_1 * pow((pow(z, 2.0) * 4.0), 0.25);
}
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 = (x * 0.5d0) - y
t_2 = sqrt((z * 2.0d0))
if (t <= 200000.0d0) then
tmp = t_1 * t_2
else if (t <= 2.8d+92) then
tmp = x * (t_2 * (0.5d0 - (y / x)))
else
tmp = t_1 * (((z ** 2.0d0) * 4.0d0) ** 0.25d0)
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 t_2 = Math.sqrt((z * 2.0));
double tmp;
if (t <= 200000.0) {
tmp = t_1 * t_2;
} else if (t <= 2.8e+92) {
tmp = x * (t_2 * (0.5 - (y / x)));
} else {
tmp = t_1 * Math.pow((Math.pow(z, 2.0) * 4.0), 0.25);
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * 0.5) - y t_2 = math.sqrt((z * 2.0)) tmp = 0 if t <= 200000.0: tmp = t_1 * t_2 elif t <= 2.8e+92: tmp = x * (t_2 * (0.5 - (y / x))) else: tmp = t_1 * math.pow((math.pow(z, 2.0) * 4.0), 0.25) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * 0.5) - y) t_2 = sqrt(Float64(z * 2.0)) tmp = 0.0 if (t <= 200000.0) tmp = Float64(t_1 * t_2); elseif (t <= 2.8e+92) tmp = Float64(x * Float64(t_2 * Float64(0.5 - Float64(y / x)))); else tmp = Float64(t_1 * (Float64((z ^ 2.0) * 4.0) ^ 0.25)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * 0.5) - y; t_2 = sqrt((z * 2.0)); tmp = 0.0; if (t <= 200000.0) tmp = t_1 * t_2; elseif (t <= 2.8e+92) tmp = x * (t_2 * (0.5 - (y / x))); else tmp = t_1 * (((z ^ 2.0) * 4.0) ^ 0.25); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 200000.0], N[(t$95$1 * t$95$2), $MachinePrecision], If[LessEqual[t, 2.8e+92], N[(x * N[(t$95$2 * N[(0.5 - N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Power[N[(N[Power[z, 2.0], $MachinePrecision] * 4.0), $MachinePrecision], 0.25], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
t_2 := \sqrt{z \cdot 2}\\
\mathbf{if}\;t \leq 200000:\\
\;\;\;\;t\_1 \cdot t\_2\\
\mathbf{elif}\;t \leq 2.8 \cdot 10^{+92}:\\
\;\;\;\;x \cdot \left(t\_2 \cdot \left(0.5 - \frac{y}{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot {\left({z}^{2} \cdot 4\right)}^{0.25}\\
\end{array}
\end{array}
if t < 2e5Initial program 99.8%
Taylor expanded in t around 0 74.0%
*-rgt-identity74.0%
*-commutative74.0%
sub-neg74.0%
distribute-lft-in73.0%
Applied egg-rr73.0%
distribute-lft-out74.0%
*-commutative74.0%
sub-neg74.0%
Simplified74.0%
if 2e5 < t < 2.80000000000000001e92Initial program 100.0%
Taylor expanded in t around 0 11.9%
add-cube-cbrt11.9%
pow311.9%
Applied egg-rr11.9%
Taylor expanded in x around inf 32.1%
associate-*r*32.1%
rem-cube-cbrt32.1%
rem-cube-cbrt32.1%
distribute-rgt-out32.1%
+-commutative32.1%
mul-1-neg32.1%
unsub-neg32.1%
Simplified32.1%
if 2.80000000000000001e92 < t Initial program 100.0%
Taylor expanded in t around 0 15.3%
add-cube-cbrt15.3%
pow315.3%
Applied egg-rr15.3%
pow1/215.3%
rem-cube-cbrt15.3%
metadata-eval15.3%
pow-sqr15.3%
pow-prod-down39.2%
swap-sqr39.2%
pow239.2%
metadata-eval39.2%
Applied egg-rr39.2%
Final simplification64.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x 0.5) y)) (t_2 (sqrt (* z 2.0))))
(if (<= t 0.5)
(* t_1 t_2)
(if (<= t 3.2e+226)
(* x (* t_2 (- 0.5 (/ y x))))
(sqrt (* (* z 2.0) (* t_1 t_1)))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double t_2 = sqrt((z * 2.0));
double tmp;
if (t <= 0.5) {
tmp = t_1 * t_2;
} else if (t <= 3.2e+226) {
tmp = x * (t_2 * (0.5 - (y / x)));
} else {
tmp = sqrt(((z * 2.0) * (t_1 * t_1)));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (x * 0.5d0) - y
t_2 = sqrt((z * 2.0d0))
if (t <= 0.5d0) then
tmp = t_1 * t_2
else if (t <= 3.2d+226) then
tmp = x * (t_2 * (0.5d0 - (y / x)))
else
tmp = sqrt(((z * 2.0d0) * (t_1 * t_1)))
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 t_2 = Math.sqrt((z * 2.0));
double tmp;
if (t <= 0.5) {
tmp = t_1 * t_2;
} else if (t <= 3.2e+226) {
tmp = x * (t_2 * (0.5 - (y / x)));
} else {
tmp = Math.sqrt(((z * 2.0) * (t_1 * t_1)));
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * 0.5) - y t_2 = math.sqrt((z * 2.0)) tmp = 0 if t <= 0.5: tmp = t_1 * t_2 elif t <= 3.2e+226: tmp = x * (t_2 * (0.5 - (y / x))) else: tmp = math.sqrt(((z * 2.0) * (t_1 * t_1))) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * 0.5) - y) t_2 = sqrt(Float64(z * 2.0)) tmp = 0.0 if (t <= 0.5) tmp = Float64(t_1 * t_2); elseif (t <= 3.2e+226) tmp = Float64(x * Float64(t_2 * Float64(0.5 - Float64(y / x)))); else tmp = sqrt(Float64(Float64(z * 2.0) * Float64(t_1 * t_1))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * 0.5) - y; t_2 = sqrt((z * 2.0)); tmp = 0.0; if (t <= 0.5) tmp = t_1 * t_2; elseif (t <= 3.2e+226) tmp = x * (t_2 * (0.5 - (y / x))); else tmp = sqrt(((z * 2.0) * (t_1 * t_1))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 0.5], N[(t$95$1 * t$95$2), $MachinePrecision], If[LessEqual[t, 3.2e+226], N[(x * N[(t$95$2 * N[(0.5 - N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[(z * 2.0), $MachinePrecision] * N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
t_2 := \sqrt{z \cdot 2}\\
\mathbf{if}\;t \leq 0.5:\\
\;\;\;\;t\_1 \cdot t\_2\\
\mathbf{elif}\;t \leq 3.2 \cdot 10^{+226}:\\
\;\;\;\;x \cdot \left(t\_2 \cdot \left(0.5 - \frac{y}{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\left(z \cdot 2\right) \cdot \left(t\_1 \cdot t\_1\right)}\\
\end{array}
\end{array}
if t < 0.5Initial program 99.8%
Taylor expanded in t around 0 74.8%
*-rgt-identity74.8%
*-commutative74.8%
sub-neg74.8%
distribute-lft-in73.7%
Applied egg-rr73.7%
distribute-lft-out74.8%
*-commutative74.8%
sub-neg74.8%
Simplified74.8%
if 0.5 < t < 3.19999999999999977e226Initial program 100.0%
Taylor expanded in t around 0 16.9%
add-cube-cbrt16.9%
pow316.9%
Applied egg-rr16.9%
Taylor expanded in x around inf 29.5%
associate-*r*29.5%
rem-cube-cbrt29.5%
rem-cube-cbrt29.5%
distribute-rgt-out29.5%
+-commutative29.5%
mul-1-neg29.5%
unsub-neg29.5%
Simplified29.5%
if 3.19999999999999977e226 < t Initial program 100.0%
Taylor expanded in t around 0 8.6%
*-rgt-identity8.6%
*-commutative8.6%
pow18.6%
metadata-eval8.6%
sqrt-pow123.7%
sqrt-prod27.9%
pow1/227.9%
associate-*l*27.9%
Applied egg-rr27.9%
unpow1/227.9%
associate-*r*27.9%
*-commutative27.9%
Simplified27.9%
*-commutative27.9%
pow227.9%
Applied egg-rr27.9%
Final simplification62.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (* z 2.0))))
(if (<= t 2e-22)
(* (- (* x 0.5) y) t_1)
(* y (* t_1 (+ (* x (/ 0.5 y)) -1.0))))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z * 2.0));
double tmp;
if (t <= 2e-22) {
tmp = ((x * 0.5) - y) * t_1;
} else {
tmp = y * (t_1 * ((x * (0.5 / y)) + -1.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) :: t_1
real(8) :: tmp
t_1 = sqrt((z * 2.0d0))
if (t <= 2d-22) then
tmp = ((x * 0.5d0) - y) * t_1
else
tmp = y * (t_1 * ((x * (0.5d0 / y)) + (-1.0d0)))
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 tmp;
if (t <= 2e-22) {
tmp = ((x * 0.5) - y) * t_1;
} else {
tmp = y * (t_1 * ((x * (0.5 / y)) + -1.0));
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((z * 2.0)) tmp = 0 if t <= 2e-22: tmp = ((x * 0.5) - y) * t_1 else: tmp = y * (t_1 * ((x * (0.5 / y)) + -1.0)) return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(z * 2.0)) tmp = 0.0 if (t <= 2e-22) tmp = Float64(Float64(Float64(x * 0.5) - y) * t_1); else tmp = Float64(y * Float64(t_1 * Float64(Float64(x * Float64(0.5 / y)) + -1.0))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt((z * 2.0)); tmp = 0.0; if (t <= 2e-22) tmp = ((x * 0.5) - y) * t_1; else tmp = y * (t_1 * ((x * (0.5 / y)) + -1.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 2e-22], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * t$95$1), $MachinePrecision], N[(y * N[(t$95$1 * N[(N[(x * N[(0.5 / y), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
\mathbf{if}\;t \leq 2 \cdot 10^{-22}:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(t\_1 \cdot \left(x \cdot \frac{0.5}{y} + -1\right)\right)\\
\end{array}
\end{array}
if t < 2.0000000000000001e-22Initial program 99.8%
Taylor expanded in t around 0 74.5%
*-rgt-identity74.5%
*-commutative74.5%
sub-neg74.5%
distribute-lft-in73.4%
Applied egg-rr73.4%
distribute-lft-out74.5%
*-commutative74.5%
sub-neg74.5%
Simplified74.5%
if 2.0000000000000001e-22 < t Initial program 100.0%
Taylor expanded in t around 0 19.2%
add-cube-cbrt19.1%
pow319.2%
Applied egg-rr19.2%
Taylor expanded in y around inf 33.5%
rem-cube-cbrt33.5%
associate-*r*33.5%
rem-cube-cbrt33.6%
distribute-rgt-out33.6%
+-commutative33.6%
fma-define33.6%
Simplified33.6%
fma-undefine33.6%
distribute-lft-in33.6%
clear-num33.6%
un-div-inv33.6%
Applied egg-rr33.6%
distribute-lft-out33.6%
*-commutative33.6%
associate-/r/33.6%
Simplified33.6%
Final simplification63.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (* z 2.0))))
(if (or (<= y -1650.0) (not (<= y 3.7e+168)))
(* y (- t_1))
(* t_1 (* x 0.5)))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z * 2.0));
double tmp;
if ((y <= -1650.0) || !(y <= 3.7e+168)) {
tmp = y * -t_1;
} else {
tmp = t_1 * (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) :: t_1
real(8) :: tmp
t_1 = sqrt((z * 2.0d0))
if ((y <= (-1650.0d0)) .or. (.not. (y <= 3.7d+168))) then
tmp = y * -t_1
else
tmp = t_1 * (x * 0.5d0)
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 tmp;
if ((y <= -1650.0) || !(y <= 3.7e+168)) {
tmp = y * -t_1;
} else {
tmp = t_1 * (x * 0.5);
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((z * 2.0)) tmp = 0 if (y <= -1650.0) or not (y <= 3.7e+168): tmp = y * -t_1 else: tmp = t_1 * (x * 0.5) return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(z * 2.0)) tmp = 0.0 if ((y <= -1650.0) || !(y <= 3.7e+168)) tmp = Float64(y * Float64(-t_1)); else tmp = Float64(t_1 * Float64(x * 0.5)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt((z * 2.0)); tmp = 0.0; if ((y <= -1650.0) || ~((y <= 3.7e+168))) tmp = y * -t_1; else tmp = t_1 * (x * 0.5); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[y, -1650.0], N[Not[LessEqual[y, 3.7e+168]], $MachinePrecision]], N[(y * (-t$95$1)), $MachinePrecision], N[(t$95$1 * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
\mathbf{if}\;y \leq -1650 \lor \neg \left(y \leq 3.7 \cdot 10^{+168}\right):\\
\;\;\;\;y \cdot \left(-t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(x \cdot 0.5\right)\\
\end{array}
\end{array}
if y < -1650 or 3.70000000000000009e168 < y Initial program 99.9%
Taylor expanded in t around 0 63.6%
*-rgt-identity63.6%
*-commutative63.6%
sub-neg63.6%
distribute-lft-in61.2%
Applied egg-rr61.2%
distribute-lft-out63.6%
*-commutative63.6%
sub-neg63.6%
Simplified63.6%
Taylor expanded in x around 0 56.5%
neg-mul-156.5%
Simplified56.5%
if -1650 < y < 3.70000000000000009e168Initial program 99.8%
Taylor expanded in t around 0 56.6%
*-rgt-identity56.6%
*-commutative56.6%
sub-neg56.6%
distribute-lft-in56.6%
Applied egg-rr56.6%
distribute-lft-out56.6%
*-commutative56.6%
sub-neg56.6%
Simplified56.6%
Taylor expanded in x around inf 43.4%
Final simplification47.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (* z 2.0))))
(if (<= y -720000.0)
(sqrt (* (* z 2.0) (* y (- y x))))
(if (<= y 3.4e+168) (* t_1 (* x 0.5)) (* y (- t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z * 2.0));
double tmp;
if (y <= -720000.0) {
tmp = sqrt(((z * 2.0) * (y * (y - x))));
} else if (y <= 3.4e+168) {
tmp = t_1 * (x * 0.5);
} else {
tmp = y * -t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((z * 2.0d0))
if (y <= (-720000.0d0)) then
tmp = sqrt(((z * 2.0d0) * (y * (y - x))))
else if (y <= 3.4d+168) then
tmp = t_1 * (x * 0.5d0)
else
tmp = y * -t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((z * 2.0));
double tmp;
if (y <= -720000.0) {
tmp = Math.sqrt(((z * 2.0) * (y * (y - x))));
} else if (y <= 3.4e+168) {
tmp = t_1 * (x * 0.5);
} else {
tmp = y * -t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((z * 2.0)) tmp = 0 if y <= -720000.0: tmp = math.sqrt(((z * 2.0) * (y * (y - x)))) elif y <= 3.4e+168: tmp = t_1 * (x * 0.5) else: tmp = y * -t_1 return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(z * 2.0)) tmp = 0.0 if (y <= -720000.0) tmp = sqrt(Float64(Float64(z * 2.0) * Float64(y * Float64(y - x)))); elseif (y <= 3.4e+168) tmp = Float64(t_1 * Float64(x * 0.5)); else tmp = Float64(y * Float64(-t_1)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt((z * 2.0)); tmp = 0.0; if (y <= -720000.0) tmp = sqrt(((z * 2.0) * (y * (y - x)))); elseif (y <= 3.4e+168) tmp = t_1 * (x * 0.5); else tmp = y * -t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, -720000.0], N[Sqrt[N[(N[(z * 2.0), $MachinePrecision] * N[(y * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[y, 3.4e+168], N[(t$95$1 * N[(x * 0.5), $MachinePrecision]), $MachinePrecision], N[(y * (-t$95$1)), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
\mathbf{if}\;y \leq -720000:\\
\;\;\;\;\sqrt{\left(z \cdot 2\right) \cdot \left(y \cdot \left(y - x\right)\right)}\\
\mathbf{elif}\;y \leq 3.4 \cdot 10^{+168}:\\
\;\;\;\;t\_1 \cdot \left(x \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-t\_1\right)\\
\end{array}
\end{array}
if y < -7.2e5Initial program 99.9%
Taylor expanded in t around 0 57.1%
*-rgt-identity57.1%
*-commutative57.1%
pow157.1%
metadata-eval57.1%
sqrt-pow163.4%
sqrt-prod60.2%
pow1/260.2%
associate-*l*60.2%
Applied egg-rr60.2%
unpow1/260.2%
associate-*r*60.2%
*-commutative60.2%
Simplified60.2%
Taylor expanded in x around 0 48.2%
+-commutative48.2%
unpow248.2%
associate-*r*48.2%
distribute-rgt-in57.0%
mul-1-neg57.0%
unsub-neg57.0%
Simplified57.0%
if -7.2e5 < y < 3.40000000000000003e168Initial program 99.8%
Taylor expanded in t around 0 56.6%
*-rgt-identity56.6%
*-commutative56.6%
sub-neg56.6%
distribute-lft-in56.6%
Applied egg-rr56.6%
distribute-lft-out56.6%
*-commutative56.6%
sub-neg56.6%
Simplified56.6%
Taylor expanded in x around inf 43.4%
if 3.40000000000000003e168 < y Initial program 99.8%
Taylor expanded in t around 0 77.5%
*-rgt-identity77.5%
*-commutative77.5%
sub-neg77.5%
distribute-lft-in73.8%
Applied egg-rr73.8%
distribute-lft-out77.5%
*-commutative77.5%
sub-neg77.5%
Simplified77.5%
Taylor expanded in x around 0 66.2%
neg-mul-166.2%
Simplified66.2%
Final simplification48.9%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (sqrt (* z 2.0)))) (if (<= t 18.0) (* (- (* x 0.5) y) t_1) (* x (* t_1 (- 0.5 (/ y x)))))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z * 2.0));
double tmp;
if (t <= 18.0) {
tmp = ((x * 0.5) - y) * t_1;
} else {
tmp = x * (t_1 * (0.5 - (y / x)));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((z * 2.0d0))
if (t <= 18.0d0) then
tmp = ((x * 0.5d0) - y) * t_1
else
tmp = x * (t_1 * (0.5d0 - (y / x)))
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 tmp;
if (t <= 18.0) {
tmp = ((x * 0.5) - y) * t_1;
} else {
tmp = x * (t_1 * (0.5 - (y / x)));
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((z * 2.0)) tmp = 0 if t <= 18.0: tmp = ((x * 0.5) - y) * t_1 else: tmp = x * (t_1 * (0.5 - (y / x))) return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(z * 2.0)) tmp = 0.0 if (t <= 18.0) tmp = Float64(Float64(Float64(x * 0.5) - y) * t_1); else tmp = Float64(x * Float64(t_1 * Float64(0.5 - Float64(y / x)))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt((z * 2.0)); tmp = 0.0; if (t <= 18.0) tmp = ((x * 0.5) - y) * t_1; else tmp = x * (t_1 * (0.5 - (y / x))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 18.0], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * t$95$1), $MachinePrecision], N[(x * N[(t$95$1 * N[(0.5 - N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
\mathbf{if}\;t \leq 18:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t\_1 \cdot \left(0.5 - \frac{y}{x}\right)\right)\\
\end{array}
\end{array}
if t < 18Initial program 99.8%
Taylor expanded in t around 0 74.8%
*-rgt-identity74.8%
*-commutative74.8%
sub-neg74.8%
distribute-lft-in73.7%
Applied egg-rr73.7%
distribute-lft-out74.8%
*-commutative74.8%
sub-neg74.8%
Simplified74.8%
if 18 < t Initial program 100.0%
Taylor expanded in t around 0 14.2%
add-cube-cbrt14.2%
pow314.2%
Applied egg-rr14.2%
Taylor expanded in x around inf 24.1%
associate-*r*24.1%
rem-cube-cbrt24.1%
rem-cube-cbrt24.1%
distribute-rgt-out24.1%
+-commutative24.1%
mul-1-neg24.1%
unsub-neg24.1%
Simplified24.1%
Final simplification61.5%
(FPCore (x y z t) :precision binary64 (if (<= t 4.2e+249) (* (- (* x 0.5) y) (sqrt (* z 2.0))) (sqrt (* (* z 2.0) (* y (- y x))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 4.2e+249) {
tmp = ((x * 0.5) - y) * sqrt((z * 2.0));
} else {
tmp = sqrt(((z * 2.0) * (y * (y - x))));
}
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 <= 4.2d+249) then
tmp = ((x * 0.5d0) - y) * sqrt((z * 2.0d0))
else
tmp = sqrt(((z * 2.0d0) * (y * (y - x))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 4.2e+249) {
tmp = ((x * 0.5) - y) * Math.sqrt((z * 2.0));
} else {
tmp = Math.sqrt(((z * 2.0) * (y * (y - x))));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 4.2e+249: tmp = ((x * 0.5) - y) * math.sqrt((z * 2.0)) else: tmp = math.sqrt(((z * 2.0) * (y * (y - x)))) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 4.2e+249) tmp = Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))); else tmp = sqrt(Float64(Float64(z * 2.0) * Float64(y * Float64(y - x)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 4.2e+249) tmp = ((x * 0.5) - y) * sqrt((z * 2.0)); else tmp = sqrt(((z * 2.0) * (y * (y - x)))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 4.2e+249], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[(z * 2.0), $MachinePrecision] * N[(y * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 4.2 \cdot 10^{+249}:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\left(z \cdot 2\right) \cdot \left(y \cdot \left(y - x\right)\right)}\\
\end{array}
\end{array}
if t < 4.1999999999999997e249Initial program 99.8%
Taylor expanded in t around 0 62.2%
*-rgt-identity62.2%
*-commutative62.2%
sub-neg62.2%
distribute-lft-in61.3%
Applied egg-rr61.3%
distribute-lft-out62.2%
*-commutative62.2%
sub-neg62.2%
Simplified62.2%
if 4.1999999999999997e249 < t Initial program 100.0%
Taylor expanded in t around 0 10.3%
*-rgt-identity10.3%
*-commutative10.3%
pow110.3%
metadata-eval10.3%
sqrt-pow132.0%
sqrt-prod32.0%
pow1/232.0%
associate-*l*32.0%
Applied egg-rr32.0%
unpow1/232.0%
associate-*r*32.0%
*-commutative32.0%
Simplified32.0%
Taylor expanded in x around 0 19.4%
+-commutative19.4%
unpow219.4%
associate-*r*19.4%
distribute-rgt-in25.7%
mul-1-neg25.7%
unsub-neg25.7%
Simplified25.7%
Final simplification59.9%
(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 * Float64(-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 \left(-\sqrt{z \cdot 2}\right)
\end{array}
Initial program 99.8%
Taylor expanded in t around 0 58.9%
*-rgt-identity58.9%
*-commutative58.9%
sub-neg58.9%
distribute-lft-in58.2%
Applied egg-rr58.2%
distribute-lft-out58.9%
*-commutative58.9%
sub-neg58.9%
Simplified58.9%
Taylor expanded in x around 0 28.5%
neg-mul-128.5%
Simplified28.5%
Final simplification28.5%
(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 t around 0 58.9%
*-rgt-identity58.9%
*-commutative58.9%
sub-neg58.9%
distribute-lft-in58.2%
Applied egg-rr58.2%
distribute-lft-out58.9%
*-commutative58.9%
sub-neg58.9%
Simplified58.9%
Taylor expanded in x around 0 28.5%
neg-mul-128.5%
Simplified28.5%
neg-sub028.5%
sub-neg28.5%
add-sqr-sqrt15.2%
sqrt-unprod17.6%
sqr-neg17.6%
sqrt-unprod1.3%
add-sqr-sqrt2.2%
Applied egg-rr2.2%
+-lft-identity2.2%
Simplified2.2%
Final simplification2.2%
(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 2024170
(FPCore (x y z t)
:name "Data.Number.Erf:$cinvnormcdf from erf-2.0.0.0, A"
:precision binary64
:alt
(! :herbie-platform default (* (* (- (* x 1/2) y) (sqrt (* z 2))) (pow (exp 1) (/ (* t t) 2))))
(* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (exp (/ (* t t) 2.0))))