
(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 (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 97.4%
+-commutative97.4%
fma-define97.4%
Simplified97.4%
Final simplification97.4%
(FPCore (x y z t)
:precision binary64
(if (or (<= y -2.7e-111)
(not (or (<= y 2.5e-36) (and (not (<= y 1.15e-19)) (<= y 1.7e+58)))))
(+ x (* y (/ z t)))
(* x (- 1.0 (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.7e-111) || !((y <= 2.5e-36) || (!(y <= 1.15e-19) && (y <= 1.7e+58)))) {
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 <= (-2.7d-111)) .or. (.not. (y <= 2.5d-36) .or. (.not. (y <= 1.15d-19)) .and. (y <= 1.7d+58))) 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 <= -2.7e-111) || !((y <= 2.5e-36) || (!(y <= 1.15e-19) && (y <= 1.7e+58)))) {
tmp = x + (y * (z / t));
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2.7e-111) or not ((y <= 2.5e-36) or (not (y <= 1.15e-19) and (y <= 1.7e+58))): 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 <= -2.7e-111) || !((y <= 2.5e-36) || (!(y <= 1.15e-19) && (y <= 1.7e+58)))) 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 <= -2.7e-111) || ~(((y <= 2.5e-36) || (~((y <= 1.15e-19)) && (y <= 1.7e+58))))) 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, -2.7e-111], N[Not[Or[LessEqual[y, 2.5e-36], And[N[Not[LessEqual[y, 1.15e-19]], $MachinePrecision], LessEqual[y, 1.7e+58]]]], $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 -2.7 \cdot 10^{-111} \lor \neg \left(y \leq 2.5 \cdot 10^{-36} \lor \neg \left(y \leq 1.15 \cdot 10^{-19}\right) \land y \leq 1.7 \cdot 10^{+58}\right):\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\end{array}
\end{array}
if y < -2.69999999999999989e-111 or 2.50000000000000002e-36 < y < 1.1499999999999999e-19 or 1.7e58 < y Initial program 96.7%
Taylor expanded in y around inf 86.1%
associate-*r/89.7%
Simplified89.7%
if -2.69999999999999989e-111 < y < 2.50000000000000002e-36 or 1.1499999999999999e-19 < y < 1.7e58Initial program 98.3%
Taylor expanded in x around inf 86.3%
mul-1-neg86.3%
unsub-neg86.3%
Simplified86.3%
Final simplification88.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- 1.0 (/ z t)))) (t_2 (+ x (* z (/ y t)))))
(if (<= y -2.3e-111)
t_2
(if (<= y 1.7e-36)
t_1
(if (<= y 1.65e-19) t_2 (if (<= y 4.3e+54) t_1 (+ x (* y (/ z t)))))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (z / t));
double t_2 = x + (z * (y / t));
double tmp;
if (y <= -2.3e-111) {
tmp = t_2;
} else if (y <= 1.7e-36) {
tmp = t_1;
} else if (y <= 1.65e-19) {
tmp = t_2;
} else if (y <= 4.3e+54) {
tmp = t_1;
} 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = x * (1.0d0 - (z / t))
t_2 = x + (z * (y / t))
if (y <= (-2.3d-111)) then
tmp = t_2
else if (y <= 1.7d-36) then
tmp = t_1
else if (y <= 1.65d-19) then
tmp = t_2
else if (y <= 4.3d+54) then
tmp = t_1
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 t_1 = x * (1.0 - (z / t));
double t_2 = x + (z * (y / t));
double tmp;
if (y <= -2.3e-111) {
tmp = t_2;
} else if (y <= 1.7e-36) {
tmp = t_1;
} else if (y <= 1.65e-19) {
tmp = t_2;
} else if (y <= 4.3e+54) {
tmp = t_1;
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (1.0 - (z / t)) t_2 = x + (z * (y / t)) tmp = 0 if y <= -2.3e-111: tmp = t_2 elif y <= 1.7e-36: tmp = t_1 elif y <= 1.65e-19: tmp = t_2 elif y <= 4.3e+54: tmp = t_1 else: tmp = x + (y * (z / t)) return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(1.0 - Float64(z / t))) t_2 = Float64(x + Float64(z * Float64(y / t))) tmp = 0.0 if (y <= -2.3e-111) tmp = t_2; elseif (y <= 1.7e-36) tmp = t_1; elseif (y <= 1.65e-19) tmp = t_2; elseif (y <= 4.3e+54) tmp = t_1; else tmp = Float64(x + Float64(y * Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (1.0 - (z / t)); t_2 = x + (z * (y / t)); tmp = 0.0; if (y <= -2.3e-111) tmp = t_2; elseif (y <= 1.7e-36) tmp = t_1; elseif (y <= 1.65e-19) tmp = t_2; elseif (y <= 4.3e+54) tmp = t_1; else tmp = x + (y * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.3e-111], t$95$2, If[LessEqual[y, 1.7e-36], t$95$1, If[LessEqual[y, 1.65e-19], t$95$2, If[LessEqual[y, 4.3e+54], t$95$1, N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(1 - \frac{z}{t}\right)\\
t_2 := x + z \cdot \frac{y}{t}\\
\mathbf{if}\;y \leq -2.3 \cdot 10^{-111}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq 1.7 \cdot 10^{-36}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.65 \cdot 10^{-19}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq 4.3 \cdot 10^{+54}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if y < -2.3e-111 or 1.7000000000000001e-36 < y < 1.6499999999999999e-19Initial program 96.1%
Taylor expanded in y around inf 87.1%
*-commutative87.1%
associate-/l*91.0%
Simplified91.0%
if -2.3e-111 < y < 1.7000000000000001e-36 or 1.6499999999999999e-19 < y < 4.29999999999999976e54Initial program 98.3%
Taylor expanded in x around inf 86.3%
mul-1-neg86.3%
unsub-neg86.3%
Simplified86.3%
if 4.29999999999999976e54 < y Initial program 97.9%
Taylor expanded in y around inf 84.0%
associate-*r/90.2%
Simplified90.2%
Final simplification88.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- 1.0 (/ z t)))) (t_2 (+ x (* z (/ y t)))))
(if (<= y -2e-111)
t_2
(if (<= y 1.4e-36)
t_1
(if (<= y 7.2e-20) t_2 (if (<= y 4.2e+54) t_1 (+ x (/ y (/ t z)))))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (z / t));
double t_2 = x + (z * (y / t));
double tmp;
if (y <= -2e-111) {
tmp = t_2;
} else if (y <= 1.4e-36) {
tmp = t_1;
} else if (y <= 7.2e-20) {
tmp = t_2;
} else if (y <= 4.2e+54) {
tmp = t_1;
} else {
tmp = x + (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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = x * (1.0d0 - (z / t))
t_2 = x + (z * (y / t))
if (y <= (-2d-111)) then
tmp = t_2
else if (y <= 1.4d-36) then
tmp = t_1
else if (y <= 7.2d-20) then
tmp = t_2
else if (y <= 4.2d+54) then
tmp = t_1
else
tmp = x + (y / (t / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (z / t));
double t_2 = x + (z * (y / t));
double tmp;
if (y <= -2e-111) {
tmp = t_2;
} else if (y <= 1.4e-36) {
tmp = t_1;
} else if (y <= 7.2e-20) {
tmp = t_2;
} else if (y <= 4.2e+54) {
tmp = t_1;
} else {
tmp = x + (y / (t / z));
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (1.0 - (z / t)) t_2 = x + (z * (y / t)) tmp = 0 if y <= -2e-111: tmp = t_2 elif y <= 1.4e-36: tmp = t_1 elif y <= 7.2e-20: tmp = t_2 elif y <= 4.2e+54: tmp = t_1 else: tmp = x + (y / (t / z)) return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(1.0 - Float64(z / t))) t_2 = Float64(x + Float64(z * Float64(y / t))) tmp = 0.0 if (y <= -2e-111) tmp = t_2; elseif (y <= 1.4e-36) tmp = t_1; elseif (y <= 7.2e-20) tmp = t_2; elseif (y <= 4.2e+54) tmp = t_1; else tmp = Float64(x + Float64(y / Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (1.0 - (z / t)); t_2 = x + (z * (y / t)); tmp = 0.0; if (y <= -2e-111) tmp = t_2; elseif (y <= 1.4e-36) tmp = t_1; elseif (y <= 7.2e-20) tmp = t_2; elseif (y <= 4.2e+54) tmp = t_1; else tmp = x + (y / (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2e-111], t$95$2, If[LessEqual[y, 1.4e-36], t$95$1, If[LessEqual[y, 7.2e-20], t$95$2, If[LessEqual[y, 4.2e+54], t$95$1, N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(1 - \frac{z}{t}\right)\\
t_2 := x + z \cdot \frac{y}{t}\\
\mathbf{if}\;y \leq -2 \cdot 10^{-111}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq 1.4 \cdot 10^{-36}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 7.2 \cdot 10^{-20}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{+54}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\end{array}
\end{array}
if y < -2.00000000000000018e-111 or 1.4000000000000001e-36 < y < 7.19999999999999948e-20Initial program 96.1%
Taylor expanded in y around inf 87.1%
*-commutative87.1%
associate-/l*91.0%
Simplified91.0%
if -2.00000000000000018e-111 < y < 1.4000000000000001e-36 or 7.19999999999999948e-20 < y < 4.19999999999999972e54Initial program 98.3%
Taylor expanded in x around inf 86.3%
mul-1-neg86.3%
unsub-neg86.3%
Simplified86.3%
if 4.19999999999999972e54 < y Initial program 97.9%
Taylor expanded in y around inf 84.0%
associate-*r/90.2%
Simplified90.2%
clear-num90.1%
div-inv90.2%
Applied egg-rr90.2%
Final simplification88.7%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ z t) -5e-80) (not (<= (/ z t) 2e-10))) (* y (/ z t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -5e-80) || !((z / t) <= 2e-10)) {
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) <= (-5d-80)) .or. (.not. ((z / t) <= 2d-10))) 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) <= -5e-80) || !((z / t) <= 2e-10)) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z / t) <= -5e-80) or not ((z / t) <= 2e-10): tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(z / t) <= -5e-80) || !(Float64(z / t) <= 2e-10)) 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) <= -5e-80) || ~(((z / t) <= 2e-10))) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(z / t), $MachinePrecision], -5e-80], N[Not[LessEqual[N[(z / t), $MachinePrecision], 2e-10]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -5 \cdot 10^{-80} \lor \neg \left(\frac{z}{t} \leq 2 \cdot 10^{-10}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if (/.f64 z t) < -5e-80 or 2.00000000000000007e-10 < (/.f64 z t) Initial program 97.9%
Taylor expanded in y around inf 55.6%
associate-*r/60.7%
Simplified60.7%
+-commutative60.7%
*-commutative60.7%
fma-define60.7%
Applied egg-rr60.7%
Taylor expanded in z around inf 53.0%
associate-/l*58.1%
*-commutative58.1%
Simplified58.1%
if -5e-80 < (/.f64 z t) < 2.00000000000000007e-10Initial program 96.9%
Taylor expanded in z around 0 80.0%
Final simplification68.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.8e-114) (not (<= x 2e-127))) (* x (- 1.0 (/ z t))) (* y (/ z t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.8e-114) || !(x <= 2e-127)) {
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 <= (-1.8d-114)) .or. (.not. (x <= 2d-127))) 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 <= -1.8e-114) || !(x <= 2e-127)) {
tmp = x * (1.0 - (z / t));
} else {
tmp = y * (z / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.8e-114) or not (x <= 2e-127): tmp = x * (1.0 - (z / t)) else: tmp = y * (z / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.8e-114) || !(x <= 2e-127)) tmp = Float64(x * Float64(1.0 - Float64(z / t))); else tmp = Float64(y * Float64(z / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.8e-114) || ~((x <= 2e-127))) 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, -1.8e-114], N[Not[LessEqual[x, 2e-127]], $MachinePrecision]], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.8 \cdot 10^{-114} \lor \neg \left(x \leq 2 \cdot 10^{-127}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if x < -1.80000000000000009e-114 or 2.0000000000000001e-127 < x Initial program 98.8%
Taylor expanded in x around inf 79.0%
mul-1-neg79.0%
unsub-neg79.0%
Simplified79.0%
if -1.80000000000000009e-114 < x < 2.0000000000000001e-127Initial program 94.4%
Taylor expanded in y around inf 86.5%
associate-*r/87.4%
Simplified87.4%
+-commutative87.4%
*-commutative87.4%
fma-define87.4%
Applied egg-rr87.4%
Taylor expanded in z around inf 65.2%
associate-/l*66.1%
*-commutative66.1%
Simplified66.1%
Final simplification74.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4.2e-13) (not (<= z 2.8e-88))) (* z (/ y t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.2e-13) || !(z <= 2.8e-88)) {
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 <= (-4.2d-13)) .or. (.not. (z <= 2.8d-88))) 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 <= -4.2e-13) || !(z <= 2.8e-88)) {
tmp = z * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4.2e-13) or not (z <= 2.8e-88): tmp = z * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4.2e-13) || !(z <= 2.8e-88)) 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 <= -4.2e-13) || ~((z <= 2.8e-88))) tmp = z * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4.2e-13], N[Not[LessEqual[z, 2.8e-88]], $MachinePrecision]], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.2 \cdot 10^{-13} \lor \neg \left(z \leq 2.8 \cdot 10^{-88}\right):\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -4.19999999999999977e-13 or 2.79999999999999976e-88 < z Initial program 98.1%
Taylor expanded in y around inf 63.6%
associate-*r/69.1%
Simplified69.1%
+-commutative69.1%
*-commutative69.1%
fma-define69.1%
Applied egg-rr69.1%
Taylor expanded in z around inf 47.6%
*-commutative47.6%
associate-/l*51.4%
Simplified51.4%
if -4.19999999999999977e-13 < z < 2.79999999999999976e-88Initial program 96.4%
Taylor expanded in z around 0 70.3%
Final simplification58.7%
(FPCore (x y z t) :precision binary64 (+ x (* z (/ (- y x) t))))
double code(double x, double y, double z, double t) {
return x + (z * ((y - x) / t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + (z * ((y - x) / t))
end function
public static double code(double x, double y, double z, double t) {
return x + (z * ((y - x) / t));
}
def code(x, y, z, t): return x + (z * ((y - x) / t))
function code(x, y, z, t) return Float64(x + Float64(z * Float64(Float64(y - x) / t))) end
function tmp = code(x, y, z, t) tmp = x + (z * ((y - x) / t)); end
code[x_, y_, z_, t_] := N[(x + N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + z \cdot \frac{y - x}{t}
\end{array}
Initial program 97.4%
Taylor expanded in y around 0 87.7%
mul-1-neg87.7%
associate-/l*86.9%
distribute-lft-neg-out86.9%
associate-*r/88.7%
distribute-rgt-out97.4%
+-commutative97.4%
sub-neg97.4%
associate-*l/93.6%
associate-/l*95.0%
Simplified95.0%
Final simplification95.0%
(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 97.4%
Final simplification97.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.4%
Taylor expanded in z around 0 38.9%
Final simplification38.9%
(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 2024052
(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))))