
(FPCore (x y z t) :precision binary64 (+ x (* (- y x) (/ z t))))
double code(double x, double y, double z, double t) {
return x + ((y - x) * (z / 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 = x + ((y - x) * (z / t))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - x) * (z / t));
}
def code(x, y, z, t): return x + ((y - x) * (z / t))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - x) * Float64(z / t))) end
function tmp = code(x, y, z, t) tmp = x + ((y - x) * (z / t)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - x\right) \cdot \frac{z}{t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (* (- y x) (/ z t))))
double code(double x, double y, double z, double t) {
return x + ((y - x) * (z / 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 = x + ((y - x) * (z / t))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - x) * (z / t));
}
def code(x, y, z, t): return x + ((y - x) * (z / t))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - x) * Float64(z / t))) end
function tmp = code(x, y, z, t) tmp = x + ((y - x) * (z / t)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - x\right) \cdot \frac{z}{t}
\end{array}
(FPCore (x y z t) :precision binary64 (let* ((t_1 (+ x (* (- y x) (/ z t))))) (if (<= t_1 4e+306) t_1 (+ x (/ (* (- y x) z) t)))))
double code(double x, double y, double z, double t) {
double t_1 = x + ((y - x) * (z / t));
double tmp;
if (t_1 <= 4e+306) {
tmp = t_1;
} else {
tmp = x + (((y - x) * z) / 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 + ((y - x) * (z / t))
if (t_1 <= 4d+306) then
tmp = t_1
else
tmp = x + (((y - x) * z) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x + ((y - x) * (z / t));
double tmp;
if (t_1 <= 4e+306) {
tmp = t_1;
} else {
tmp = x + (((y - x) * z) / t);
}
return tmp;
}
def code(x, y, z, t): t_1 = x + ((y - x) * (z / t)) tmp = 0 if t_1 <= 4e+306: tmp = t_1 else: tmp = x + (((y - x) * z) / t) return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(Float64(y - x) * Float64(z / t))) tmp = 0.0 if (t_1 <= 4e+306) tmp = t_1; else tmp = Float64(x + Float64(Float64(Float64(y - x) * z) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + ((y - x) * (z / t)); tmp = 0.0; if (t_1 <= 4e+306) tmp = t_1; else tmp = x + (((y - x) * z) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 4e+306], t$95$1, N[(x + N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(y - x\right) \cdot \frac{z}{t}\\
\mathbf{if}\;t_1 \leq 4 \cdot 10^{+306}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x + \frac{\left(y - x\right) \cdot z}{t}\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y x) (/.f64 z t))) < 4.00000000000000007e306Initial program 98.1%
if 4.00000000000000007e306 < (+.f64 x (*.f64 (-.f64 y x) (/.f64 z t))) Initial program 84.7%
associate-*r/100.0%
Applied egg-rr100.0%
Final simplification98.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (* y (/ z t)))) (t_2 (/ x (/ (- t) z))))
(if (<= (/ z t) -2e+224)
t_2
(if (<= (/ z t) 5e+22)
t_1
(if (<= (/ z t) 5e+215)
t_2
(if (<= (/ z t) 1e+272) t_1 (* x (/ (- z) t))))))))
double code(double x, double y, double z, double t) {
double t_1 = x + (y * (z / t));
double t_2 = x / (-t / z);
double tmp;
if ((z / t) <= -2e+224) {
tmp = t_2;
} else if ((z / t) <= 5e+22) {
tmp = t_1;
} else if ((z / t) <= 5e+215) {
tmp = t_2;
} else if ((z / t) <= 1e+272) {
tmp = t_1;
} else {
tmp = x * (-z / 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) :: t_2
real(8) :: tmp
t_1 = x + (y * (z / t))
t_2 = x / (-t / z)
if ((z / t) <= (-2d+224)) then
tmp = t_2
else if ((z / t) <= 5d+22) then
tmp = t_1
else if ((z / t) <= 5d+215) then
tmp = t_2
else if ((z / t) <= 1d+272) then
tmp = t_1
else
tmp = x * (-z / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x + (y * (z / t));
double t_2 = x / (-t / z);
double tmp;
if ((z / t) <= -2e+224) {
tmp = t_2;
} else if ((z / t) <= 5e+22) {
tmp = t_1;
} else if ((z / t) <= 5e+215) {
tmp = t_2;
} else if ((z / t) <= 1e+272) {
tmp = t_1;
} else {
tmp = x * (-z / t);
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (y * (z / t)) t_2 = x / (-t / z) tmp = 0 if (z / t) <= -2e+224: tmp = t_2 elif (z / t) <= 5e+22: tmp = t_1 elif (z / t) <= 5e+215: tmp = t_2 elif (z / t) <= 1e+272: tmp = t_1 else: tmp = x * (-z / t) return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(y * Float64(z / t))) t_2 = Float64(x / Float64(Float64(-t) / z)) tmp = 0.0 if (Float64(z / t) <= -2e+224) tmp = t_2; elseif (Float64(z / t) <= 5e+22) tmp = t_1; elseif (Float64(z / t) <= 5e+215) tmp = t_2; elseif (Float64(z / t) <= 1e+272) tmp = t_1; else tmp = Float64(x * Float64(Float64(-z) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + (y * (z / t)); t_2 = x / (-t / z); tmp = 0.0; if ((z / t) <= -2e+224) tmp = t_2; elseif ((z / t) <= 5e+22) tmp = t_1; elseif ((z / t) <= 5e+215) tmp = t_2; elseif ((z / t) <= 1e+272) tmp = t_1; else tmp = x * (-z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x / N[((-t) / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z / t), $MachinePrecision], -2e+224], t$95$2, If[LessEqual[N[(z / t), $MachinePrecision], 5e+22], t$95$1, If[LessEqual[N[(z / t), $MachinePrecision], 5e+215], t$95$2, If[LessEqual[N[(z / t), $MachinePrecision], 1e+272], t$95$1, N[(x * N[((-z) / t), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + y \cdot \frac{z}{t}\\
t_2 := \frac{x}{\frac{-t}{z}}\\
\mathbf{if}\;\frac{z}{t} \leq -2 \cdot 10^{+224}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\frac{z}{t} \leq 5 \cdot 10^{+22}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{z}{t} \leq 5 \cdot 10^{+215}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\frac{z}{t} \leq 10^{+272}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-z}{t}\\
\end{array}
\end{array}
if (/.f64 z t) < -1.99999999999999994e224 or 4.9999999999999996e22 < (/.f64 z t) < 5.0000000000000001e215Initial program 96.6%
Taylor expanded in x around inf 74.8%
mul-1-neg74.8%
unsub-neg74.8%
distribute-lft-out--74.8%
*-rgt-identity74.8%
Simplified74.8%
clear-num74.7%
un-div-inv74.8%
Applied egg-rr74.8%
Taylor expanded in t around 0 70.1%
associate-*r/70.1%
*-commutative70.1%
associate-*l/70.1%
metadata-eval70.1%
distribute-neg-frac70.1%
associate-*r*74.8%
distribute-neg-frac74.8%
metadata-eval74.8%
metadata-eval74.8%
associate-/r*74.8%
neg-mul-174.8%
associate-/r/74.7%
*-commutative74.7%
associate-*r/74.8%
*-rgt-identity74.8%
Simplified74.8%
if -1.99999999999999994e224 < (/.f64 z t) < 4.9999999999999996e22 or 5.0000000000000001e215 < (/.f64 z t) < 1.0000000000000001e272Initial program 98.2%
Taylor expanded in y around inf 83.5%
associate-*r/88.5%
Simplified88.5%
if 1.0000000000000001e272 < (/.f64 z t) Initial program 82.5%
Taylor expanded in x around inf 66.4%
mul-1-neg66.4%
unsub-neg66.4%
distribute-lft-out--66.4%
*-rgt-identity66.4%
Simplified66.4%
clear-num66.4%
un-div-inv66.4%
Applied egg-rr66.4%
Taylor expanded in t around 0 62.6%
mul-1-neg62.6%
associate-*r/66.4%
distribute-rgt-neg-out66.4%
distribute-neg-frac66.4%
Simplified66.4%
Final simplification83.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ x (/ (- t) z))))
(if (<= (/ z t) -2e+224)
t_1
(if (<= (/ z t) 5e+22)
(+ x (* y (/ z t)))
(if (<= (/ z t) 5e+215)
t_1
(if (<= (/ z t) 1e+272) (+ x (* z (/ y t))) (* x (/ (- z) t))))))))
double code(double x, double y, double z, double t) {
double t_1 = x / (-t / z);
double tmp;
if ((z / t) <= -2e+224) {
tmp = t_1;
} else if ((z / t) <= 5e+22) {
tmp = x + (y * (z / t));
} else if ((z / t) <= 5e+215) {
tmp = t_1;
} else if ((z / t) <= 1e+272) {
tmp = x + (z * (y / t));
} else {
tmp = x * (-z / 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 / (-t / z)
if ((z / t) <= (-2d+224)) then
tmp = t_1
else if ((z / t) <= 5d+22) then
tmp = x + (y * (z / t))
else if ((z / t) <= 5d+215) then
tmp = t_1
else if ((z / t) <= 1d+272) then
tmp = x + (z * (y / t))
else
tmp = x * (-z / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x / (-t / z);
double tmp;
if ((z / t) <= -2e+224) {
tmp = t_1;
} else if ((z / t) <= 5e+22) {
tmp = x + (y * (z / t));
} else if ((z / t) <= 5e+215) {
tmp = t_1;
} else if ((z / t) <= 1e+272) {
tmp = x + (z * (y / t));
} else {
tmp = x * (-z / t);
}
return tmp;
}
def code(x, y, z, t): t_1 = x / (-t / z) tmp = 0 if (z / t) <= -2e+224: tmp = t_1 elif (z / t) <= 5e+22: tmp = x + (y * (z / t)) elif (z / t) <= 5e+215: tmp = t_1 elif (z / t) <= 1e+272: tmp = x + (z * (y / t)) else: tmp = x * (-z / t) return tmp
function code(x, y, z, t) t_1 = Float64(x / Float64(Float64(-t) / z)) tmp = 0.0 if (Float64(z / t) <= -2e+224) tmp = t_1; elseif (Float64(z / t) <= 5e+22) tmp = Float64(x + Float64(y * Float64(z / t))); elseif (Float64(z / t) <= 5e+215) tmp = t_1; elseif (Float64(z / t) <= 1e+272) tmp = Float64(x + Float64(z * Float64(y / t))); else tmp = Float64(x * Float64(Float64(-z) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x / (-t / z); tmp = 0.0; if ((z / t) <= -2e+224) tmp = t_1; elseif ((z / t) <= 5e+22) tmp = x + (y * (z / t)); elseif ((z / t) <= 5e+215) tmp = t_1; elseif ((z / t) <= 1e+272) tmp = x + (z * (y / t)); else tmp = x * (-z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x / N[((-t) / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z / t), $MachinePrecision], -2e+224], t$95$1, If[LessEqual[N[(z / t), $MachinePrecision], 5e+22], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z / t), $MachinePrecision], 5e+215], t$95$1, If[LessEqual[N[(z / t), $MachinePrecision], 1e+272], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[((-z) / t), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{\frac{-t}{z}}\\
\mathbf{if}\;\frac{z}{t} \leq -2 \cdot 10^{+224}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{z}{t} \leq 5 \cdot 10^{+22}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{elif}\;\frac{z}{t} \leq 5 \cdot 10^{+215}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{z}{t} \leq 10^{+272}:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-z}{t}\\
\end{array}
\end{array}
if (/.f64 z t) < -1.99999999999999994e224 or 4.9999999999999996e22 < (/.f64 z t) < 5.0000000000000001e215Initial program 96.6%
Taylor expanded in x around inf 74.8%
mul-1-neg74.8%
unsub-neg74.8%
distribute-lft-out--74.8%
*-rgt-identity74.8%
Simplified74.8%
clear-num74.7%
un-div-inv74.8%
Applied egg-rr74.8%
Taylor expanded in t around 0 70.1%
associate-*r/70.1%
*-commutative70.1%
associate-*l/70.1%
metadata-eval70.1%
distribute-neg-frac70.1%
associate-*r*74.8%
distribute-neg-frac74.8%
metadata-eval74.8%
metadata-eval74.8%
associate-/r*74.8%
neg-mul-174.8%
associate-/r/74.7%
*-commutative74.7%
associate-*r/74.8%
*-rgt-identity74.8%
Simplified74.8%
if -1.99999999999999994e224 < (/.f64 z t) < 4.9999999999999996e22Initial program 98.1%
Taylor expanded in y around inf 83.0%
associate-*r/88.1%
Simplified88.1%
if 5.0000000000000001e215 < (/.f64 z t) < 1.0000000000000001e272Initial program 99.7%
Taylor expanded in y around 0 80.0%
+-commutative80.0%
mul-1-neg80.0%
sub-neg80.0%
associate-/l*80.0%
associate-/l*80.0%
div-sub100.0%
associate-/r/100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
if 1.0000000000000001e272 < (/.f64 z t) Initial program 82.5%
Taylor expanded in x around inf 66.4%
mul-1-neg66.4%
unsub-neg66.4%
distribute-lft-out--66.4%
*-rgt-identity66.4%
Simplified66.4%
clear-num66.4%
un-div-inv66.4%
Applied egg-rr66.4%
Taylor expanded in t around 0 62.6%
mul-1-neg62.6%
associate-*r/66.4%
distribute-rgt-neg-out66.4%
distribute-neg-frac66.4%
Simplified66.4%
Final simplification83.0%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (+ x (* (- y x) (/ z t))))) (if (<= t_1 1e+291) t_1 (+ x (* z (/ (- y x) t))))))
double code(double x, double y, double z, double t) {
double t_1 = x + ((y - x) * (z / t));
double tmp;
if (t_1 <= 1e+291) {
tmp = t_1;
} else {
tmp = x + (z * ((y - x) / 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 + ((y - x) * (z / t))
if (t_1 <= 1d+291) then
tmp = t_1
else
tmp = x + (z * ((y - x) / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x + ((y - x) * (z / t));
double tmp;
if (t_1 <= 1e+291) {
tmp = t_1;
} else {
tmp = x + (z * ((y - x) / t));
}
return tmp;
}
def code(x, y, z, t): t_1 = x + ((y - x) * (z / t)) tmp = 0 if t_1 <= 1e+291: tmp = t_1 else: tmp = x + (z * ((y - x) / t)) return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(Float64(y - x) * Float64(z / t))) tmp = 0.0 if (t_1 <= 1e+291) tmp = t_1; else tmp = Float64(x + Float64(z * Float64(Float64(y - x) / t))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + ((y - x) * (z / t)); tmp = 0.0; if (t_1 <= 1e+291) tmp = t_1; else tmp = x + (z * ((y - x) / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 1e+291], t$95$1, N[(x + N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(y - x\right) \cdot \frac{z}{t}\\
\mathbf{if}\;t_1 \leq 10^{+291}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y x) (/.f64 z t))) < 9.9999999999999996e290Initial program 98.1%
if 9.9999999999999996e290 < (+.f64 x (*.f64 (-.f64 y x) (/.f64 z t))) Initial program 85.1%
Taylor expanded in y around 0 89.6%
+-commutative89.6%
mul-1-neg89.6%
sub-neg89.6%
associate-/l*68.8%
associate-/l*62.7%
div-sub85.1%
associate-/r/100.0%
*-commutative100.0%
Simplified100.0%
Final simplification98.4%
(FPCore (x y z t) :precision binary64 (if (<= y -3.3e-72) (+ x (* z (/ y t))) (if (<= y 1.15e-95) (- x (* x (/ z t))) (+ x (* y (/ z t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.3e-72) {
tmp = x + (z * (y / t));
} else if (y <= 1.15e-95) {
tmp = x - (x * (z / t));
} else {
tmp = x + (y * (z / 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) :: tmp
if (y <= (-3.3d-72)) then
tmp = x + (z * (y / t))
else if (y <= 1.15d-95) then
tmp = x - (x * (z / t))
else
tmp = x + (y * (z / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.3e-72) {
tmp = x + (z * (y / t));
} else if (y <= 1.15e-95) {
tmp = x - (x * (z / t));
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -3.3e-72: tmp = x + (z * (y / t)) elif y <= 1.15e-95: tmp = x - (x * (z / t)) else: tmp = x + (y * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -3.3e-72) tmp = Float64(x + Float64(z * Float64(y / t))); elseif (y <= 1.15e-95) tmp = Float64(x - Float64(x * Float64(z / t))); else tmp = Float64(x + Float64(y * Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -3.3e-72) tmp = x + (z * (y / t)); elseif (y <= 1.15e-95) tmp = x - (x * (z / t)); else tmp = x + (y * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -3.3e-72], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.15e-95], N[(x - N[(x * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.3 \cdot 10^{-72}:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\mathbf{elif}\;y \leq 1.15 \cdot 10^{-95}:\\
\;\;\;\;x - x \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if y < -3.3e-72Initial program 96.2%
Taylor expanded in y around 0 86.5%
+-commutative86.5%
mul-1-neg86.5%
sub-neg86.5%
associate-/l*88.8%
associate-/l*87.3%
div-sub96.2%
associate-/r/93.9%
*-commutative93.9%
Simplified93.9%
Taylor expanded in y around inf 86.9%
if -3.3e-72 < y < 1.15e-95Initial program 95.1%
Taylor expanded in x around inf 84.9%
mul-1-neg84.9%
unsub-neg84.9%
distribute-lft-out--84.9%
*-rgt-identity84.9%
Simplified84.9%
if 1.15e-95 < y Initial program 97.6%
Taylor expanded in y around inf 77.7%
associate-*r/83.7%
Simplified83.7%
Final simplification85.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -0.00047) (not (<= z 6.6e-81))) (* x (/ (- z) t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -0.00047) || !(z <= 6.6e-81)) {
tmp = x * (-z / t);
} else {
tmp = 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 ((z <= (-0.00047d0)) .or. (.not. (z <= 6.6d-81))) then
tmp = x * (-z / t)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -0.00047) || !(z <= 6.6e-81)) {
tmp = x * (-z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -0.00047) or not (z <= 6.6e-81): tmp = x * (-z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -0.00047) || !(z <= 6.6e-81)) tmp = Float64(x * Float64(Float64(-z) / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -0.00047) || ~((z <= 6.6e-81))) tmp = x * (-z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -0.00047], N[Not[LessEqual[z, 6.6e-81]], $MachinePrecision]], N[(x * N[((-z) / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.00047 \lor \neg \left(z \leq 6.6 \cdot 10^{-81}\right):\\
\;\;\;\;x \cdot \frac{-z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -4.69999999999999986e-4 or 6.59999999999999975e-81 < z Initial program 95.5%
Taylor expanded in x around inf 61.2%
mul-1-neg61.2%
unsub-neg61.2%
distribute-lft-out--61.2%
*-rgt-identity61.2%
Simplified61.2%
clear-num61.2%
un-div-inv61.2%
Applied egg-rr61.2%
Taylor expanded in t around 0 45.6%
mul-1-neg45.6%
associate-*r/49.5%
distribute-rgt-neg-out49.5%
distribute-neg-frac49.5%
Simplified49.5%
if -4.69999999999999986e-4 < z < 6.59999999999999975e-81Initial program 97.2%
Taylor expanded in z around 0 66.9%
Final simplification56.9%
(FPCore (x y z t) :precision binary64 (if (<= z -0.00041) (* x (/ (- z) t)) (if (<= z 6.5e-81) x (/ x (/ (- t) z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.00041) {
tmp = x * (-z / t);
} else if (z <= 6.5e-81) {
tmp = x;
} else {
tmp = x / (-t / z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-0.00041d0)) then
tmp = x * (-z / t)
else if (z <= 6.5d-81) then
tmp = x
else
tmp = x / (-t / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.00041) {
tmp = x * (-z / t);
} else if (z <= 6.5e-81) {
tmp = x;
} else {
tmp = x / (-t / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -0.00041: tmp = x * (-z / t) elif z <= 6.5e-81: tmp = x else: tmp = x / (-t / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -0.00041) tmp = Float64(x * Float64(Float64(-z) / t)); elseif (z <= 6.5e-81) tmp = x; else tmp = Float64(x / Float64(Float64(-t) / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -0.00041) tmp = x * (-z / t); elseif (z <= 6.5e-81) tmp = x; else tmp = x / (-t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -0.00041], N[(x * N[((-z) / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.5e-81], x, N[(x / N[((-t) / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.00041:\\
\;\;\;\;x \cdot \frac{-z}{t}\\
\mathbf{elif}\;z \leq 6.5 \cdot 10^{-81}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{-t}{z}}\\
\end{array}
\end{array}
if z < -4.0999999999999999e-4Initial program 97.4%
Taylor expanded in x around inf 59.2%
mul-1-neg59.2%
unsub-neg59.2%
distribute-lft-out--59.2%
*-rgt-identity59.2%
Simplified59.2%
clear-num59.1%
un-div-inv59.1%
Applied egg-rr59.1%
Taylor expanded in t around 0 46.2%
mul-1-neg46.2%
associate-*r/48.7%
distribute-rgt-neg-out48.7%
distribute-neg-frac48.7%
Simplified48.7%
if -4.0999999999999999e-4 < z < 6.5000000000000002e-81Initial program 97.2%
Taylor expanded in z around 0 66.9%
if 6.5000000000000002e-81 < z Initial program 93.4%
Taylor expanded in x around inf 63.4%
mul-1-neg63.4%
unsub-neg63.4%
distribute-lft-out--63.4%
*-rgt-identity63.4%
Simplified63.4%
clear-num63.4%
un-div-inv63.4%
Applied egg-rr63.4%
Taylor expanded in t around 0 44.9%
associate-*r/44.9%
*-commutative44.9%
associate-*l/44.8%
metadata-eval44.8%
distribute-neg-frac44.8%
associate-*r*50.3%
distribute-neg-frac50.3%
metadata-eval50.3%
metadata-eval50.3%
associate-/r*50.3%
neg-mul-150.3%
associate-/r/50.3%
*-commutative50.3%
associate-*r/50.3%
*-rgt-identity50.3%
Simplified50.3%
Final simplification56.9%
(FPCore (x y z t) :precision binary64 (+ x (* z (/ (- y x) t))))
double code(double x, double y, double z, double t) {
return x + (z * ((y - x) / 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 = x + (z * ((y - x) / t))
end function
public static double code(double x, double y, double z, double t) {
return x + (z * ((y - x) / t));
}
def code(x, y, z, t): return x + (z * ((y - x) / t))
function code(x, y, z, t) return Float64(x + Float64(z * Float64(Float64(y - x) / t))) end
function tmp = code(x, y, z, t) tmp = x + (z * ((y - x) / t)); end
code[x_, y_, z_, t_] := N[(x + N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + z \cdot \frac{y - x}{t}
\end{array}
Initial program 96.2%
Taylor expanded in y around 0 89.5%
+-commutative89.5%
mul-1-neg89.5%
sub-neg89.5%
associate-/l*88.4%
associate-/l*90.3%
div-sub96.3%
associate-/r/95.5%
*-commutative95.5%
Simplified95.5%
Final simplification95.5%
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
return x;
}
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
end function
public static double code(double x, double y, double z, double t) {
return x;
}
def code(x, y, z, t): return x
function code(x, y, z, t) return x end
function tmp = code(x, y, z, t) tmp = x; end
code[x_, y_, z_, t_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 96.2%
Taylor expanded in z around 0 36.5%
Final simplification36.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- y x) (/ z t))) (t_2 (+ x (/ (- y x) (/ t z)))))
(if (< t_1 -1013646692435.8867)
t_2
(if (< t_1 0.0) (+ x (/ (* (- y x) z) t)) t_2))))
double code(double x, double y, double z, double t) {
double t_1 = (y - x) * (z / t);
double t_2 = x + ((y - x) / (t / z));
double tmp;
if (t_1 < -1013646692435.8867) {
tmp = t_2;
} else if (t_1 < 0.0) {
tmp = x + (((y - x) * z) / t);
} else {
tmp = 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 = (y - x) * (z / t)
t_2 = x + ((y - x) / (t / z))
if (t_1 < (-1013646692435.8867d0)) then
tmp = t_2
else if (t_1 < 0.0d0) then
tmp = x + (((y - x) * z) / t)
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (y - x) * (z / t);
double t_2 = x + ((y - x) / (t / z));
double tmp;
if (t_1 < -1013646692435.8867) {
tmp = t_2;
} else if (t_1 < 0.0) {
tmp = x + (((y - x) * z) / t);
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y - x) * (z / t) t_2 = x + ((y - x) / (t / z)) tmp = 0 if t_1 < -1013646692435.8867: tmp = t_2 elif t_1 < 0.0: tmp = x + (((y - x) * z) / t) else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y - x) * Float64(z / t)) t_2 = Float64(x + Float64(Float64(y - x) / Float64(t / z))) tmp = 0.0 if (t_1 < -1013646692435.8867) tmp = t_2; elseif (t_1 < 0.0) tmp = Float64(x + Float64(Float64(Float64(y - x) * z) / t)); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y - x) * (z / t); t_2 = x + ((y - x) / (t / z)); tmp = 0.0; if (t_1 < -1013646692435.8867) tmp = t_2; elseif (t_1 < 0.0) tmp = x + (((y - x) * z) / t); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(y - x), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$1, -1013646692435.8867], t$95$2, If[Less[t$95$1, 0.0], N[(x + N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y - x\right) \cdot \frac{z}{t}\\
t_2 := x + \frac{y - x}{\frac{t}{z}}\\
\mathbf{if}\;t_1 < -1013646692435.8867:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_1 < 0:\\
\;\;\;\;x + \frac{\left(y - x\right) \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
herbie shell --seed 2023279
(FPCore (x y z t)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:tickPosition from plot-0.2.3.4"
:precision binary64
:herbie-target
(if (< (* (- y x) (/ z t)) -1013646692435.8867) (+ x (/ (- y x) (/ t z))) (if (< (* (- y x) (/ z t)) 0.0) (+ x (/ (* (- y x) z) t)) (+ x (/ (- y x) (/ t z)))))
(+ x (* (- y x) (/ z t))))