
(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 10 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 (if (<= z 1.25e-171) (+ x (* (- y x) (/ z t))) (+ x (/ z (/ t (- y x))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.25e-171) {
tmp = x + ((y - x) * (z / t));
} else {
tmp = x + (z / (t / (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 (z <= 1.25d-171) then
tmp = x + ((y - x) * (z / t))
else
tmp = x + (z / (t / (y - x)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.25e-171) {
tmp = x + ((y - x) * (z / t));
} else {
tmp = x + (z / (t / (y - x)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= 1.25e-171: tmp = x + ((y - x) * (z / t)) else: tmp = x + (z / (t / (y - x))) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= 1.25e-171) tmp = Float64(x + Float64(Float64(y - x) * Float64(z / t))); else tmp = Float64(x + Float64(z / Float64(t / Float64(y - x)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= 1.25e-171) tmp = x + ((y - x) * (z / t)); else tmp = x + (z / (t / (y - x))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, 1.25e-171], N[(x + N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z / N[(t / N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.25 \cdot 10^{-171}:\\
\;\;\;\;x + \left(y - x\right) \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z}{\frac{t}{y - x}}\\
\end{array}
\end{array}
if z < 1.24999999999999998e-171Initial program 99.2%
if 1.24999999999999998e-171 < z Initial program 93.8%
Taylor expanded in y around 0 86.1%
+-commutative86.1%
mul-1-neg86.1%
unsub-neg86.1%
associate-*r/80.7%
associate-/l*84.7%
distribute-rgt-out--93.8%
associate-*l/92.7%
associate-/l*99.8%
Simplified99.8%
clear-num99.8%
un-div-inv99.9%
Applied egg-rr99.9%
Final simplification99.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5.1e-188) (not (<= z 1.2e-171))) (+ x (* z (/ (- y x) t))) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.1e-188) || !(z <= 1.2e-171)) {
tmp = x + (z * ((y - x) / 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 ((z <= (-5.1d-188)) .or. (.not. (z <= 1.2d-171))) then
tmp = x + (z * ((y - x) / 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 ((z <= -5.1e-188) || !(z <= 1.2e-171)) {
tmp = x + (z * ((y - x) / t));
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5.1e-188) or not (z <= 1.2e-171): tmp = x + (z * ((y - x) / t)) else: tmp = x + (y * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5.1e-188) || !(z <= 1.2e-171)) tmp = Float64(x + Float64(z * Float64(Float64(y - x) / 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 ((z <= -5.1e-188) || ~((z <= 1.2e-171))) tmp = x + (z * ((y - x) / t)); else tmp = x + (y * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5.1e-188], N[Not[LessEqual[z, 1.2e-171]], $MachinePrecision]], N[(x + N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.1 \cdot 10^{-188} \lor \neg \left(z \leq 1.2 \cdot 10^{-171}\right):\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if z < -5.10000000000000009e-188 or 1.19999999999999993e-171 < z Initial program 96.4%
Taylor expanded in y around 0 87.6%
+-commutative87.6%
mul-1-neg87.6%
unsub-neg87.6%
associate-*r/85.4%
associate-/l*90.9%
distribute-rgt-out--96.4%
associate-*l/91.3%
associate-/l*98.8%
Simplified98.8%
if -5.10000000000000009e-188 < z < 1.19999999999999993e-171Initial program 99.9%
Taylor expanded in y around inf 92.8%
associate-*r/94.2%
Simplified94.2%
Final simplification97.6%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2.5e+27) (not (<= y 1.5e-29))) (+ x (* y (/ z t))) (* x (/ (- t z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.5e+27) || !(y <= 1.5e-29)) {
tmp = x + (y * (z / t));
} else {
tmp = x * ((t - 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 <= (-2.5d+27)) .or. (.not. (y <= 1.5d-29))) then
tmp = x + (y * (z / t))
else
tmp = x * ((t - z) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.5e+27) || !(y <= 1.5e-29)) {
tmp = x + (y * (z / t));
} else {
tmp = x * ((t - z) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2.5e+27) or not (y <= 1.5e-29): tmp = x + (y * (z / t)) else: tmp = x * ((t - z) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2.5e+27) || !(y <= 1.5e-29)) tmp = Float64(x + Float64(y * Float64(z / t))); else tmp = Float64(x * Float64(Float64(t - z) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -2.5e+27) || ~((y <= 1.5e-29))) tmp = x + (y * (z / t)); else tmp = x * ((t - z) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2.5e+27], N[Not[LessEqual[y, 1.5e-29]], $MachinePrecision]], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(t - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.5 \cdot 10^{+27} \lor \neg \left(y \leq 1.5 \cdot 10^{-29}\right):\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t - z}{t}\\
\end{array}
\end{array}
if y < -2.4999999999999999e27 or 1.5000000000000001e-29 < y Initial program 99.0%
Taylor expanded in y around inf 88.5%
associate-*r/93.9%
Simplified93.9%
if -2.4999999999999999e27 < y < 1.5000000000000001e-29Initial program 95.5%
Taylor expanded in y around 0 92.0%
+-commutative92.0%
mul-1-neg92.0%
unsub-neg92.0%
associate-*r/85.7%
associate-/l*91.1%
distribute-rgt-out--95.5%
associate-*l/93.6%
associate-/l*96.7%
Simplified96.7%
Taylor expanded in y around 0 86.3%
neg-mul-186.3%
distribute-neg-frac286.3%
Simplified86.3%
associate-*r/84.0%
distribute-frac-neg284.0%
add-sqr-sqrt45.4%
sqrt-unprod58.6%
sqr-neg58.6%
sqrt-unprod20.4%
add-sqr-sqrt47.0%
associate-*r/47.7%
sub-neg47.7%
add-sqr-sqrt22.7%
sqrt-unprod59.8%
sqr-neg59.8%
sqrt-unprod44.6%
add-sqr-sqrt86.3%
Applied egg-rr86.3%
Taylor expanded in t around 0 73.3%
*-commutative73.3%
distribute-rgt-out--73.4%
associate-/l*86.5%
Simplified86.5%
Final simplification90.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -9.2e-22) (not (<= z 5.8e+21))) (* x (/ z (- t))) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -9.2e-22) || !(z <= 5.8e+21)) {
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 <= (-9.2d-22)) .or. (.not. (z <= 5.8d+21))) 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 <= -9.2e-22) || !(z <= 5.8e+21)) {
tmp = x * (z / -t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -9.2e-22) or not (z <= 5.8e+21): tmp = x * (z / -t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -9.2e-22) || !(z <= 5.8e+21)) tmp = Float64(x * Float64(z / Float64(-t))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -9.2e-22) || ~((z <= 5.8e+21))) tmp = x * (z / -t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -9.2e-22], N[Not[LessEqual[z, 5.8e+21]], $MachinePrecision]], N[(x * N[(z / (-t)), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.2 \cdot 10^{-22} \lor \neg \left(z \leq 5.8 \cdot 10^{+21}\right):\\
\;\;\;\;x \cdot \frac{z}{-t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -9.1999999999999992e-22 or 5.8e21 < z Initial program 95.6%
Taylor expanded in y around 0 82.1%
+-commutative82.1%
mul-1-neg82.1%
unsub-neg82.1%
associate-*r/79.7%
associate-/l*87.7%
distribute-rgt-out--95.6%
associate-*l/87.5%
associate-/l*99.0%
Simplified99.0%
Taylor expanded in y around 0 58.7%
neg-mul-158.7%
distribute-neg-frac258.7%
Simplified58.7%
associate-*r/53.5%
distribute-frac-neg253.5%
add-sqr-sqrt30.3%
sqrt-unprod29.8%
sqr-neg29.8%
sqrt-unprod4.0%
add-sqr-sqrt14.9%
associate-*r/17.2%
sub-neg17.2%
add-sqr-sqrt6.9%
sqrt-unprod33.2%
sqr-neg33.2%
sqrt-unprod31.1%
add-sqr-sqrt58.7%
Applied egg-rr58.7%
Taylor expanded in z around inf 42.3%
mul-1-neg42.3%
associate-*r/43.8%
distribute-rgt-neg-in43.8%
distribute-neg-frac243.8%
Simplified43.8%
if -9.1999999999999992e-22 < z < 5.8e21Initial program 99.0%
Taylor expanded in z around 0 66.9%
Final simplification55.1%
(FPCore (x y z t) :precision binary64 (if (<= z -7.2e-25) (* x (/ z (- t))) (if (<= z 1.85e+21) x (/ (* x (- z)) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7.2e-25) {
tmp = x * (z / -t);
} else if (z <= 1.85e+21) {
tmp = x;
} 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) :: tmp
if (z <= (-7.2d-25)) then
tmp = x * (z / -t)
else if (z <= 1.85d+21) then
tmp = x
else
tmp = (x * -z) / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7.2e-25) {
tmp = x * (z / -t);
} else if (z <= 1.85e+21) {
tmp = x;
} else {
tmp = (x * -z) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -7.2e-25: tmp = x * (z / -t) elif z <= 1.85e+21: tmp = x else: tmp = (x * -z) / t return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -7.2e-25) tmp = Float64(x * Float64(z / Float64(-t))); elseif (z <= 1.85e+21) tmp = x; else tmp = Float64(Float64(x * Float64(-z)) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -7.2e-25) tmp = x * (z / -t); elseif (z <= 1.85e+21) tmp = x; else tmp = (x * -z) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -7.2e-25], N[(x * N[(z / (-t)), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.85e+21], x, N[(N[(x * (-z)), $MachinePrecision] / t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.2 \cdot 10^{-25}:\\
\;\;\;\;x \cdot \frac{z}{-t}\\
\mathbf{elif}\;z \leq 1.85 \cdot 10^{+21}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(-z\right)}{t}\\
\end{array}
\end{array}
if z < -7.1999999999999998e-25Initial program 98.5%
Taylor expanded in y around 0 84.3%
+-commutative84.3%
mul-1-neg84.3%
unsub-neg84.3%
associate-*r/85.6%
associate-/l*95.4%
distribute-rgt-out--98.5%
associate-*l/85.8%
associate-/l*98.4%
Simplified98.4%
Taylor expanded in y around 0 63.3%
neg-mul-163.3%
distribute-neg-frac263.3%
Simplified63.3%
associate-*r/56.1%
distribute-frac-neg256.1%
add-sqr-sqrt33.4%
sqrt-unprod29.9%
sqr-neg29.9%
sqrt-unprod2.4%
add-sqr-sqrt11.0%
associate-*r/15.1%
sub-neg15.1%
add-sqr-sqrt6.6%
sqrt-unprod34.7%
sqr-neg34.7%
sqrt-unprod34.8%
add-sqr-sqrt63.3%
Applied egg-rr63.3%
Taylor expanded in z around inf 46.3%
mul-1-neg46.3%
associate-*r/52.2%
distribute-rgt-neg-in52.2%
distribute-neg-frac252.2%
Simplified52.2%
if -7.1999999999999998e-25 < z < 1.85e21Initial program 99.0%
Taylor expanded in z around 0 66.9%
if 1.85e21 < z Initial program 92.5%
Taylor expanded in x around inf 49.3%
mul-1-neg49.3%
unsub-neg49.3%
Simplified49.3%
Taylor expanded in t around 0 50.5%
+-commutative50.5%
mul-1-neg50.5%
*-commutative50.5%
distribute-lft-neg-in50.5%
distribute-rgt-out50.6%
Simplified50.6%
Taylor expanded in t around 0 37.9%
mul-1-neg37.9%
distribute-lft-neg-out37.9%
*-commutative37.9%
Simplified37.9%
Final simplification56.0%
(FPCore (x y z t) :precision binary64 (if (<= z 1.25e-171) (+ x (* (- y x) (/ z t))) (+ x (* z (/ (- y x) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.25e-171) {
tmp = x + ((y - x) * (z / t));
} 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) :: tmp
if (z <= 1.25d-171) then
tmp = x + ((y - x) * (z / t))
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 tmp;
if (z <= 1.25e-171) {
tmp = x + ((y - x) * (z / t));
} else {
tmp = x + (z * ((y - x) / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= 1.25e-171: tmp = x + ((y - x) * (z / t)) else: tmp = x + (z * ((y - x) / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= 1.25e-171) tmp = Float64(x + Float64(Float64(y - x) * Float64(z / t))); else tmp = Float64(x + Float64(z * Float64(Float64(y - x) / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= 1.25e-171) tmp = x + ((y - x) * (z / t)); else tmp = x + (z * ((y - x) / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, 1.25e-171], N[(x + N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.25 \cdot 10^{-171}:\\
\;\;\;\;x + \left(y - x\right) \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\
\end{array}
\end{array}
if z < 1.24999999999999998e-171Initial program 99.2%
if 1.24999999999999998e-171 < z Initial program 93.8%
Taylor expanded in y around 0 86.1%
+-commutative86.1%
mul-1-neg86.1%
unsub-neg86.1%
associate-*r/80.7%
associate-/l*84.7%
distribute-rgt-out--93.8%
associate-*l/92.7%
associate-/l*99.8%
Simplified99.8%
Final simplification99.5%
(FPCore (x y z t) :precision binary64 (+ x (/ (- y x) (/ t z))))
double code(double x, double y, double z, double t) {
return x + ((y - x) / (t / z));
}
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) / (t / z))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - x) / (t / z));
}
def code(x, y, z, t): return x + ((y - x) / (t / z))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - x) / Float64(t / z))) end
function tmp = code(x, y, z, t) tmp = x + ((y - x) / (t / z)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - x), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y - x}{\frac{t}{z}}
\end{array}
Initial program 97.3%
clear-num96.9%
un-div-inv97.9%
Applied egg-rr97.9%
Final simplification97.9%
(FPCore (x y z t) :precision binary64 (* x (- 1.0 (/ z t))))
double code(double x, double y, double z, double t) {
return x * (1.0 - (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 * (1.0d0 - (z / t))
end function
public static double code(double x, double y, double z, double t) {
return x * (1.0 - (z / t));
}
def code(x, y, z, t): return x * (1.0 - (z / t))
function code(x, y, z, t) return Float64(x * Float64(1.0 - Float64(z / t))) end
function tmp = code(x, y, z, t) tmp = x * (1.0 - (z / t)); end
code[x_, y_, z_, t_] := N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(1 - \frac{z}{t}\right)
\end{array}
Initial program 97.3%
Taylor expanded in x around inf 66.3%
mul-1-neg66.3%
unsub-neg66.3%
Simplified66.3%
Final simplification66.3%
(FPCore (x y z t) :precision binary64 (* x (/ (- t z) t)))
double code(double x, double y, double z, double t) {
return x * ((t - 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 * ((t - z) / t)
end function
public static double code(double x, double y, double z, double t) {
return x * ((t - z) / t);
}
def code(x, y, z, t): return x * ((t - z) / t)
function code(x, y, z, t) return Float64(x * Float64(Float64(t - z) / t)) end
function tmp = code(x, y, z, t) tmp = x * ((t - z) / t); end
code[x_, y_, z_, t_] := N[(x * N[(N[(t - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \frac{t - z}{t}
\end{array}
Initial program 97.3%
Taylor expanded in y around 0 90.5%
+-commutative90.5%
mul-1-neg90.5%
unsub-neg90.5%
associate-*r/89.2%
associate-/l*93.3%
distribute-rgt-out--97.3%
associate-*l/93.2%
associate-/l*93.3%
Simplified93.3%
Taylor expanded in y around 0 63.7%
neg-mul-163.7%
distribute-neg-frac263.7%
Simplified63.7%
associate-*r/63.6%
distribute-frac-neg263.6%
add-sqr-sqrt32.1%
sqrt-unprod48.6%
sqr-neg48.6%
sqrt-unprod19.7%
add-sqr-sqrt40.4%
associate-*r/39.6%
sub-neg39.6%
add-sqr-sqrt20.4%
sqrt-unprod48.5%
sqr-neg48.5%
sqrt-unprod31.4%
add-sqr-sqrt63.7%
Applied egg-rr63.7%
Taylor expanded in t around 0 54.7%
*-commutative54.7%
distribute-rgt-out--55.2%
associate-/l*66.4%
Simplified66.4%
Final simplification66.4%
(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 97.3%
Taylor expanded in z around 0 41.4%
Final simplification41.4%
(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 2024079
(FPCore (x y z t)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:tickPosition from plot-0.2.3.4"
:precision binary64
:alt
(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))))