
(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 13 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 (+ 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 98.0%
Taylor expanded in y around 0 90.6%
+-commutative90.6%
mul-1-neg90.6%
sub-neg90.6%
associate-/l*91.4%
associate-/l*93.3%
div-sub98.1%
Simplified98.1%
Final simplification98.1%
(FPCore (x y z t) :precision binary64 (if (<= (/ z t) -2e+220) (/ z (/ t y)) (if (or (<= (/ z t) -2.0) (not (<= (/ z t) 2e-19))) (- (* x (/ z t))) x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z / t) <= -2e+220) {
tmp = z / (t / y);
} else if (((z / t) <= -2.0) || !((z / t) <= 2e-19)) {
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 / t) <= (-2d+220)) then
tmp = z / (t / y)
else if (((z / t) <= (-2.0d0)) .or. (.not. ((z / t) <= 2d-19))) 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 / t) <= -2e+220) {
tmp = z / (t / y);
} else if (((z / t) <= -2.0) || !((z / t) <= 2e-19)) {
tmp = -(x * (z / t));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z / t) <= -2e+220: tmp = z / (t / y) elif ((z / t) <= -2.0) or not ((z / t) <= 2e-19): tmp = -(x * (z / t)) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z / t) <= -2e+220) tmp = Float64(z / Float64(t / y)); elseif ((Float64(z / t) <= -2.0) || !(Float64(z / t) <= 2e-19)) tmp = Float64(-Float64(x * Float64(z / t))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z / t) <= -2e+220) tmp = z / (t / y); elseif (((z / t) <= -2.0) || ~(((z / t) <= 2e-19))) tmp = -(x * (z / t)); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z / t), $MachinePrecision], -2e+220], N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[(z / t), $MachinePrecision], -2.0], N[Not[LessEqual[N[(z / t), $MachinePrecision], 2e-19]], $MachinePrecision]], (-N[(x * N[(z / t), $MachinePrecision]), $MachinePrecision]), x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -2 \cdot 10^{+220}:\\
\;\;\;\;\frac{z}{\frac{t}{y}}\\
\mathbf{elif}\;\frac{z}{t} \leq -2 \lor \neg \left(\frac{z}{t} \leq 2 \cdot 10^{-19}\right):\\
\;\;\;\;-x \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if (/.f64 z t) < -2e220Initial program 93.5%
Taylor expanded in z around inf 96.4%
Taylor expanded in y around inf 83.0%
clear-num83.2%
un-div-inv83.2%
Applied egg-rr83.2%
if -2e220 < (/.f64 z t) < -2 or 2e-19 < (/.f64 z t) Initial program 98.1%
Taylor expanded in x around inf 62.0%
mul-1-neg62.0%
unsub-neg62.0%
Simplified62.0%
Taylor expanded in z around inf 58.6%
neg-mul-158.6%
distribute-neg-frac58.6%
Simplified58.6%
if -2 < (/.f64 z t) < 2e-19Initial program 99.1%
Taylor expanded in z around 0 78.0%
Final simplification70.4%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ z t) -2.0) (not (<= (/ z t) 2e-19))) (/ (* (- y x) z) t) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -2.0) || !((z / t) <= 2e-19)) {
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) <= (-2.0d0)) .or. (.not. ((z / t) <= 2d-19))) 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) <= -2.0) || !((z / t) <= 2e-19)) {
tmp = ((y - x) * z) / t;
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z / t) <= -2.0) or not ((z / t) <= 2e-19): 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) <= -2.0) || !(Float64(z / t) <= 2e-19)) tmp = Float64(Float64(Float64(y - x) * 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) <= -2.0) || ~(((z / t) <= 2e-19))) 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], -2.0], N[Not[LessEqual[N[(z / t), $MachinePrecision], 2e-19]], $MachinePrecision]], N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -2 \lor \neg \left(\frac{z}{t} \leq 2 \cdot 10^{-19}\right):\\
\;\;\;\;\frac{\left(y - x\right) \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if (/.f64 z t) < -2 or 2e-19 < (/.f64 z t) Initial program 97.1%
Taylor expanded in z around inf 86.5%
sub-div88.8%
*-commutative88.8%
associate-*l/90.7%
Applied egg-rr90.7%
if -2 < (/.f64 z t) < 2e-19Initial program 99.1%
Taylor expanded in y around inf 97.6%
associate-*r/99.1%
Simplified99.1%
Final simplification94.6%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ z t) -2.0) (not (<= (/ z t) 2e-19))) (/ (- y x) (/ t z)) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -2.0) || !((z / t) <= 2e-19)) {
tmp = (y - x) / (t / z);
} 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) <= (-2.0d0)) .or. (.not. ((z / t) <= 2d-19))) then
tmp = (y - x) / (t / z)
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) <= -2.0) || !((z / t) <= 2e-19)) {
tmp = (y - x) / (t / z);
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z / t) <= -2.0) or not ((z / t) <= 2e-19): tmp = (y - x) / (t / z) else: tmp = x + (y * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(z / t) <= -2.0) || !(Float64(z / t) <= 2e-19)) tmp = Float64(Float64(y - x) / Float64(t / z)); 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) <= -2.0) || ~(((z / t) <= 2e-19))) tmp = (y - x) / (t / z); else tmp = x + (y * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(z / t), $MachinePrecision], -2.0], N[Not[LessEqual[N[(z / t), $MachinePrecision], 2e-19]], $MachinePrecision]], N[(N[(y - x), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -2 \lor \neg \left(\frac{z}{t} \leq 2 \cdot 10^{-19}\right):\\
\;\;\;\;\frac{y - x}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if (/.f64 z t) < -2 or 2e-19 < (/.f64 z t) Initial program 97.1%
Taylor expanded in z around inf 86.5%
sub-div88.8%
*-commutative88.8%
associate-/r/94.4%
Applied egg-rr94.4%
if -2 < (/.f64 z t) < 2e-19Initial program 99.1%
Taylor expanded in y around inf 97.6%
associate-*r/99.1%
Simplified99.1%
Final simplification96.6%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ z t) -2e-51) (not (<= (/ z t) 1e-45))) (* y (/ z t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -2e-51) || !((z / t) <= 1e-45)) {
tmp = y * (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 / t) <= (-2d-51)) .or. (.not. ((z / t) <= 1d-45))) then
tmp = y * (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 / t) <= -2e-51) || !((z / t) <= 1e-45)) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z / t) <= -2e-51) or not ((z / t) <= 1e-45): tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(z / t) <= -2e-51) || !(Float64(z / t) <= 1e-45)) tmp = Float64(y * Float64(z / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((z / t) <= -2e-51) || ~(((z / t) <= 1e-45))) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(z / t), $MachinePrecision], -2e-51], N[Not[LessEqual[N[(z / t), $MachinePrecision], 1e-45]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -2 \cdot 10^{-51} \lor \neg \left(\frac{z}{t} \leq 10^{-45}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if (/.f64 z t) < -2e-51 or 9.99999999999999984e-46 < (/.f64 z t) Initial program 97.4%
Taylor expanded in z around inf 80.8%
Taylor expanded in y around inf 48.9%
clear-num48.9%
un-div-inv49.5%
Applied egg-rr49.5%
Taylor expanded in z around 0 51.9%
*-commutative51.9%
associate-*l/52.6%
Simplified52.6%
if -2e-51 < (/.f64 z t) < 9.99999999999999984e-46Initial program 99.0%
Taylor expanded in z around 0 83.7%
Final simplification64.9%
(FPCore (x y z t) :precision binary64 (if (<= (/ z t) -2e-51) (/ y (/ t z)) (if (<= (/ z t) 1e-45) x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z / t) <= -2e-51) {
tmp = y / (t / z);
} else if ((z / t) <= 1e-45) {
tmp = x;
} else {
tmp = 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) <= (-2d-51)) then
tmp = y / (t / z)
else if ((z / t) <= 1d-45) then
tmp = x
else
tmp = 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) <= -2e-51) {
tmp = y / (t / z);
} else if ((z / t) <= 1e-45) {
tmp = x;
} else {
tmp = y * (z / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z / t) <= -2e-51: tmp = y / (t / z) elif (z / t) <= 1e-45: tmp = x else: tmp = y * (z / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z / t) <= -2e-51) tmp = Float64(y / Float64(t / z)); elseif (Float64(z / t) <= 1e-45) tmp = x; else tmp = Float64(y * Float64(z / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z / t) <= -2e-51) tmp = y / (t / z); elseif ((z / t) <= 1e-45) tmp = x; else tmp = y * (z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z / t), $MachinePrecision], -2e-51], N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z / t), $MachinePrecision], 1e-45], x, N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -2 \cdot 10^{-51}:\\
\;\;\;\;\frac{y}{\frac{t}{z}}\\
\mathbf{elif}\;\frac{z}{t} \leq 10^{-45}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if (/.f64 z t) < -2e-51Initial program 97.7%
Taylor expanded in z around inf 81.7%
Taylor expanded in y around inf 53.0%
clear-num53.0%
un-div-inv53.1%
Applied egg-rr53.1%
Taylor expanded in z around 0 56.3%
associate-/l*56.2%
Simplified56.2%
if -2e-51 < (/.f64 z t) < 9.99999999999999984e-46Initial program 99.0%
Taylor expanded in z around 0 83.7%
if 9.99999999999999984e-46 < (/.f64 z t) Initial program 97.0%
Taylor expanded in z around inf 79.7%
Taylor expanded in y around inf 43.4%
clear-num43.3%
un-div-inv44.6%
Applied egg-rr44.6%
Taylor expanded in z around 0 45.9%
*-commutative45.9%
associate-*l/47.7%
Simplified47.7%
Final simplification64.9%
(FPCore (x y z t) :precision binary64 (if (<= (/ z t) -2e-51) (/ (* y z) t) (if (<= (/ z t) 1e-45) x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z / t) <= -2e-51) {
tmp = (y * z) / t;
} else if ((z / t) <= 1e-45) {
tmp = x;
} else {
tmp = 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) <= (-2d-51)) then
tmp = (y * z) / t
else if ((z / t) <= 1d-45) then
tmp = x
else
tmp = 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) <= -2e-51) {
tmp = (y * z) / t;
} else if ((z / t) <= 1e-45) {
tmp = x;
} else {
tmp = y * (z / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z / t) <= -2e-51: tmp = (y * z) / t elif (z / t) <= 1e-45: tmp = x else: tmp = y * (z / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z / t) <= -2e-51) tmp = Float64(Float64(y * z) / t); elseif (Float64(z / t) <= 1e-45) tmp = x; else tmp = Float64(y * Float64(z / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z / t) <= -2e-51) tmp = (y * z) / t; elseif ((z / t) <= 1e-45) tmp = x; else tmp = y * (z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z / t), $MachinePrecision], -2e-51], N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[N[(z / t), $MachinePrecision], 1e-45], x, N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -2 \cdot 10^{-51}:\\
\;\;\;\;\frac{y \cdot z}{t}\\
\mathbf{elif}\;\frac{z}{t} \leq 10^{-45}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if (/.f64 z t) < -2e-51Initial program 97.7%
Taylor expanded in z around inf 81.7%
sub-div82.9%
*-commutative82.9%
associate-*l/86.7%
Applied egg-rr86.7%
Taylor expanded in y around inf 56.3%
*-commutative56.3%
Simplified56.3%
if -2e-51 < (/.f64 z t) < 9.99999999999999984e-46Initial program 99.0%
Taylor expanded in z around 0 83.7%
if 9.99999999999999984e-46 < (/.f64 z t) Initial program 97.0%
Taylor expanded in z around inf 79.7%
Taylor expanded in y around inf 43.4%
clear-num43.3%
un-div-inv44.6%
Applied egg-rr44.6%
Taylor expanded in z around 0 45.9%
*-commutative45.9%
associate-*l/47.7%
Simplified47.7%
Final simplification64.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.6e-208) (not (<= x 4.25e-103))) (* x (- 1.0 (/ z t))) (/ (* y z) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.6e-208) || !(x <= 4.25e-103)) {
tmp = x * (1.0 - (z / t));
} else {
tmp = (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 ((x <= (-2.6d-208)) .or. (.not. (x <= 4.25d-103))) then
tmp = x * (1.0d0 - (z / t))
else
tmp = (y * z) / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.6e-208) || !(x <= 4.25e-103)) {
tmp = x * (1.0 - (z / t));
} else {
tmp = (y * z) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.6e-208) or not (x <= 4.25e-103): tmp = x * (1.0 - (z / t)) else: tmp = (y * z) / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.6e-208) || !(x <= 4.25e-103)) tmp = Float64(x * Float64(1.0 - Float64(z / t))); else tmp = Float64(Float64(y * z) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -2.6e-208) || ~((x <= 4.25e-103))) tmp = x * (1.0 - (z / t)); else tmp = (y * z) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.6e-208], N[Not[LessEqual[x, 4.25e-103]], $MachinePrecision]], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.6 \cdot 10^{-208} \lor \neg \left(x \leq 4.25 \cdot 10^{-103}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot z}{t}\\
\end{array}
\end{array}
if x < -2.60000000000000017e-208 or 4.25000000000000016e-103 < x Initial program 99.4%
Taylor expanded in x around inf 80.7%
mul-1-neg80.7%
unsub-neg80.7%
Simplified80.7%
if -2.60000000000000017e-208 < x < 4.25000000000000016e-103Initial program 94.7%
Taylor expanded in z around inf 72.4%
sub-div72.4%
*-commutative72.4%
associate-*l/76.9%
Applied egg-rr76.9%
Taylor expanded in y around inf 72.2%
*-commutative72.2%
Simplified72.2%
Final simplification78.2%
(FPCore (x y z t) :precision binary64 (if (or (<= y -9.5e+25) (not (<= y 9e-113))) (+ x (* y (/ z t))) (* x (- 1.0 (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -9.5e+25) || !(y <= 9e-113)) {
tmp = x + (y * (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 ((y <= (-9.5d+25)) .or. (.not. (y <= 9d-113))) then
tmp = x + (y * (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 ((y <= -9.5e+25) || !(y <= 9e-113)) {
tmp = x + (y * (z / t));
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -9.5e+25) or not (y <= 9e-113): tmp = x + (y * (z / t)) else: tmp = x * (1.0 - (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -9.5e+25) || !(y <= 9e-113)) tmp = Float64(x + Float64(y * 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 ((y <= -9.5e+25) || ~((y <= 9e-113))) tmp = x + (y * (z / t)); else tmp = x * (1.0 - (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -9.5e+25], N[Not[LessEqual[y, 9e-113]], $MachinePrecision]], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.5 \cdot 10^{+25} \lor \neg \left(y \leq 9 \cdot 10^{-113}\right):\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\end{array}
\end{array}
if y < -9.5000000000000005e25 or 9.0000000000000002e-113 < y Initial program 99.1%
Taylor expanded in y around inf 84.0%
associate-*r/87.3%
Simplified87.3%
if -9.5000000000000005e25 < y < 9.0000000000000002e-113Initial program 96.8%
Taylor expanded in x around inf 87.5%
mul-1-neg87.5%
unsub-neg87.5%
Simplified87.5%
Final simplification87.4%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.6e+27) (not (<= y 6.4e-112))) (+ x (* y (/ z t))) (- x (/ x (/ t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.6e+27) || !(y <= 6.4e-112)) {
tmp = x + (y * (z / t));
} else {
tmp = x - (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 ((y <= (-1.6d+27)) .or. (.not. (y <= 6.4d-112))) then
tmp = x + (y * (z / t))
else
tmp = x - (x / (t / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.6e+27) || !(y <= 6.4e-112)) {
tmp = x + (y * (z / t));
} else {
tmp = x - (x / (t / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.6e+27) or not (y <= 6.4e-112): tmp = x + (y * (z / t)) else: tmp = x - (x / (t / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.6e+27) || !(y <= 6.4e-112)) tmp = Float64(x + Float64(y * Float64(z / t))); else tmp = Float64(x - Float64(x / Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.6e+27) || ~((y <= 6.4e-112))) tmp = x + (y * (z / t)); else tmp = x - (x / (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.6e+27], N[Not[LessEqual[y, 6.4e-112]], $MachinePrecision]], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(x / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.6 \cdot 10^{+27} \lor \neg \left(y \leq 6.4 \cdot 10^{-112}\right):\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{x}{\frac{t}{z}}\\
\end{array}
\end{array}
if y < -1.60000000000000008e27 or 6.39999999999999986e-112 < y Initial program 99.1%
Taylor expanded in y around inf 84.0%
associate-*r/87.3%
Simplified87.3%
if -1.60000000000000008e27 < y < 6.39999999999999986e-112Initial program 96.8%
Taylor expanded in y around 0 82.3%
mul-1-neg82.3%
associate-/l*87.6%
Simplified87.6%
unsub-neg87.6%
div-inv87.4%
clear-num87.5%
Applied egg-rr87.5%
clear-num87.4%
un-div-inv87.6%
Applied egg-rr87.6%
Final simplification87.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -9.6e-43) (not (<= z 3.1e+15))) (* z (/ y t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -9.6e-43) || !(z <= 3.1e+15)) {
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 <= (-9.6d-43)) .or. (.not. (z <= 3.1d+15))) 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 <= -9.6e-43) || !(z <= 3.1e+15)) {
tmp = z * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -9.6e-43) or not (z <= 3.1e+15): tmp = z * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -9.6e-43) || !(z <= 3.1e+15)) 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 <= -9.6e-43) || ~((z <= 3.1e+15))) tmp = z * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -9.6e-43], N[Not[LessEqual[z, 3.1e+15]], $MachinePrecision]], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.6 \cdot 10^{-43} \lor \neg \left(z \leq 3.1 \cdot 10^{+15}\right):\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -9.6000000000000007e-43 or 3.1e15 < z Initial program 97.0%
Taylor expanded in z around inf 79.0%
Taylor expanded in y around inf 51.2%
if -9.6000000000000007e-43 < z < 3.1e15Initial program 99.2%
Taylor expanded in z around 0 61.0%
Final simplification55.9%
(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.0%
Final simplification98.0%
(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.0%
Taylor expanded in z around 0 38.0%
Final simplification38.0%
(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 2023318
(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))))