
(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 (* (sqrt (* z (* 2.0 (exp (pow t 2.0))))) (- (* 0.5 x) y)))
double code(double x, double y, double z, double t) {
return sqrt((z * (2.0 * exp(pow(t, 2.0))))) * ((0.5 * x) - y);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = sqrt((z * (2.0d0 * exp((t ** 2.0d0))))) * ((0.5d0 * x) - y)
end function
public static double code(double x, double y, double z, double t) {
return Math.sqrt((z * (2.0 * Math.exp(Math.pow(t, 2.0))))) * ((0.5 * x) - y);
}
def code(x, y, z, t): return math.sqrt((z * (2.0 * math.exp(math.pow(t, 2.0))))) * ((0.5 * x) - y)
function code(x, y, z, t) return Float64(sqrt(Float64(z * Float64(2.0 * exp((t ^ 2.0))))) * Float64(Float64(0.5 * x) - y)) end
function tmp = code(x, y, z, t) tmp = sqrt((z * (2.0 * exp((t ^ 2.0))))) * ((0.5 * x) - y); end
code[x_, y_, z_, t_] := N[(N[Sqrt[N[(z * N[(2.0 * N[Exp[N[Power[t, 2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{z \cdot \left(2 \cdot e^{{t}^{2}}\right)} \cdot \left(0.5 \cdot x - y\right)
\end{array}
Initial program 99.8%
expm1-log1p-u52.7%
expm1-undefine41.8%
associate-*l*41.8%
exp-sqrt41.8%
sqrt-unprod41.8%
pow241.8%
Applied egg-rr41.8%
log1p-undefine41.8%
rem-exp-log88.9%
+-commutative88.9%
associate--l+99.8%
metadata-eval99.8%
+-rgt-identity99.8%
*-commutative99.8%
associate-*l*99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (if (or (<= (* t t) 0.0001) (not (<= (* t t) 5e+306))) (* (- (* 0.5 x) y) (sqrt (* 2.0 (* z (fma t t 1.0))))) (* (exp (/ (* t t) 2.0)) (* y (- (sqrt (* z 2.0)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (((t * t) <= 0.0001) || !((t * t) <= 5e+306)) {
tmp = ((0.5 * x) - y) * sqrt((2.0 * (z * fma(t, t, 1.0))));
} else {
tmp = exp(((t * t) / 2.0)) * (y * -sqrt((z * 2.0)));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((Float64(t * t) <= 0.0001) || !(Float64(t * t) <= 5e+306)) tmp = Float64(Float64(Float64(0.5 * x) - y) * sqrt(Float64(2.0 * Float64(z * fma(t, t, 1.0))))); else tmp = Float64(exp(Float64(Float64(t * t) / 2.0)) * Float64(y * Float64(-sqrt(Float64(z * 2.0))))); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(t * t), $MachinePrecision], 0.0001], N[Not[LessEqual[N[(t * t), $MachinePrecision], 5e+306]], $MachinePrecision]], N[(N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(2.0 * N[(z * N[(t * t + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision] * N[(y * (-N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \cdot t \leq 0.0001 \lor \neg \left(t \cdot t \leq 5 \cdot 10^{+306}\right):\\
\;\;\;\;\left(0.5 \cdot x - y\right) \cdot \sqrt{2 \cdot \left(z \cdot \mathsf{fma}\left(t, t, 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{t \cdot t}{2}} \cdot \left(y \cdot \left(-\sqrt{z \cdot 2}\right)\right)\\
\end{array}
\end{array}
if (*.f64 t t) < 1.00000000000000005e-4 or 4.99999999999999993e306 < (*.f64 t t) Initial program 99.8%
expm1-log1p-u54.8%
expm1-undefine39.9%
associate-*l*39.9%
exp-sqrt39.9%
sqrt-unprod39.9%
pow239.9%
Applied egg-rr39.9%
log1p-undefine39.9%
rem-exp-log84.9%
+-commutative84.9%
associate--l+99.8%
metadata-eval99.8%
+-rgt-identity99.8%
*-commutative99.8%
associate-*l*99.8%
Simplified99.8%
Taylor expanded in t around 0 99.6%
distribute-lft-out99.6%
*-commutative99.6%
Simplified99.6%
pow199.6%
*-commutative99.6%
+-commutative99.6%
pow299.6%
fma-define99.6%
pow299.6%
Applied egg-rr99.6%
unpow199.6%
fma-undefine99.6%
*-rgt-identity99.6%
distribute-lft-in99.6%
unpow299.6%
fma-define99.6%
Simplified99.6%
if 1.00000000000000005e-4 < (*.f64 t t) < 4.99999999999999993e306Initial program 100.0%
Taylor expanded in x around 0 69.1%
mul-1-neg69.1%
*-commutative69.1%
distribute-rgt-neg-in69.1%
*-commutative69.1%
distribute-rgt-neg-in69.1%
Simplified69.1%
associate-*r*69.1%
sqrt-prod69.1%
distribute-rgt-neg-out69.1%
sqrt-prod69.1%
add-sqr-sqrt38.2%
sqrt-unprod39.7%
sqr-neg39.7%
sqrt-unprod8.8%
add-sqr-sqrt22.1%
associate-*r*22.1%
*-commutative22.1%
*-commutative22.1%
associate-*l*22.1%
sqrt-prod22.1%
*-commutative22.1%
add-sqr-sqrt8.8%
sqrt-unprod39.7%
sqr-neg39.7%
sqrt-unprod38.2%
add-sqr-sqrt69.1%
Applied egg-rr69.1%
distribute-rgt-neg-in69.1%
*-commutative69.1%
Simplified69.1%
Final simplification91.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* 0.5 x) y)) (t_2 (sqrt (* z 2.0))))
(if (<= t 0.00015)
(* t_1 t_2)
(if (<= t 1e+221)
(* (exp (/ (* t t) 2.0)) (* y (- t_2)))
(* t_1 (* (* t (sqrt 2.0)) (sqrt z)))))))
double code(double x, double y, double z, double t) {
double t_1 = (0.5 * x) - y;
double t_2 = sqrt((z * 2.0));
double tmp;
if (t <= 0.00015) {
tmp = t_1 * t_2;
} else if (t <= 1e+221) {
tmp = exp(((t * t) / 2.0)) * (y * -t_2);
} else {
tmp = t_1 * ((t * sqrt(2.0)) * sqrt(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) :: t_2
real(8) :: tmp
t_1 = (0.5d0 * x) - y
t_2 = sqrt((z * 2.0d0))
if (t <= 0.00015d0) then
tmp = t_1 * t_2
else if (t <= 1d+221) then
tmp = exp(((t * t) / 2.0d0)) * (y * -t_2)
else
tmp = t_1 * ((t * sqrt(2.0d0)) * sqrt(z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (0.5 * x) - y;
double t_2 = Math.sqrt((z * 2.0));
double tmp;
if (t <= 0.00015) {
tmp = t_1 * t_2;
} else if (t <= 1e+221) {
tmp = Math.exp(((t * t) / 2.0)) * (y * -t_2);
} else {
tmp = t_1 * ((t * Math.sqrt(2.0)) * Math.sqrt(z));
}
return tmp;
}
def code(x, y, z, t): t_1 = (0.5 * x) - y t_2 = math.sqrt((z * 2.0)) tmp = 0 if t <= 0.00015: tmp = t_1 * t_2 elif t <= 1e+221: tmp = math.exp(((t * t) / 2.0)) * (y * -t_2) else: tmp = t_1 * ((t * math.sqrt(2.0)) * math.sqrt(z)) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(0.5 * x) - y) t_2 = sqrt(Float64(z * 2.0)) tmp = 0.0 if (t <= 0.00015) tmp = Float64(t_1 * t_2); elseif (t <= 1e+221) tmp = Float64(exp(Float64(Float64(t * t) / 2.0)) * Float64(y * Float64(-t_2))); else tmp = Float64(t_1 * Float64(Float64(t * sqrt(2.0)) * sqrt(z))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (0.5 * x) - y; t_2 = sqrt((z * 2.0)); tmp = 0.0; if (t <= 0.00015) tmp = t_1 * t_2; elseif (t <= 1e+221) tmp = exp(((t * t) / 2.0)) * (y * -t_2); else tmp = t_1 * ((t * sqrt(2.0)) * sqrt(z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 0.00015], N[(t$95$1 * t$95$2), $MachinePrecision], If[LessEqual[t, 1e+221], N[(N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision] * N[(y * (-t$95$2)), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] * N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 0.5 \cdot x - y\\
t_2 := \sqrt{z \cdot 2}\\
\mathbf{if}\;t \leq 0.00015:\\
\;\;\;\;t\_1 \cdot t\_2\\
\mathbf{elif}\;t \leq 10^{+221}:\\
\;\;\;\;e^{\frac{t \cdot t}{2}} \cdot \left(y \cdot \left(-t\_2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(\left(t \cdot \sqrt{2}\right) \cdot \sqrt{z}\right)\\
\end{array}
\end{array}
if t < 1.49999999999999987e-4Initial program 99.8%
expm1-log1p-u52.9%
expm1-undefine38.5%
associate-*l*38.5%
exp-sqrt38.5%
sqrt-unprod38.5%
pow238.5%
Applied egg-rr38.5%
log1p-undefine38.5%
rem-exp-log85.4%
+-commutative85.4%
associate--l+99.8%
metadata-eval99.8%
+-rgt-identity99.8%
*-commutative99.8%
associate-*l*99.8%
Simplified99.8%
Taylor expanded in t around 0 66.4%
if 1.49999999999999987e-4 < t < 1e221Initial program 100.0%
Taylor expanded in x around 0 61.4%
mul-1-neg61.4%
*-commutative61.4%
distribute-rgt-neg-in61.4%
*-commutative61.4%
distribute-rgt-neg-in61.4%
Simplified61.4%
associate-*r*61.4%
sqrt-prod61.4%
distribute-rgt-neg-out61.4%
sqrt-prod61.4%
add-sqr-sqrt34.1%
sqrt-unprod41.1%
sqr-neg41.1%
sqrt-unprod11.4%
add-sqr-sqrt25.0%
associate-*r*25.0%
*-commutative25.0%
*-commutative25.0%
associate-*l*25.0%
sqrt-prod25.0%
*-commutative25.0%
add-sqr-sqrt11.4%
sqrt-unprod41.1%
sqr-neg41.1%
sqrt-unprod34.0%
add-sqr-sqrt61.4%
Applied egg-rr61.4%
distribute-rgt-neg-in61.4%
*-commutative61.4%
Simplified61.4%
if 1e221 < t Initial program 100.0%
expm1-log1p-u64.7%
expm1-undefine64.7%
associate-*l*64.7%
exp-sqrt64.7%
sqrt-unprod64.7%
pow264.7%
Applied egg-rr64.7%
log1p-undefine64.7%
rem-exp-log100.0%
+-commutative100.0%
associate--l+100.0%
metadata-eval100.0%
+-rgt-identity100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in t around 0 100.0%
distribute-lft-out100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in t around inf 88.8%
Final simplification67.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* 0.5 x) y)) (t_2 (sqrt (* z 2.0))))
(if (<= t 11000.0)
(* t_1 t_2)
(if (<= t 2.6e+72)
(* (exp (/ (* t t) 2.0)) (* y t_2))
(* (sqrt z) (* t_1 (* t (sqrt 2.0))))))))
double code(double x, double y, double z, double t) {
double t_1 = (0.5 * x) - y;
double t_2 = sqrt((z * 2.0));
double tmp;
if (t <= 11000.0) {
tmp = t_1 * t_2;
} else if (t <= 2.6e+72) {
tmp = exp(((t * t) / 2.0)) * (y * t_2);
} else {
tmp = sqrt(z) * (t_1 * (t * sqrt(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) :: t_2
real(8) :: tmp
t_1 = (0.5d0 * x) - y
t_2 = sqrt((z * 2.0d0))
if (t <= 11000.0d0) then
tmp = t_1 * t_2
else if (t <= 2.6d+72) then
tmp = exp(((t * t) / 2.0d0)) * (y * t_2)
else
tmp = sqrt(z) * (t_1 * (t * sqrt(2.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (0.5 * x) - y;
double t_2 = Math.sqrt((z * 2.0));
double tmp;
if (t <= 11000.0) {
tmp = t_1 * t_2;
} else if (t <= 2.6e+72) {
tmp = Math.exp(((t * t) / 2.0)) * (y * t_2);
} else {
tmp = Math.sqrt(z) * (t_1 * (t * Math.sqrt(2.0)));
}
return tmp;
}
def code(x, y, z, t): t_1 = (0.5 * x) - y t_2 = math.sqrt((z * 2.0)) tmp = 0 if t <= 11000.0: tmp = t_1 * t_2 elif t <= 2.6e+72: tmp = math.exp(((t * t) / 2.0)) * (y * t_2) else: tmp = math.sqrt(z) * (t_1 * (t * math.sqrt(2.0))) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(0.5 * x) - y) t_2 = sqrt(Float64(z * 2.0)) tmp = 0.0 if (t <= 11000.0) tmp = Float64(t_1 * t_2); elseif (t <= 2.6e+72) tmp = Float64(exp(Float64(Float64(t * t) / 2.0)) * Float64(y * t_2)); else tmp = Float64(sqrt(z) * Float64(t_1 * Float64(t * sqrt(2.0)))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (0.5 * x) - y; t_2 = sqrt((z * 2.0)); tmp = 0.0; if (t <= 11000.0) tmp = t_1 * t_2; elseif (t <= 2.6e+72) tmp = exp(((t * t) / 2.0)) * (y * t_2); else tmp = sqrt(z) * (t_1 * (t * sqrt(2.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 11000.0], N[(t$95$1 * t$95$2), $MachinePrecision], If[LessEqual[t, 2.6e+72], N[(N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision] * N[(y * t$95$2), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[z], $MachinePrecision] * N[(t$95$1 * N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 0.5 \cdot x - y\\
t_2 := \sqrt{z \cdot 2}\\
\mathbf{if}\;t \leq 11000:\\
\;\;\;\;t\_1 \cdot t\_2\\
\mathbf{elif}\;t \leq 2.6 \cdot 10^{+72}:\\
\;\;\;\;e^{\frac{t \cdot t}{2}} \cdot \left(y \cdot t\_2\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{z} \cdot \left(t\_1 \cdot \left(t \cdot \sqrt{2}\right)\right)\\
\end{array}
\end{array}
if t < 11000Initial program 99.8%
expm1-log1p-u53.3%
expm1-undefine39.2%
associate-*l*39.2%
exp-sqrt39.2%
sqrt-unprod39.2%
pow239.2%
Applied egg-rr39.2%
log1p-undefine39.2%
rem-exp-log85.7%
+-commutative85.7%
associate--l+99.8%
metadata-eval99.8%
+-rgt-identity99.8%
*-commutative99.8%
associate-*l*99.8%
Simplified99.8%
Taylor expanded in t around 0 66.1%
if 11000 < t < 2.59999999999999981e72Initial program 100.0%
Taylor expanded in x around 0 42.9%
mul-1-neg42.9%
*-commutative42.9%
distribute-rgt-neg-in42.9%
*-commutative42.9%
distribute-rgt-neg-in42.9%
Simplified42.9%
pow142.9%
*-commutative42.9%
*-commutative42.9%
associate-*l*42.9%
sqrt-prod42.9%
*-commutative42.9%
add-sqr-sqrt14.3%
sqrt-unprod28.6%
sqr-neg28.6%
sqrt-unprod28.6%
add-sqr-sqrt42.9%
Applied egg-rr42.9%
unpow142.9%
*-commutative42.9%
Simplified42.9%
if 2.59999999999999981e72 < t Initial program 100.0%
expm1-log1p-u52.0%
expm1-undefine52.0%
associate-*l*52.0%
exp-sqrt52.0%
sqrt-unprod52.0%
pow252.0%
Applied egg-rr52.0%
log1p-undefine52.0%
rem-exp-log100.0%
+-commutative100.0%
associate--l+100.0%
metadata-eval100.0%
+-rgt-identity100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in t around 0 62.0%
distribute-lft-out62.0%
*-commutative62.0%
Simplified62.0%
Taylor expanded in t around inf 54.5%
*-commutative54.5%
associate-*r*54.5%
*-commutative54.5%
*-commutative54.5%
Simplified54.5%
Final simplification63.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* 0.5 x) y)))
(if (<= t 1.0)
(* t_1 (sqrt (* z 2.0)))
(* (sqrt z) (* t_1 (* t (sqrt 2.0)))))))
double code(double x, double y, double z, double t) {
double t_1 = (0.5 * x) - y;
double tmp;
if (t <= 1.0) {
tmp = t_1 * sqrt((z * 2.0));
} else {
tmp = sqrt(z) * (t_1 * (t * sqrt(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 = (0.5d0 * x) - y
if (t <= 1.0d0) then
tmp = t_1 * sqrt((z * 2.0d0))
else
tmp = sqrt(z) * (t_1 * (t * sqrt(2.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (0.5 * x) - y;
double tmp;
if (t <= 1.0) {
tmp = t_1 * Math.sqrt((z * 2.0));
} else {
tmp = Math.sqrt(z) * (t_1 * (t * Math.sqrt(2.0)));
}
return tmp;
}
def code(x, y, z, t): t_1 = (0.5 * x) - y tmp = 0 if t <= 1.0: tmp = t_1 * math.sqrt((z * 2.0)) else: tmp = math.sqrt(z) * (t_1 * (t * math.sqrt(2.0))) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(0.5 * x) - y) tmp = 0.0 if (t <= 1.0) tmp = Float64(t_1 * sqrt(Float64(z * 2.0))); else tmp = Float64(sqrt(z) * Float64(t_1 * Float64(t * sqrt(2.0)))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (0.5 * x) - y; tmp = 0.0; if (t <= 1.0) tmp = t_1 * sqrt((z * 2.0)); else tmp = sqrt(z) * (t_1 * (t * sqrt(2.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[t, 1.0], N[(t$95$1 * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[z], $MachinePrecision] * N[(t$95$1 * N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 0.5 \cdot x - y\\
\mathbf{if}\;t \leq 1:\\
\;\;\;\;t\_1 \cdot \sqrt{z \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{z} \cdot \left(t\_1 \cdot \left(t \cdot \sqrt{2}\right)\right)\\
\end{array}
\end{array}
if t < 1Initial program 99.8%
expm1-log1p-u53.0%
expm1-undefine38.9%
associate-*l*38.9%
exp-sqrt38.9%
sqrt-unprod38.9%
pow238.9%
Applied egg-rr38.9%
log1p-undefine38.9%
rem-exp-log85.6%
+-commutative85.6%
associate--l+99.8%
metadata-eval99.8%
+-rgt-identity99.8%
*-commutative99.8%
associate-*l*99.8%
Simplified99.8%
Taylor expanded in t around 0 66.4%
if 1 < t Initial program 100.0%
expm1-log1p-u51.7%
expm1-undefine51.7%
associate-*l*51.7%
exp-sqrt51.7%
sqrt-unprod51.7%
pow251.7%
Applied egg-rr51.7%
log1p-undefine51.7%
rem-exp-log100.0%
+-commutative100.0%
associate--l+100.0%
metadata-eval100.0%
+-rgt-identity100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in t around 0 54.0%
distribute-lft-out54.0%
*-commutative54.0%
Simplified54.0%
Taylor expanded in t around inf 47.6%
*-commutative47.6%
associate-*r*47.6%
*-commutative47.6%
*-commutative47.6%
Simplified47.6%
Final simplification62.2%
(FPCore (x y z t) :precision binary64 (* (exp (/ (* t t) 2.0)) (* (- (* 0.5 x) y) (sqrt (* z 2.0)))))
double code(double x, double y, double z, double t) {
return exp(((t * t) / 2.0)) * (((0.5 * x) - 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)) * (((0.5d0 * x) - 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)) * (((0.5 * x) - y) * Math.sqrt((z * 2.0)));
}
def code(x, y, z, t): return math.exp(((t * t) / 2.0)) * (((0.5 * x) - y) * math.sqrt((z * 2.0)))
function code(x, y, z, t) return Float64(exp(Float64(Float64(t * t) / 2.0)) * Float64(Float64(Float64(0.5 * x) - y) * sqrt(Float64(z * 2.0)))) end
function tmp = code(x, y, z, t) tmp = exp(((t * t) / 2.0)) * (((0.5 * x) - 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[(0.5 * x), $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(0.5 \cdot x - y\right) \cdot \sqrt{z \cdot 2}\right)
\end{array}
Initial program 99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (* (- (* 0.5 x) y) (sqrt (* z 2.0))))
double code(double x, double y, double z, double t) {
return ((0.5 * x) - 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 = ((0.5d0 * x) - y) * sqrt((z * 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
return ((0.5 * x) - y) * Math.sqrt((z * 2.0));
}
def code(x, y, z, t): return ((0.5 * x) - y) * math.sqrt((z * 2.0))
function code(x, y, z, t) return Float64(Float64(Float64(0.5 * x) - y) * sqrt(Float64(z * 2.0))) end
function tmp = code(x, y, z, t) tmp = ((0.5 * x) - y) * sqrt((z * 2.0)); end
code[x_, y_, z_, t_] := N[(N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot x - y\right) \cdot \sqrt{z \cdot 2}
\end{array}
Initial program 99.8%
expm1-log1p-u52.7%
expm1-undefine41.8%
associate-*l*41.8%
exp-sqrt41.8%
sqrt-unprod41.8%
pow241.8%
Applied egg-rr41.8%
log1p-undefine41.8%
rem-exp-log88.9%
+-commutative88.9%
associate--l+99.8%
metadata-eval99.8%
+-rgt-identity99.8%
*-commutative99.8%
associate-*l*99.8%
Simplified99.8%
Taylor expanded in t around 0 54.2%
Final simplification54.2%
(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 x around 0 60.6%
mul-1-neg60.6%
*-commutative60.6%
distribute-rgt-neg-in60.6%
*-commutative60.6%
distribute-rgt-neg-in60.6%
Simplified60.6%
Taylor expanded in t around 0 28.0%
mul-1-neg28.0%
associate-*l*28.0%
*-commutative28.0%
distribute-rgt-neg-in28.0%
distribute-rgt-neg-in28.0%
Simplified28.0%
pow128.0%
distribute-rgt-neg-out28.0%
pow1/228.0%
pow1/228.0%
pow-prod-down28.0%
Applied egg-rr28.0%
unpow128.0%
unpow1/228.0%
*-commutative28.0%
Simplified28.0%
Final simplification28.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 2024079
(FPCore (x y z t)
:name "Data.Number.Erf:$cinvnormcdf from erf-2.0.0.0, A"
:precision binary64
:alt
(* (* (- (* 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))))