
(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 11 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.6%
Taylor expanded in y around 0 86.3%
+-commutative86.3%
mul-1-neg86.3%
sub-neg86.3%
associate-/l*85.6%
associate-/l*91.1%
div-sub98.6%
Simplified98.6%
Final simplification98.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ x t) (- z))) (t_2 (* y (/ z t))))
(if (<= (/ z t) -1e+278)
t_1
(if (<= (/ z t) -1e+183)
(/ (* y z) t)
(if (<= (/ z t) -1e+104)
t_1
(if (<= (/ z t) -1e-22)
t_2
(if (<= (/ z t) 4e-9) x (if (<= (/ z t) 2e+55) t_2 t_1))))))))
double code(double x, double y, double z, double t) {
double t_1 = (x / t) * -z;
double t_2 = y * (z / t);
double tmp;
if ((z / t) <= -1e+278) {
tmp = t_1;
} else if ((z / t) <= -1e+183) {
tmp = (y * z) / t;
} else if ((z / t) <= -1e+104) {
tmp = t_1;
} else if ((z / t) <= -1e-22) {
tmp = t_2;
} else if ((z / t) <= 4e-9) {
tmp = x;
} else if ((z / t) <= 2e+55) {
tmp = t_2;
} else {
tmp = t_1;
}
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 / t) * -z
t_2 = y * (z / t)
if ((z / t) <= (-1d+278)) then
tmp = t_1
else if ((z / t) <= (-1d+183)) then
tmp = (y * z) / t
else if ((z / t) <= (-1d+104)) then
tmp = t_1
else if ((z / t) <= (-1d-22)) then
tmp = t_2
else if ((z / t) <= 4d-9) then
tmp = x
else if ((z / t) <= 2d+55) then
tmp = t_2
else
tmp = t_1
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 t_2 = y * (z / t);
double tmp;
if ((z / t) <= -1e+278) {
tmp = t_1;
} else if ((z / t) <= -1e+183) {
tmp = (y * z) / t;
} else if ((z / t) <= -1e+104) {
tmp = t_1;
} else if ((z / t) <= -1e-22) {
tmp = t_2;
} else if ((z / t) <= 4e-9) {
tmp = x;
} else if ((z / t) <= 2e+55) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / t) * -z t_2 = y * (z / t) tmp = 0 if (z / t) <= -1e+278: tmp = t_1 elif (z / t) <= -1e+183: tmp = (y * z) / t elif (z / t) <= -1e+104: tmp = t_1 elif (z / t) <= -1e-22: tmp = t_2 elif (z / t) <= 4e-9: tmp = x elif (z / t) <= 2e+55: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / t) * Float64(-z)) t_2 = Float64(y * Float64(z / t)) tmp = 0.0 if (Float64(z / t) <= -1e+278) tmp = t_1; elseif (Float64(z / t) <= -1e+183) tmp = Float64(Float64(y * z) / t); elseif (Float64(z / t) <= -1e+104) tmp = t_1; elseif (Float64(z / t) <= -1e-22) tmp = t_2; elseif (Float64(z / t) <= 4e-9) tmp = x; elseif (Float64(z / t) <= 2e+55) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / t) * -z; t_2 = y * (z / t); tmp = 0.0; if ((z / t) <= -1e+278) tmp = t_1; elseif ((z / t) <= -1e+183) tmp = (y * z) / t; elseif ((z / t) <= -1e+104) tmp = t_1; elseif ((z / t) <= -1e-22) tmp = t_2; elseif ((z / t) <= 4e-9) tmp = x; elseif ((z / t) <= 2e+55) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / t), $MachinePrecision] * (-z)), $MachinePrecision]}, Block[{t$95$2 = N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z / t), $MachinePrecision], -1e+278], t$95$1, If[LessEqual[N[(z / t), $MachinePrecision], -1e+183], N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[N[(z / t), $MachinePrecision], -1e+104], t$95$1, If[LessEqual[N[(z / t), $MachinePrecision], -1e-22], t$95$2, If[LessEqual[N[(z / t), $MachinePrecision], 4e-9], x, If[LessEqual[N[(z / t), $MachinePrecision], 2e+55], t$95$2, t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{t} \cdot \left(-z\right)\\
t_2 := y \cdot \frac{z}{t}\\
\mathbf{if}\;\frac{z}{t} \leq -1 \cdot 10^{+278}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{z}{t} \leq -1 \cdot 10^{+183}:\\
\;\;\;\;\frac{y \cdot z}{t}\\
\mathbf{elif}\;\frac{z}{t} \leq -1 \cdot 10^{+104}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{z}{t} \leq -1 \cdot 10^{-22}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\frac{z}{t} \leq 4 \cdot 10^{-9}:\\
\;\;\;\;x\\
\mathbf{elif}\;\frac{z}{t} \leq 2 \cdot 10^{+55}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (/.f64 z t) < -9.99999999999999964e277 or -9.99999999999999947e182 < (/.f64 z t) < -1e104 or 2.00000000000000002e55 < (/.f64 z t) Initial program 97.3%
Taylor expanded in z around inf 92.2%
Taylor expanded in y around 0 75.3%
neg-mul-175.3%
distribute-neg-frac75.3%
Simplified75.3%
if -9.99999999999999964e277 < (/.f64 z t) < -9.99999999999999947e182Initial program 99.6%
Taylor expanded in z around inf 99.7%
Taylor expanded in y around inf 77.4%
associate-*r/77.6%
Applied egg-rr77.6%
if -1e104 < (/.f64 z t) < -1e-22 or 4.00000000000000025e-9 < (/.f64 z t) < 2.00000000000000002e55Initial program 99.6%
Taylor expanded in z around inf 68.6%
Taylor expanded in y around inf 53.7%
Taylor expanded in z around 0 56.6%
associate-*r/68.3%
Simplified68.3%
if -1e-22 < (/.f64 z t) < 4.00000000000000025e-9Initial program 98.9%
Taylor expanded in z around 0 81.6%
Final simplification77.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ x t) (- z))) (t_2 (* y (/ z t))))
(if (<= (/ z t) -1e+278)
t_1
(if (<= (/ z t) -1e+183)
(/ (* y z) t)
(if (<= (/ z t) -1e+104)
(/ (* x (- z)) t)
(if (<= (/ z t) -1e-22)
t_2
(if (<= (/ z t) 4e-9) x (if (<= (/ z t) 2e+55) t_2 t_1))))))))
double code(double x, double y, double z, double t) {
double t_1 = (x / t) * -z;
double t_2 = y * (z / t);
double tmp;
if ((z / t) <= -1e+278) {
tmp = t_1;
} else if ((z / t) <= -1e+183) {
tmp = (y * z) / t;
} else if ((z / t) <= -1e+104) {
tmp = (x * -z) / t;
} else if ((z / t) <= -1e-22) {
tmp = t_2;
} else if ((z / t) <= 4e-9) {
tmp = x;
} else if ((z / t) <= 2e+55) {
tmp = t_2;
} else {
tmp = t_1;
}
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 / t) * -z
t_2 = y * (z / t)
if ((z / t) <= (-1d+278)) then
tmp = t_1
else if ((z / t) <= (-1d+183)) then
tmp = (y * z) / t
else if ((z / t) <= (-1d+104)) then
tmp = (x * -z) / t
else if ((z / t) <= (-1d-22)) then
tmp = t_2
else if ((z / t) <= 4d-9) then
tmp = x
else if ((z / t) <= 2d+55) then
tmp = t_2
else
tmp = t_1
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 t_2 = y * (z / t);
double tmp;
if ((z / t) <= -1e+278) {
tmp = t_1;
} else if ((z / t) <= -1e+183) {
tmp = (y * z) / t;
} else if ((z / t) <= -1e+104) {
tmp = (x * -z) / t;
} else if ((z / t) <= -1e-22) {
tmp = t_2;
} else if ((z / t) <= 4e-9) {
tmp = x;
} else if ((z / t) <= 2e+55) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / t) * -z t_2 = y * (z / t) tmp = 0 if (z / t) <= -1e+278: tmp = t_1 elif (z / t) <= -1e+183: tmp = (y * z) / t elif (z / t) <= -1e+104: tmp = (x * -z) / t elif (z / t) <= -1e-22: tmp = t_2 elif (z / t) <= 4e-9: tmp = x elif (z / t) <= 2e+55: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / t) * Float64(-z)) t_2 = Float64(y * Float64(z / t)) tmp = 0.0 if (Float64(z / t) <= -1e+278) tmp = t_1; elseif (Float64(z / t) <= -1e+183) tmp = Float64(Float64(y * z) / t); elseif (Float64(z / t) <= -1e+104) tmp = Float64(Float64(x * Float64(-z)) / t); elseif (Float64(z / t) <= -1e-22) tmp = t_2; elseif (Float64(z / t) <= 4e-9) tmp = x; elseif (Float64(z / t) <= 2e+55) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / t) * -z; t_2 = y * (z / t); tmp = 0.0; if ((z / t) <= -1e+278) tmp = t_1; elseif ((z / t) <= -1e+183) tmp = (y * z) / t; elseif ((z / t) <= -1e+104) tmp = (x * -z) / t; elseif ((z / t) <= -1e-22) tmp = t_2; elseif ((z / t) <= 4e-9) tmp = x; elseif ((z / t) <= 2e+55) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / t), $MachinePrecision] * (-z)), $MachinePrecision]}, Block[{t$95$2 = N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z / t), $MachinePrecision], -1e+278], t$95$1, If[LessEqual[N[(z / t), $MachinePrecision], -1e+183], N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[N[(z / t), $MachinePrecision], -1e+104], N[(N[(x * (-z)), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[N[(z / t), $MachinePrecision], -1e-22], t$95$2, If[LessEqual[N[(z / t), $MachinePrecision], 4e-9], x, If[LessEqual[N[(z / t), $MachinePrecision], 2e+55], t$95$2, t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{t} \cdot \left(-z\right)\\
t_2 := y \cdot \frac{z}{t}\\
\mathbf{if}\;\frac{z}{t} \leq -1 \cdot 10^{+278}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{z}{t} \leq -1 \cdot 10^{+183}:\\
\;\;\;\;\frac{y \cdot z}{t}\\
\mathbf{elif}\;\frac{z}{t} \leq -1 \cdot 10^{+104}:\\
\;\;\;\;\frac{x \cdot \left(-z\right)}{t}\\
\mathbf{elif}\;\frac{z}{t} \leq -1 \cdot 10^{-22}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\frac{z}{t} \leq 4 \cdot 10^{-9}:\\
\;\;\;\;x\\
\mathbf{elif}\;\frac{z}{t} \leq 2 \cdot 10^{+55}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (/.f64 z t) < -9.99999999999999964e277 or 2.00000000000000002e55 < (/.f64 z t) Initial program 97.1%
Taylor expanded in z around inf 92.7%
Taylor expanded in y around 0 75.2%
neg-mul-175.2%
distribute-neg-frac75.2%
Simplified75.2%
if -9.99999999999999964e277 < (/.f64 z t) < -9.99999999999999947e182Initial program 99.6%
Taylor expanded in z around inf 99.7%
Taylor expanded in y around inf 77.4%
associate-*r/77.6%
Applied egg-rr77.6%
if -9.99999999999999947e182 < (/.f64 z t) < -1e104Initial program 99.6%
Taylor expanded in z around inf 87.9%
sub-div87.9%
associate-*r/100.0%
*-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 88.1%
mul-1-neg88.1%
distribute-lft-neg-out88.1%
*-commutative88.1%
Simplified88.1%
if -1e104 < (/.f64 z t) < -1e-22 or 4.00000000000000025e-9 < (/.f64 z t) < 2.00000000000000002e55Initial program 99.6%
Taylor expanded in z around inf 68.6%
Taylor expanded in y around inf 53.7%
Taylor expanded in z around 0 56.6%
associate-*r/68.3%
Simplified68.3%
if -1e-22 < (/.f64 z t) < 4.00000000000000025e-9Initial program 98.9%
Taylor expanded in z around 0 81.6%
Final simplification78.3%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ z t) -1e+69) (not (<= (/ z t) 40000000.0))) (/ (* (- y x) z) t) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -1e+69) || !((z / t) <= 40000000.0)) {
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) <= (-1d+69)) .or. (.not. ((z / t) <= 40000000.0d0))) 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) <= -1e+69) || !((z / t) <= 40000000.0)) {
tmp = ((y - x) * z) / t;
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z / t) <= -1e+69) or not ((z / t) <= 40000000.0): 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) <= -1e+69) || !(Float64(z / t) <= 40000000.0)) 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) <= -1e+69) || ~(((z / t) <= 40000000.0))) 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], -1e+69], N[Not[LessEqual[N[(z / t), $MachinePrecision], 40000000.0]], $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 -1 \cdot 10^{+69} \lor \neg \left(\frac{z}{t} \leq 40000000\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) < -1.0000000000000001e69 or 4e7 < (/.f64 z t) Initial program 97.9%
Taylor expanded in z around inf 89.5%
sub-div92.5%
associate-*r/94.3%
*-commutative94.3%
Applied egg-rr94.3%
if -1.0000000000000001e69 < (/.f64 z t) < 4e7Initial program 99.0%
Taylor expanded in y around inf 92.1%
associate-*r/96.6%
Simplified96.6%
Final simplification95.7%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ z t) -4e+46) (not (<= (/ z t) 4e-9))) (/ (- y x) (/ t z)) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -4e+46) || !((z / t) <= 4e-9)) {
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) <= (-4d+46)) .or. (.not. ((z / t) <= 4d-9))) 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) <= -4e+46) || !((z / t) <= 4e-9)) {
tmp = (y - x) / (t / z);
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z / t) <= -4e+46) or not ((z / t) <= 4e-9): 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) <= -4e+46) || !(Float64(z / t) <= 4e-9)) 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) <= -4e+46) || ~(((z / t) <= 4e-9))) 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], -4e+46], N[Not[LessEqual[N[(z / t), $MachinePrecision], 4e-9]], $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 -4 \cdot 10^{+46} \lor \neg \left(\frac{z}{t} \leq 4 \cdot 10^{-9}\right):\\
\;\;\;\;\frac{y - x}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if (/.f64 z t) < -4e46 or 4.00000000000000025e-9 < (/.f64 z t) Initial program 98.0%
Taylor expanded in z around inf 89.6%
*-commutative89.6%
sub-div92.4%
associate-/r/97.5%
Applied egg-rr97.5%
if -4e46 < (/.f64 z t) < 4.00000000000000025e-9Initial program 99.0%
Taylor expanded in y around inf 93.7%
associate-*r/97.8%
Simplified97.8%
Final simplification97.7%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ z t) -1e-22) (not (<= (/ z t) 4e-9))) (* y (/ z t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -1e-22) || !((z / t) <= 4e-9)) {
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) <= (-1d-22)) .or. (.not. ((z / t) <= 4d-9))) 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) <= -1e-22) || !((z / t) <= 4e-9)) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z / t) <= -1e-22) or not ((z / t) <= 4e-9): tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(z / t) <= -1e-22) || !(Float64(z / t) <= 4e-9)) 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) <= -1e-22) || ~(((z / t) <= 4e-9))) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(z / t), $MachinePrecision], -1e-22], N[Not[LessEqual[N[(z / t), $MachinePrecision], 4e-9]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -1 \cdot 10^{-22} \lor \neg \left(\frac{z}{t} \leq 4 \cdot 10^{-9}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if (/.f64 z t) < -1e-22 or 4.00000000000000025e-9 < (/.f64 z t) Initial program 98.2%
Taylor expanded in z around inf 86.5%
Taylor expanded in y around inf 41.5%
Taylor expanded in z around 0 41.5%
associate-*r/49.4%
Simplified49.4%
if -1e-22 < (/.f64 z t) < 4.00000000000000025e-9Initial program 98.9%
Taylor expanded in z around 0 81.6%
Final simplification66.8%
(FPCore (x y z t) :precision binary64 (if (<= (/ z t) -1e-22) (/ y (/ t z)) (if (<= (/ z t) 4e-9) x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z / t) <= -1e-22) {
tmp = y / (t / z);
} else if ((z / t) <= 4e-9) {
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) <= (-1d-22)) then
tmp = y / (t / z)
else if ((z / t) <= 4d-9) 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) <= -1e-22) {
tmp = y / (t / z);
} else if ((z / t) <= 4e-9) {
tmp = x;
} else {
tmp = y * (z / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z / t) <= -1e-22: tmp = y / (t / z) elif (z / t) <= 4e-9: tmp = x else: tmp = y * (z / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z / t) <= -1e-22) tmp = Float64(y / Float64(t / z)); elseif (Float64(z / t) <= 4e-9) 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) <= -1e-22) tmp = y / (t / z); elseif ((z / t) <= 4e-9) tmp = x; else tmp = y * (z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z / t), $MachinePrecision], -1e-22], N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z / t), $MachinePrecision], 4e-9], x, N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -1 \cdot 10^{-22}:\\
\;\;\;\;\frac{y}{\frac{t}{z}}\\
\mathbf{elif}\;\frac{z}{t} \leq 4 \cdot 10^{-9}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if (/.f64 z t) < -1e-22Initial program 98.2%
Taylor expanded in z around inf 84.5%
Taylor expanded in y around inf 45.2%
associate-*r/46.7%
*-commutative46.7%
associate-/l*54.3%
Applied egg-rr54.3%
if -1e-22 < (/.f64 z t) < 4.00000000000000025e-9Initial program 98.9%
Taylor expanded in z around 0 81.6%
if 4.00000000000000025e-9 < (/.f64 z t) Initial program 98.1%
Taylor expanded in z around inf 88.7%
Taylor expanded in y around inf 37.4%
Taylor expanded in z around 0 35.6%
associate-*r/44.0%
Simplified44.0%
Final simplification66.8%
(FPCore (x y z t) :precision binary64 (if (or (<= x -9e+61) (not (<= x 3.15e+41))) (* x (- 1.0 (/ z t))) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -9e+61) || !(x <= 3.15e+41)) {
tmp = x * (1.0 - (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 ((x <= (-9d+61)) .or. (.not. (x <= 3.15d+41))) then
tmp = x * (1.0d0 - (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 ((x <= -9e+61) || !(x <= 3.15e+41)) {
tmp = x * (1.0 - (z / t));
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -9e+61) or not (x <= 3.15e+41): tmp = x * (1.0 - (z / t)) else: tmp = x + (y * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -9e+61) || !(x <= 3.15e+41)) tmp = Float64(x * Float64(1.0 - 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 ((x <= -9e+61) || ~((x <= 3.15e+41))) tmp = x * (1.0 - (z / t)); else tmp = x + (y * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -9e+61], N[Not[LessEqual[x, 3.15e+41]], $MachinePrecision]], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9 \cdot 10^{+61} \lor \neg \left(x \leq 3.15 \cdot 10^{+41}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if x < -9e61 or 3.1499999999999999e41 < x Initial program 100.0%
Taylor expanded in x around inf 96.4%
mul-1-neg96.4%
unsub-neg96.4%
Simplified96.4%
if -9e61 < x < 3.1499999999999999e41Initial program 97.4%
Taylor expanded in y around inf 82.7%
associate-*r/87.2%
Simplified87.2%
Final simplification91.3%
(FPCore (x y z t) :precision binary64 (if (<= y -4.6e+179) (* y (/ z t)) (if (<= y 1.8e+178) (* x (- 1.0 (/ z t))) (/ y (/ t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -4.6e+179) {
tmp = y * (z / t);
} else if (y <= 1.8e+178) {
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 (y <= (-4.6d+179)) then
tmp = y * (z / t)
else if (y <= 1.8d+178) 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 (y <= -4.6e+179) {
tmp = y * (z / t);
} else if (y <= 1.8e+178) {
tmp = x * (1.0 - (z / t));
} else {
tmp = y / (t / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -4.6e+179: tmp = y * (z / t) elif y <= 1.8e+178: tmp = x * (1.0 - (z / t)) else: tmp = y / (t / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -4.6e+179) tmp = Float64(y * Float64(z / t)); elseif (y <= 1.8e+178) 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 (y <= -4.6e+179) tmp = y * (z / t); elseif (y <= 1.8e+178) tmp = x * (1.0 - (z / t)); else tmp = y / (t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -4.6e+179], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.8e+178], 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}\;y \leq -4.6 \cdot 10^{+179}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{+178}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{t}{z}}\\
\end{array}
\end{array}
if y < -4.59999999999999988e179Initial program 98.4%
Taylor expanded in z around inf 55.2%
Taylor expanded in y around inf 55.7%
Taylor expanded in z around 0 55.7%
associate-*r/66.3%
Simplified66.3%
if -4.59999999999999988e179 < y < 1.7999999999999999e178Initial program 98.5%
Taylor expanded in x around inf 81.3%
mul-1-neg81.3%
unsub-neg81.3%
Simplified81.3%
if 1.7999999999999999e178 < y Initial program 99.7%
Taylor expanded in z around inf 56.6%
Taylor expanded in y around inf 56.8%
associate-*r/66.2%
*-commutative66.2%
associate-/l*75.8%
Applied egg-rr75.8%
Final simplification79.4%
(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 45.8%
Final simplification45.8%
(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 2024021
(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))))