
(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 9 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
(let* ((t_1 (- (* x 0.5) y)))
(if (<= (* t t) 290.0)
(* t_1 (sqrt (* z 2.0)))
(* t_1 (exp (/ (* t t) 2.0))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double tmp;
if ((t * t) <= 290.0) {
tmp = t_1 * sqrt((z * 2.0));
} else {
tmp = t_1 * exp(((t * t) / 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) :: t_1
real(8) :: tmp
t_1 = (x * 0.5d0) - y
if ((t * t) <= 290.0d0) then
tmp = t_1 * sqrt((z * 2.0d0))
else
tmp = t_1 * exp(((t * t) / 2.0d0))
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) <= 290.0) {
tmp = t_1 * Math.sqrt((z * 2.0));
} else {
tmp = t_1 * Math.exp(((t * t) / 2.0));
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * 0.5) - y tmp = 0 if (t * t) <= 290.0: tmp = t_1 * math.sqrt((z * 2.0)) else: tmp = t_1 * math.exp(((t * t) / 2.0)) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * 0.5) - y) tmp = 0.0 if (Float64(t * t) <= 290.0) tmp = Float64(t_1 * sqrt(Float64(z * 2.0))); else tmp = Float64(t_1 * exp(Float64(Float64(t * t) / 2.0))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * 0.5) - y; tmp = 0.0; if ((t * t) <= 290.0) tmp = t_1 * sqrt((z * 2.0)); else tmp = t_1 * exp(((t * t) / 2.0)); 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], 290.0], N[(t$95$1 * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
\mathbf{if}\;t \cdot t \leq 290:\\
\;\;\;\;t\_1 \cdot \sqrt{z \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot e^{\frac{t \cdot t}{2}}\\
\end{array}
\end{array}
if (*.f64 t t) < 290Initial program 99.6%
Taylor expanded in x around 0
Applied rewrites99.0%
if 290 < (*.f64 t t) Initial program 99.2%
Taylor expanded in x around 0
Applied rewrites100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x 0.5) y)) (t_2 (sqrt (* z 2.0))))
(if (<= (* (* t_1 t_2) (exp (/ (* t t) 2.0))) -5e-215)
t_1
(* (* t t) t_2))))
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_1 * t_2) * exp(((t * t) / 2.0))) <= -5e-215) {
tmp = t_1;
} else {
tmp = (t * t) * t_2;
}
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_1 * t_2) * exp(((t * t) / 2.0d0))) <= (-5d-215)) then
tmp = t_1
else
tmp = (t * t) * t_2
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_1 * t_2) * Math.exp(((t * t) / 2.0))) <= -5e-215) {
tmp = t_1;
} else {
tmp = (t * t) * t_2;
}
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_1 * t_2) * math.exp(((t * t) / 2.0))) <= -5e-215: tmp = t_1 else: tmp = (t * t) * t_2 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 (Float64(Float64(t_1 * t_2) * exp(Float64(Float64(t * t) / 2.0))) <= -5e-215) tmp = t_1; else tmp = Float64(Float64(t * t) * t_2); 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_1 * t_2) * exp(((t * t) / 2.0))) <= -5e-215) tmp = t_1; else tmp = (t * t) * t_2; 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[N[(N[(t$95$1 * t$95$2), $MachinePrecision] * N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -5e-215], t$95$1, N[(N[(t * t), $MachinePrecision] * t$95$2), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
t_2 := \sqrt{z \cdot 2}\\
\mathbf{if}\;\left(t\_1 \cdot t\_2\right) \cdot e^{\frac{t \cdot t}{2}} \leq -5 \cdot 10^{-215}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(t \cdot t\right) \cdot t\_2\\
\end{array}
\end{array}
if (*.f64 (*.f64 (-.f64 (*.f64 x #s(literal 1/2 binary64)) y) (sqrt.f64 (*.f64 z #s(literal 2 binary64)))) (exp.f64 (/.f64 (*.f64 t t) #s(literal 2 binary64)))) < -4.99999999999999956e-215Initial program 99.8%
Taylor expanded in x around 0
Applied rewrites55.3%
Taylor expanded in x around 0
Applied rewrites5.8%
if -4.99999999999999956e-215 < (*.f64 (*.f64 (-.f64 (*.f64 x #s(literal 1/2 binary64)) y) (sqrt.f64 (*.f64 z #s(literal 2 binary64)))) (exp.f64 (/.f64 (*.f64 t t) #s(literal 2 binary64)))) Initial program 99.2%
Taylor expanded in x around 0
Applied rewrites56.0%
Taylor expanded in x around 0
Applied rewrites28.0%
Taylor expanded in x around 0
Applied rewrites30.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x 0.5) y)))
(if (<= (* (* t_1 (sqrt (* z 2.0))) (exp (/ (* t t) 2.0))) 5e+292)
t_1
(* t t))))
double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double tmp;
if (((t_1 * sqrt((z * 2.0))) * exp(((t * t) / 2.0))) <= 5e+292) {
tmp = t_1;
} else {
tmp = 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) :: t_1
real(8) :: tmp
t_1 = (x * 0.5d0) - y
if (((t_1 * sqrt((z * 2.0d0))) * exp(((t * t) / 2.0d0))) <= 5d+292) then
tmp = t_1
else
tmp = t * t
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_1 * Math.sqrt((z * 2.0))) * Math.exp(((t * t) / 2.0))) <= 5e+292) {
tmp = t_1;
} else {
tmp = t * t;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * 0.5) - y tmp = 0 if ((t_1 * math.sqrt((z * 2.0))) * math.exp(((t * t) / 2.0))) <= 5e+292: tmp = t_1 else: tmp = t * t return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * 0.5) - y) tmp = 0.0 if (Float64(Float64(t_1 * sqrt(Float64(z * 2.0))) * exp(Float64(Float64(t * t) / 2.0))) <= 5e+292) tmp = t_1; else tmp = Float64(t * t); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * 0.5) - y; tmp = 0.0; if (((t_1 * sqrt((z * 2.0))) * exp(((t * t) / 2.0))) <= 5e+292) tmp = t_1; else tmp = t * t; 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[(N[(t$95$1 * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 5e+292], t$95$1, N[(t * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
\mathbf{if}\;\left(t\_1 \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}} \leq 5 \cdot 10^{+292}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t \cdot t\\
\end{array}
\end{array}
if (*.f64 (*.f64 (-.f64 (*.f64 x #s(literal 1/2 binary64)) y) (sqrt.f64 (*.f64 z #s(literal 2 binary64)))) (exp.f64 (/.f64 (*.f64 t t) #s(literal 2 binary64)))) < 4.9999999999999996e292Initial program 99.7%
Taylor expanded in x around 0
Applied rewrites71.9%
Taylor expanded in x around 0
Applied rewrites6.3%
if 4.9999999999999996e292 < (*.f64 (*.f64 (-.f64 (*.f64 x #s(literal 1/2 binary64)) y) (sqrt.f64 (*.f64 z #s(literal 2 binary64)))) (exp.f64 (/.f64 (*.f64 t t) #s(literal 2 binary64)))) Initial program 98.7%
Taylor expanded in x around 0
Applied rewrites18.0%
Taylor expanded in x around 0
Applied rewrites69.0%
Taylor expanded in y around inf
Applied rewrites45.6%
(FPCore (x y z t) :precision binary64 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (exp (/ (* t t) 2.0))))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * exp(((t * t) / 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * Math.exp(((t * t) / 2.0));
}
def code(x, y, z, t): return (((x * 0.5) - y) * math.sqrt((z * 2.0))) * math.exp(((t * t) / 2.0))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * exp(Float64(Float64(t * t) / 2.0))) end
function tmp = code(x, y, z, t) tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}}
\end{array}
Initial program 99.4%
(FPCore (x y z t) :precision binary64 (if (<= (* t t) 320.0) (* (- (* x 0.5) y) (sqrt (* z 2.0))) (* (* x 0.5) (exp (/ (* t t) 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t * t) <= 320.0) {
tmp = ((x * 0.5) - y) * sqrt((z * 2.0));
} else {
tmp = (x * 0.5) * exp(((t * t) / 2.0));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t * t) <= 320.0d0) then
tmp = ((x * 0.5d0) - y) * sqrt((z * 2.0d0))
else
tmp = (x * 0.5d0) * exp(((t * t) / 2.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t * t) <= 320.0) {
tmp = ((x * 0.5) - y) * Math.sqrt((z * 2.0));
} else {
tmp = (x * 0.5) * Math.exp(((t * t) / 2.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t * t) <= 320.0: tmp = ((x * 0.5) - y) * math.sqrt((z * 2.0)) else: tmp = (x * 0.5) * math.exp(((t * t) / 2.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(t * t) <= 320.0) tmp = Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))); else tmp = Float64(Float64(x * 0.5) * exp(Float64(Float64(t * t) / 2.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t * t) <= 320.0) tmp = ((x * 0.5) - y) * sqrt((z * 2.0)); else tmp = (x * 0.5) * exp(((t * t) / 2.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(t * t), $MachinePrecision], 320.0], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(x * 0.5), $MachinePrecision] * N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \cdot t \leq 320:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot 0.5\right) \cdot e^{\frac{t \cdot t}{2}}\\
\end{array}
\end{array}
if (*.f64 t t) < 320Initial program 99.6%
Taylor expanded in x around 0
Applied rewrites99.0%
if 320 < (*.f64 t t) Initial program 99.2%
Taylor expanded in x around 0
Applied rewrites74.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (* z 2.0))))
(if (<= (* t t) 1.02e+192)
(* (- (* x 0.5) y) t_1)
(* (* (/ (* t t) 2.0) t_1) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z * 2.0));
double tmp;
if ((t * t) <= 1.02e+192) {
tmp = ((x * 0.5) - y) * t_1;
} else {
tmp = (((t * t) / 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) :: tmp
t_1 = sqrt((z * 2.0d0))
if ((t * t) <= 1.02d+192) then
tmp = ((x * 0.5d0) - y) * t_1
else
tmp = (((t * t) / 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 = Math.sqrt((z * 2.0));
double tmp;
if ((t * t) <= 1.02e+192) {
tmp = ((x * 0.5) - y) * t_1;
} else {
tmp = (((t * t) / 2.0) * t_1) * t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((z * 2.0)) tmp = 0 if (t * t) <= 1.02e+192: tmp = ((x * 0.5) - y) * t_1 else: tmp = (((t * t) / 2.0) * t_1) * t_1 return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(z * 2.0)) tmp = 0.0 if (Float64(t * t) <= 1.02e+192) tmp = Float64(Float64(Float64(x * 0.5) - y) * t_1); else tmp = Float64(Float64(Float64(Float64(t * t) / 2.0) * t_1) * t_1); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt((z * 2.0)); tmp = 0.0; if ((t * t) <= 1.02e+192) tmp = ((x * 0.5) - y) * t_1; else tmp = (((t * t) / 2.0) * t_1) * 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[N[(t * t), $MachinePrecision], 1.02e+192], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[(N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
\mathbf{if}\;t \cdot t \leq 1.02 \cdot 10^{+192}:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{t \cdot t}{2} \cdot t\_1\right) \cdot t\_1\\
\end{array}
\end{array}
if (*.f64 t t) < 1.01999999999999996e192Initial program 99.1%
Taylor expanded in x around 0
Applied rewrites79.3%
if 1.01999999999999996e192 < (*.f64 t t) Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites10.7%
Taylor expanded in x around 0
Applied rewrites5.0%
Taylor expanded in y around 0
Applied rewrites42.6%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (sqrt (* z 2.0)))) (if (<= (* t t) 2.9e+265) (* (- (* x 0.5) y) t_1) (* (* t t) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z * 2.0));
double tmp;
if ((t * t) <= 2.9e+265) {
tmp = ((x * 0.5) - y) * t_1;
} else {
tmp = (t * t) * 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 ((t * t) <= 2.9d+265) then
tmp = ((x * 0.5d0) - y) * t_1
else
tmp = (t * t) * 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 ((t * t) <= 2.9e+265) {
tmp = ((x * 0.5) - y) * t_1;
} else {
tmp = (t * t) * t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((z * 2.0)) tmp = 0 if (t * t) <= 2.9e+265: tmp = ((x * 0.5) - y) * t_1 else: tmp = (t * t) * t_1 return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(z * 2.0)) tmp = 0.0 if (Float64(t * t) <= 2.9e+265) tmp = Float64(Float64(Float64(x * 0.5) - y) * t_1); else tmp = Float64(Float64(t * t) * t_1); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt((z * 2.0)); tmp = 0.0; if ((t * t) <= 2.9e+265) tmp = ((x * 0.5) - y) * t_1; else tmp = (t * t) * 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[N[(t * t), $MachinePrecision], 2.9e+265], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[(t * t), $MachinePrecision] * t$95$1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
\mathbf{if}\;t \cdot t \leq 2.9 \cdot 10^{+265}:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(t \cdot t\right) \cdot t\_1\\
\end{array}
\end{array}
if (*.f64 t t) < 2.89999999999999996e265Initial program 99.2%
Taylor expanded in x around 0
Applied rewrites74.6%
if 2.89999999999999996e265 < (*.f64 t t) Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites11.7%
Taylor expanded in x around 0
Applied rewrites5.3%
Taylor expanded in x around 0
Applied rewrites47.2%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (sqrt (* z 2.0)))) (if (<= (* t t) 2.3e+235) (* (* x 0.5) t_1) (* (* t t) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z * 2.0));
double tmp;
if ((t * t) <= 2.3e+235) {
tmp = (x * 0.5) * t_1;
} else {
tmp = (t * t) * 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 ((t * t) <= 2.3d+235) then
tmp = (x * 0.5d0) * t_1
else
tmp = (t * t) * 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 ((t * t) <= 2.3e+235) {
tmp = (x * 0.5) * t_1;
} else {
tmp = (t * t) * t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((z * 2.0)) tmp = 0 if (t * t) <= 2.3e+235: tmp = (x * 0.5) * t_1 else: tmp = (t * t) * t_1 return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(z * 2.0)) tmp = 0.0 if (Float64(t * t) <= 2.3e+235) tmp = Float64(Float64(x * 0.5) * t_1); else tmp = Float64(Float64(t * t) * t_1); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt((z * 2.0)); tmp = 0.0; if ((t * t) <= 2.3e+235) tmp = (x * 0.5) * t_1; else tmp = (t * t) * 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[N[(t * t), $MachinePrecision], 2.3e+235], N[(N[(x * 0.5), $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[(t * t), $MachinePrecision] * t$95$1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
\mathbf{if}\;t \cdot t \leq 2.3 \cdot 10^{+235}:\\
\;\;\;\;\left(x \cdot 0.5\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(t \cdot t\right) \cdot t\_1\\
\end{array}
\end{array}
if (*.f64 t t) < 2.3e235Initial program 99.2%
Taylor expanded in x around 0
Applied rewrites77.1%
Taylor expanded in x around 0
Applied rewrites36.6%
if 2.3e235 < (*.f64 t t) Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites11.1%
Taylor expanded in x around 0
Applied rewrites5.1%
Taylor expanded in x around 0
Applied rewrites44.0%
(FPCore (x y z t) :precision binary64 (* t t))
double code(double x, double y, double z, double t) {
return 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 = t * t
end function
public static double code(double x, double y, double z, double t) {
return t * t;
}
def code(x, y, z, t): return t * t
function code(x, y, z, t) return Float64(t * t) end
function tmp = code(x, y, z, t) tmp = t * t; end
code[x_, y_, z_, t_] := N[(t * t), $MachinePrecision]
\begin{array}{l}
\\
t \cdot t
\end{array}
Initial program 99.4%
Taylor expanded in x around 0
Applied rewrites55.7%
Taylor expanded in x around 0
Applied rewrites60.3%
Taylor expanded in y around inf
Applied rewrites16.0%
(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 2024313
(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))))