
(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 (fma (- y x) (/ z t) x))
double code(double x, double y, double z, double t) {
return fma((y - x), (z / t), x);
}
function code(x, y, z, t) return fma(Float64(y - x), Float64(z / t), x) end
code[x_, y_, z_, t_] := N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y - x, \frac{z}{t}, x\right)
\end{array}
Initial program 98.6%
+-commutative98.6%
fma-def98.6%
Simplified98.6%
Final simplification98.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ y (/ t z))) (t_2 (* z (/ (- x) t))))
(if (<= z -2.9e+181)
t_1
(if (<= z -6.5e+149)
t_2
(if (<= z -1.5e+29)
(* z (/ y t))
(if (<= z 6.8e-20)
x
(if (<= z 4.8e+76)
t_1
(if (<= z 2.15e+99)
x
(if (or (<= z 6e+220) (not (<= z 2.8e+272))) t_1 t_2)))))))))
double code(double x, double y, double z, double t) {
double t_1 = y / (t / z);
double t_2 = z * (-x / t);
double tmp;
if (z <= -2.9e+181) {
tmp = t_1;
} else if (z <= -6.5e+149) {
tmp = t_2;
} else if (z <= -1.5e+29) {
tmp = z * (y / t);
} else if (z <= 6.8e-20) {
tmp = x;
} else if (z <= 4.8e+76) {
tmp = t_1;
} else if (z <= 2.15e+99) {
tmp = x;
} else if ((z <= 6e+220) || !(z <= 2.8e+272)) {
tmp = t_1;
} 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 / (t / z)
t_2 = z * (-x / t)
if (z <= (-2.9d+181)) then
tmp = t_1
else if (z <= (-6.5d+149)) then
tmp = t_2
else if (z <= (-1.5d+29)) then
tmp = z * (y / t)
else if (z <= 6.8d-20) then
tmp = x
else if (z <= 4.8d+76) then
tmp = t_1
else if (z <= 2.15d+99) then
tmp = x
else if ((z <= 6d+220) .or. (.not. (z <= 2.8d+272))) then
tmp = t_1
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 / (t / z);
double t_2 = z * (-x / t);
double tmp;
if (z <= -2.9e+181) {
tmp = t_1;
} else if (z <= -6.5e+149) {
tmp = t_2;
} else if (z <= -1.5e+29) {
tmp = z * (y / t);
} else if (z <= 6.8e-20) {
tmp = x;
} else if (z <= 4.8e+76) {
tmp = t_1;
} else if (z <= 2.15e+99) {
tmp = x;
} else if ((z <= 6e+220) || !(z <= 2.8e+272)) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = y / (t / z) t_2 = z * (-x / t) tmp = 0 if z <= -2.9e+181: tmp = t_1 elif z <= -6.5e+149: tmp = t_2 elif z <= -1.5e+29: tmp = z * (y / t) elif z <= 6.8e-20: tmp = x elif z <= 4.8e+76: tmp = t_1 elif z <= 2.15e+99: tmp = x elif (z <= 6e+220) or not (z <= 2.8e+272): tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(y / Float64(t / z)) t_2 = Float64(z * Float64(Float64(-x) / t)) tmp = 0.0 if (z <= -2.9e+181) tmp = t_1; elseif (z <= -6.5e+149) tmp = t_2; elseif (z <= -1.5e+29) tmp = Float64(z * Float64(y / t)); elseif (z <= 6.8e-20) tmp = x; elseif (z <= 4.8e+76) tmp = t_1; elseif (z <= 2.15e+99) tmp = x; elseif ((z <= 6e+220) || !(z <= 2.8e+272)) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y / (t / z); t_2 = z * (-x / t); tmp = 0.0; if (z <= -2.9e+181) tmp = t_1; elseif (z <= -6.5e+149) tmp = t_2; elseif (z <= -1.5e+29) tmp = z * (y / t); elseif (z <= 6.8e-20) tmp = x; elseif (z <= 4.8e+76) tmp = t_1; elseif (z <= 2.15e+99) tmp = x; elseif ((z <= 6e+220) || ~((z <= 2.8e+272))) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(z * N[((-x) / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.9e+181], t$95$1, If[LessEqual[z, -6.5e+149], t$95$2, If[LessEqual[z, -1.5e+29], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.8e-20], x, If[LessEqual[z, 4.8e+76], t$95$1, If[LessEqual[z, 2.15e+99], x, If[Or[LessEqual[z, 6e+220], N[Not[LessEqual[z, 2.8e+272]], $MachinePrecision]], t$95$1, t$95$2]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{\frac{t}{z}}\\
t_2 := z \cdot \frac{-x}{t}\\
\mathbf{if}\;z \leq -2.9 \cdot 10^{+181}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -6.5 \cdot 10^{+149}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq -1.5 \cdot 10^{+29}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{elif}\;z \leq 6.8 \cdot 10^{-20}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{+76}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 2.15 \cdot 10^{+99}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 6 \cdot 10^{+220} \lor \neg \left(z \leq 2.8 \cdot 10^{+272}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if z < -2.9e181 or 6.7999999999999994e-20 < z < 4.8e76 or 2.1500000000000001e99 < z < 6.00000000000000048e220 or 2.7999999999999999e272 < z Initial program 98.8%
clear-num98.8%
un-div-inv98.8%
Applied egg-rr98.8%
Taylor expanded in t around 0 88.0%
Taylor expanded in t around 0 79.1%
Taylor expanded in y around inf 58.2%
associate-/l*68.8%
Simplified68.8%
if -2.9e181 < z < -6.50000000000000015e149 or 6.00000000000000048e220 < z < 2.7999999999999999e272Initial program 95.0%
clear-num95.0%
un-div-inv95.1%
Applied egg-rr95.1%
Taylor expanded in t around 0 90.1%
Taylor expanded in t around 0 90.1%
Taylor expanded in y around 0 79.6%
mul-1-neg79.6%
associate-*r/88.6%
distribute-rgt-neg-out88.6%
distribute-neg-frac88.6%
Simplified88.6%
if -6.50000000000000015e149 < z < -1.5e29Initial program 99.8%
clear-num99.8%
un-div-inv99.7%
Applied egg-rr99.7%
Taylor expanded in t around 0 86.1%
Taylor expanded in t around 0 86.1%
Taylor expanded in y around inf 72.0%
associate-*l/85.8%
*-commutative85.8%
Simplified85.8%
if -1.5e29 < z < 6.7999999999999994e-20 or 4.8e76 < z < 2.1500000000000001e99Initial program 98.8%
Taylor expanded in z around 0 64.4%
Final simplification68.9%
(FPCore (x y z t)
:precision binary64
(if (or (<= x -1.75e+44)
(and (not (<= x -5e-6)) (or (<= x -1.9e-95) (not (<= x 4.6e-89)))))
(* x (- 1.0 (/ z t)))
(/ y (/ t z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.75e+44) || (!(x <= -5e-6) && ((x <= -1.9e-95) || !(x <= 4.6e-89)))) {
tmp = x * (1.0 - (z / t));
} else {
tmp = y / (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 ((x <= (-1.75d+44)) .or. (.not. (x <= (-5d-6))) .and. (x <= (-1.9d-95)) .or. (.not. (x <= 4.6d-89))) then
tmp = x * (1.0d0 - (z / t))
else
tmp = y / (t / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.75e+44) || (!(x <= -5e-6) && ((x <= -1.9e-95) || !(x <= 4.6e-89)))) {
tmp = x * (1.0 - (z / t));
} else {
tmp = y / (t / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.75e+44) or (not (x <= -5e-6) and ((x <= -1.9e-95) or not (x <= 4.6e-89))): tmp = x * (1.0 - (z / t)) else: tmp = y / (t / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.75e+44) || (!(x <= -5e-6) && ((x <= -1.9e-95) || !(x <= 4.6e-89)))) tmp = Float64(x * Float64(1.0 - Float64(z / t))); else tmp = Float64(y / Float64(t / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.75e+44) || (~((x <= -5e-6)) && ((x <= -1.9e-95) || ~((x <= 4.6e-89))))) tmp = x * (1.0 - (z / t)); else tmp = y / (t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.75e+44], And[N[Not[LessEqual[x, -5e-6]], $MachinePrecision], Or[LessEqual[x, -1.9e-95], N[Not[LessEqual[x, 4.6e-89]], $MachinePrecision]]]], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.75 \cdot 10^{+44} \lor \neg \left(x \leq -5 \cdot 10^{-6}\right) \land \left(x \leq -1.9 \cdot 10^{-95} \lor \neg \left(x \leq 4.6 \cdot 10^{-89}\right)\right):\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{t}{z}}\\
\end{array}
\end{array}
if x < -1.75e44 or -5.00000000000000041e-6 < x < -1.8999999999999999e-95 or 4.6e-89 < x Initial program 99.9%
Taylor expanded in x around inf 86.7%
*-commutative86.7%
mul-1-neg86.7%
unsub-neg86.7%
distribute-lft-out--86.7%
*-rgt-identity86.7%
Simplified86.7%
Taylor expanded in x around 0 86.7%
if -1.75e44 < x < -5.00000000000000041e-6 or -1.8999999999999999e-95 < x < 4.6e-89Initial program 96.2%
clear-num96.1%
un-div-inv96.2%
Applied egg-rr96.2%
Taylor expanded in t around 0 92.8%
Taylor expanded in t around 0 71.8%
Taylor expanded in y around inf 66.3%
associate-/l*72.4%
Simplified72.4%
Final simplification81.5%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ z t) -5e+28) (not (<= (/ z t) 2e-19))) (* (- y x) (/ z t)) (* x (- 1.0 (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -5e+28) || !((z / t) <= 2e-19)) {
tmp = (y - x) * (z / t);
} else {
tmp = x * (1.0 - (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 / t) <= (-5d+28)) .or. (.not. ((z / t) <= 2d-19))) then
tmp = (y - x) * (z / t)
else
tmp = x * (1.0d0 - (z / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -5e+28) || !((z / t) <= 2e-19)) {
tmp = (y - x) * (z / t);
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z / t) <= -5e+28) or not ((z / t) <= 2e-19): tmp = (y - x) * (z / t) else: tmp = x * (1.0 - (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(z / t) <= -5e+28) || !(Float64(z / t) <= 2e-19)) tmp = Float64(Float64(y - x) * Float64(z / t)); else tmp = Float64(x * Float64(1.0 - Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((z / t) <= -5e+28) || ~(((z / t) <= 2e-19))) tmp = (y - x) * (z / t); else tmp = x * (1.0 - (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(z / t), $MachinePrecision], -5e+28], N[Not[LessEqual[N[(z / t), $MachinePrecision], 2e-19]], $MachinePrecision]], N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -5 \cdot 10^{+28} \lor \neg \left(\frac{z}{t} \leq 2 \cdot 10^{-19}\right):\\
\;\;\;\;\left(y - x\right) \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\end{array}
\end{array}
if (/.f64 z t) < -4.99999999999999957e28 or 2e-19 < (/.f64 z t) Initial program 98.4%
clear-num98.3%
un-div-inv98.4%
Applied egg-rr98.4%
Taylor expanded in t around 0 94.0%
Taylor expanded in t around 0 93.4%
Taylor expanded in y around 0 83.4%
associate-*l/81.2%
*-commutative81.2%
neg-mul-181.2%
distribute-lft-neg-in81.2%
associate-*r/82.7%
distribute-rgt-out97.4%
+-commutative97.4%
sub-neg97.4%
*-commutative97.4%
Simplified97.4%
if -4.99999999999999957e28 < (/.f64 z t) < 2e-19Initial program 98.7%
Taylor expanded in x around inf 80.5%
*-commutative80.5%
mul-1-neg80.5%
unsub-neg80.5%
distribute-lft-out--80.5%
*-rgt-identity80.5%
Simplified80.5%
Taylor expanded in x around 0 80.5%
Final simplification89.0%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ z t) -20.0) (not (<= (/ z t) 5e-8))) (* (- y x) (/ z t)) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -20.0) || !((z / t) <= 5e-8)) {
tmp = (y - 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 (((z / t) <= (-20.0d0)) .or. (.not. ((z / t) <= 5d-8))) then
tmp = (y - 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 (((z / t) <= -20.0) || !((z / t) <= 5e-8)) {
tmp = (y - x) * (z / t);
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z / t) <= -20.0) or not ((z / t) <= 5e-8): tmp = (y - x) * (z / t) else: tmp = x + (y * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(z / t) <= -20.0) || !(Float64(z / t) <= 5e-8)) tmp = Float64(Float64(y - 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 (((z / t) <= -20.0) || ~(((z / t) <= 5e-8))) tmp = (y - x) * (z / t); else tmp = x + (y * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(z / t), $MachinePrecision], -20.0], N[Not[LessEqual[N[(z / t), $MachinePrecision], 5e-8]], $MachinePrecision]], N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -20 \lor \neg \left(\frac{z}{t} \leq 5 \cdot 10^{-8}\right):\\
\;\;\;\;\left(y - x\right) \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if (/.f64 z t) < -20 or 4.9999999999999998e-8 < (/.f64 z t) Initial program 98.4%
clear-num98.3%
un-div-inv98.4%
Applied egg-rr98.4%
Taylor expanded in t around 0 93.4%
Taylor expanded in t around 0 91.8%
Taylor expanded in y around 0 81.9%
associate-*l/79.9%
*-commutative79.9%
neg-mul-179.9%
distribute-lft-neg-in79.9%
associate-*r/81.4%
distribute-rgt-out95.9%
+-commutative95.9%
sub-neg95.9%
*-commutative95.9%
Simplified95.9%
if -20 < (/.f64 z t) < 4.9999999999999998e-8Initial program 98.8%
Taylor expanded in y around inf 95.7%
associate-*r/97.5%
Simplified97.5%
Final simplification96.7%
(FPCore (x y z t)
:precision binary64
(if (or (<= z -6e+28)
(and (not (<= z 4.7e-20)) (or (<= z 1.75e+76) (not (<= z 1.95e+99)))))
(* z (/ y t))
x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6e+28) || (!(z <= 4.7e-20) && ((z <= 1.75e+76) || !(z <= 1.95e+99)))) {
tmp = z * (y / 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 <= (-6d+28)) .or. (.not. (z <= 4.7d-20)) .and. (z <= 1.75d+76) .or. (.not. (z <= 1.95d+99))) then
tmp = z * (y / 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 <= -6e+28) || (!(z <= 4.7e-20) && ((z <= 1.75e+76) || !(z <= 1.95e+99)))) {
tmp = z * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -6e+28) or (not (z <= 4.7e-20) and ((z <= 1.75e+76) or not (z <= 1.95e+99))): tmp = z * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -6e+28) || (!(z <= 4.7e-20) && ((z <= 1.75e+76) || !(z <= 1.95e+99)))) tmp = Float64(z * Float64(y / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -6e+28) || (~((z <= 4.7e-20)) && ((z <= 1.75e+76) || ~((z <= 1.95e+99))))) tmp = z * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -6e+28], And[N[Not[LessEqual[z, 4.7e-20]], $MachinePrecision], Or[LessEqual[z, 1.75e+76], N[Not[LessEqual[z, 1.95e+99]], $MachinePrecision]]]], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6 \cdot 10^{+28} \lor \neg \left(z \leq 4.7 \cdot 10^{-20}\right) \land \left(z \leq 1.75 \cdot 10^{+76} \lor \neg \left(z \leq 1.95 \cdot 10^{+99}\right)\right):\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -6.0000000000000002e28 or 4.70000000000000015e-20 < z < 1.75e76 or 1.94999999999999997e99 < z Initial program 98.4%
clear-num98.3%
un-div-inv98.3%
Applied egg-rr98.3%
Taylor expanded in t around 0 88.1%
Taylor expanded in t around 0 81.6%
Taylor expanded in y around inf 56.7%
associate-*l/61.5%
*-commutative61.5%
Simplified61.5%
if -6.0000000000000002e28 < z < 4.70000000000000015e-20 or 1.75e76 < z < 1.94999999999999997e99Initial program 98.8%
Taylor expanded in z around 0 64.4%
Final simplification63.0%
(FPCore (x y z t)
:precision binary64
(if (or (<= z -4.8e+28)
(and (not (<= z 2.3e-19)) (or (<= z 4.8e+76) (not (<= z 2.15e+99)))))
(/ y (/ t z))
x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.8e+28) || (!(z <= 2.3e-19) && ((z <= 4.8e+76) || !(z <= 2.15e+99)))) {
tmp = y / (t / z);
} 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 <= (-4.8d+28)) .or. (.not. (z <= 2.3d-19)) .and. (z <= 4.8d+76) .or. (.not. (z <= 2.15d+99))) then
tmp = y / (t / z)
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 <= -4.8e+28) || (!(z <= 2.3e-19) && ((z <= 4.8e+76) || !(z <= 2.15e+99)))) {
tmp = y / (t / z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4.8e+28) or (not (z <= 2.3e-19) and ((z <= 4.8e+76) or not (z <= 2.15e+99))): tmp = y / (t / z) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4.8e+28) || (!(z <= 2.3e-19) && ((z <= 4.8e+76) || !(z <= 2.15e+99)))) tmp = Float64(y / Float64(t / z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -4.8e+28) || (~((z <= 2.3e-19)) && ((z <= 4.8e+76) || ~((z <= 2.15e+99))))) tmp = y / (t / z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4.8e+28], And[N[Not[LessEqual[z, 2.3e-19]], $MachinePrecision], Or[LessEqual[z, 4.8e+76], N[Not[LessEqual[z, 2.15e+99]], $MachinePrecision]]]], N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.8 \cdot 10^{+28} \lor \neg \left(z \leq 2.3 \cdot 10^{-19}\right) \land \left(z \leq 4.8 \cdot 10^{+76} \lor \neg \left(z \leq 2.15 \cdot 10^{+99}\right)\right):\\
\;\;\;\;\frac{y}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -4.79999999999999962e28 or 2.2999999999999998e-19 < z < 4.8e76 or 2.1500000000000001e99 < z Initial program 98.4%
clear-num98.3%
un-div-inv98.3%
Applied egg-rr98.3%
Taylor expanded in t around 0 88.1%
Taylor expanded in t around 0 81.6%
Taylor expanded in y around inf 56.7%
associate-/l*66.0%
Simplified66.0%
if -4.79999999999999962e28 < z < 2.2999999999999998e-19 or 4.8e76 < z < 2.1500000000000001e99Initial program 98.8%
Taylor expanded in z around 0 64.4%
Final simplification65.2%
(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}
Initial program 98.6%
Final simplification98.6%
(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 98.6%
Taylor expanded in z around 0 39.2%
Final simplification39.2%
(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 2023240
(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))))