
(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(Float64(y - x) * 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[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - x\right) \cdot 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(Float64(y - x) * 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[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - x\right) \cdot z}{t}
\end{array}
(FPCore (x y z t) :precision binary64 (fma (/ z t) (- y x) x))
double code(double x, double y, double z, double t) {
return fma((z / t), (y - x), x);
}
function code(x, y, z, t) return fma(Float64(z / t), Float64(y - x), x) end
code[x_, y_, z_, t_] := N[(N[(z / t), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{z}{t}, y - x, x\right)
\end{array}
Initial program 93.6%
+-commutative93.6%
*-commutative93.6%
associate-*l/98.4%
fma-def98.4%
Simplified98.4%
Final simplification98.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (/ (* z (- y x)) t))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 INFINITY)))
(+ x (* z (/ (- y x) t)))
t_1)))
double code(double x, double y, double z, double t) {
double t_1 = x + ((z * (y - x)) / t);
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= ((double) INFINITY))) {
tmp = x + (z * ((y - x) / t));
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = x + ((z * (y - x)) / t);
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= Double.POSITIVE_INFINITY)) {
tmp = x + (z * ((y - x) / t));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + ((z * (y - x)) / t) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= math.inf): tmp = x + (z * ((y - x) / t)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(Float64(z * Float64(y - x)) / t)) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= Inf)) tmp = Float64(x + Float64(z * Float64(Float64(y - x) / t))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + ((z * (y - x)) / t); tmp = 0.0; if ((t_1 <= -Inf) || ~((t_1 <= Inf))) tmp = x + (z * ((y - x) / t)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, Infinity]], $MachinePrecision]], N[(x + N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{z \cdot \left(y - x\right)}{t}\\
\mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq \infty\right):\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < -inf.0 or +inf.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) Initial program 78.8%
associate-*l/99.9%
Applied egg-rr99.9%
if -inf.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < +inf.0Initial program 96.1%
Final simplification96.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.7e-123) (not (<= z 1.5e-231))) (+ x (* z (/ (- y x) t))) (+ x (/ (* z y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.7e-123) || !(z <= 1.5e-231)) {
tmp = x + (z * ((y - x) / t));
} else {
tmp = x + ((z * y) / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-1.7d-123)) .or. (.not. (z <= 1.5d-231))) then
tmp = x + (z * ((y - x) / t))
else
tmp = x + ((z * y) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.7e-123) || !(z <= 1.5e-231)) {
tmp = x + (z * ((y - x) / t));
} else {
tmp = x + ((z * y) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.7e-123) or not (z <= 1.5e-231): tmp = x + (z * ((y - x) / t)) else: tmp = x + ((z * y) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.7e-123) || !(z <= 1.5e-231)) tmp = Float64(x + Float64(z * Float64(Float64(y - x) / t))); else tmp = Float64(x + Float64(Float64(z * y) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.7e-123) || ~((z <= 1.5e-231))) tmp = x + (z * ((y - x) / t)); else tmp = x + ((z * y) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.7e-123], N[Not[LessEqual[z, 1.5e-231]], $MachinePrecision]], N[(x + N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.7 \cdot 10^{-123} \lor \neg \left(z \leq 1.5 \cdot 10^{-231}\right):\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z \cdot y}{t}\\
\end{array}
\end{array}
if z < -1.7e-123 or 1.5000000000000001e-231 < z Initial program 92.7%
associate-*l/96.8%
Applied egg-rr96.8%
if -1.7e-123 < z < 1.5000000000000001e-231Initial program 98.0%
Taylor expanded in y around inf 90.5%
*-commutative90.5%
Simplified90.5%
Final simplification95.6%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2.45e-167) (not (<= y 5.6e-127))) (+ x (* (/ z t) y)) (* x (- 1.0 (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.45e-167) || !(y <= 5.6e-127)) {
tmp = x + ((z / t) * y);
} 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.45d-167)) .or. (.not. (y <= 5.6d-127))) then
tmp = x + ((z / t) * y)
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.45e-167) || !(y <= 5.6e-127)) {
tmp = x + ((z / t) * y);
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2.45e-167) or not (y <= 5.6e-127): tmp = x + ((z / t) * y) else: tmp = x * (1.0 - (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2.45e-167) || !(y <= 5.6e-127)) tmp = Float64(x + Float64(Float64(z / t) * y)); 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.45e-167) || ~((y <= 5.6e-127))) tmp = x + ((z / t) * y); else tmp = x * (1.0 - (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2.45e-167], N[Not[LessEqual[y, 5.6e-127]], $MachinePrecision]], N[(x + N[(N[(z / t), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.45 \cdot 10^{-167} \lor \neg \left(y \leq 5.6 \cdot 10^{-127}\right):\\
\;\;\;\;x + \frac{z}{t} \cdot y\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\end{array}
\end{array}
if y < -2.45000000000000002e-167 or 5.59999999999999999e-127 < y Initial program 93.7%
Taylor expanded in y around inf 85.4%
associate-*r/89.0%
Simplified89.0%
if -2.45000000000000002e-167 < y < 5.59999999999999999e-127Initial program 93.5%
Taylor expanded in x around inf 93.5%
mul-1-neg93.5%
unsub-neg93.5%
Simplified93.5%
Final simplification90.2%
(FPCore (x y z t) :precision binary64 (if (<= y -2.25e-167) (+ x (* (/ z t) y)) (if (<= y 6e-127) (* x (- 1.0 (/ z t))) (+ x (/ y (/ t z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.25e-167) {
tmp = x + ((z / t) * y);
} else if (y <= 6e-127) {
tmp = x * (1.0 - (z / t));
} 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) :: tmp
if (y <= (-2.25d-167)) then
tmp = x + ((z / t) * y)
else if (y <= 6d-127) then
tmp = x * (1.0d0 - (z / t))
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 tmp;
if (y <= -2.25e-167) {
tmp = x + ((z / t) * y);
} else if (y <= 6e-127) {
tmp = x * (1.0 - (z / t));
} else {
tmp = x + (y / (t / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -2.25e-167: tmp = x + ((z / t) * y) elif y <= 6e-127: tmp = x * (1.0 - (z / t)) else: tmp = x + (y / (t / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -2.25e-167) tmp = Float64(x + Float64(Float64(z / t) * y)); elseif (y <= 6e-127) tmp = Float64(x * Float64(1.0 - Float64(z / t))); else tmp = Float64(x + Float64(y / Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -2.25e-167) tmp = x + ((z / t) * y); elseif (y <= 6e-127) tmp = x * (1.0 - (z / t)); else tmp = x + (y / (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -2.25e-167], N[(x + N[(N[(z / t), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6e-127], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.25 \cdot 10^{-167}:\\
\;\;\;\;x + \frac{z}{t} \cdot y\\
\mathbf{elif}\;y \leq 6 \cdot 10^{-127}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\end{array}
\end{array}
if y < -2.2500000000000001e-167Initial program 92.1%
Taylor expanded in y around inf 81.6%
associate-*r/84.5%
Simplified84.5%
if -2.2500000000000001e-167 < y < 6.00000000000000017e-127Initial program 93.5%
Taylor expanded in x around inf 93.5%
mul-1-neg93.5%
unsub-neg93.5%
Simplified93.5%
if 6.00000000000000017e-127 < y Initial program 95.5%
Taylor expanded in y around inf 89.7%
associate-/l*94.1%
Simplified94.1%
Final simplification90.2%
(FPCore (x y z t) :precision binary64 (if (<= t -2050000000000.0) x (if (<= t 1.3e-53) (* (/ z t) (- x)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2050000000000.0) {
tmp = x;
} else if (t <= 1.3e-53) {
tmp = (z / t) * -x;
} 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 (t <= (-2050000000000.0d0)) then
tmp = x
else if (t <= 1.3d-53) then
tmp = (z / t) * -x
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2050000000000.0) {
tmp = x;
} else if (t <= 1.3e-53) {
tmp = (z / t) * -x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -2050000000000.0: tmp = x elif t <= 1.3e-53: tmp = (z / t) * -x else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -2050000000000.0) tmp = x; elseif (t <= 1.3e-53) tmp = Float64(Float64(z / t) * Float64(-x)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -2050000000000.0) tmp = x; elseif (t <= 1.3e-53) tmp = (z / t) * -x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -2050000000000.0], x, If[LessEqual[t, 1.3e-53], N[(N[(z / t), $MachinePrecision] * (-x)), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2050000000000:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 1.3 \cdot 10^{-53}:\\
\;\;\;\;\frac{z}{t} \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -2.05e12 or 1.29999999999999998e-53 < t Initial program 88.6%
Taylor expanded in z around 0 62.8%
if -2.05e12 < t < 1.29999999999999998e-53Initial program 99.1%
Taylor expanded in x around inf 55.4%
mul-1-neg55.4%
unsub-neg55.4%
Simplified55.4%
Taylor expanded in z around inf 44.4%
mul-1-neg44.4%
distribute-frac-neg44.4%
Simplified44.4%
Final simplification54.0%
(FPCore (x y z t) :precision binary64 (if (<= t -2450000000000.0) x (if (<= t 1.8e-57) (/ (* z x) (- t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2450000000000.0) {
tmp = x;
} else if (t <= 1.8e-57) {
tmp = (z * x) / -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 (t <= (-2450000000000.0d0)) then
tmp = x
else if (t <= 1.8d-57) then
tmp = (z * x) / -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 (t <= -2450000000000.0) {
tmp = x;
} else if (t <= 1.8e-57) {
tmp = (z * x) / -t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -2450000000000.0: tmp = x elif t <= 1.8e-57: tmp = (z * x) / -t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -2450000000000.0) tmp = x; elseif (t <= 1.8e-57) tmp = Float64(Float64(z * x) / Float64(-t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -2450000000000.0) tmp = x; elseif (t <= 1.8e-57) tmp = (z * x) / -t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -2450000000000.0], x, If[LessEqual[t, 1.8e-57], N[(N[(z * x), $MachinePrecision] / (-t)), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2450000000000:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 1.8 \cdot 10^{-57}:\\
\;\;\;\;\frac{z \cdot x}{-t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -2.45e12 or 1.8000000000000001e-57 < t Initial program 88.6%
Taylor expanded in z around 0 62.8%
if -2.45e12 < t < 1.8000000000000001e-57Initial program 99.1%
Taylor expanded in x around inf 55.4%
mul-1-neg55.4%
unsub-neg55.4%
Simplified55.4%
Taylor expanded in z around inf 44.4%
mul-1-neg44.4%
distribute-frac-neg44.4%
Simplified44.4%
frac-2neg44.4%
remove-double-neg44.4%
associate-*r/45.0%
*-commutative45.0%
Applied egg-rr45.0%
Final simplification54.2%
(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 93.6%
associate-/l*98.4%
Simplified98.4%
Final simplification98.4%
(FPCore (x y z t) :precision binary64 (if (<= z 7.2e+214) x (* (/ z t) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 7.2e+214) {
tmp = x;
} else {
tmp = (z / t) * 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 <= 7.2d+214) then
tmp = x
else
tmp = (z / t) * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 7.2e+214) {
tmp = x;
} else {
tmp = (z / t) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= 7.2e+214: tmp = x else: tmp = (z / t) * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= 7.2e+214) tmp = x; else tmp = Float64(Float64(z / t) * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= 7.2e+214) tmp = x; else tmp = (z / t) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, 7.2e+214], x, N[(N[(z / t), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 7.2 \cdot 10^{+214}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{t} \cdot x\\
\end{array}
\end{array}
if z < 7.2000000000000002e214Initial program 93.7%
Taylor expanded in z around 0 39.8%
if 7.2000000000000002e214 < z Initial program 92.7%
Taylor expanded in x around inf 40.2%
mul-1-neg40.2%
unsub-neg40.2%
Simplified40.2%
Taylor expanded in z around inf 38.5%
mul-1-neg38.5%
distribute-frac-neg38.5%
Simplified38.5%
add-sqr-sqrt36.8%
sqrt-unprod68.5%
distribute-frac-neg68.5%
distribute-frac-neg68.5%
sqr-neg68.5%
sqrt-unprod31.1%
add-sqr-sqrt38.8%
associate-*r/31.5%
associate-/l*38.8%
Applied egg-rr38.8%
Taylor expanded in x around 0 31.5%
associate-*r/38.8%
*-commutative38.8%
Simplified38.8%
Final simplification39.8%
(FPCore (x y z t) :precision binary64 (* x (- 1.0 (/ z t))))
double code(double x, double y, double z, double t) {
return x * (1.0 - (z / t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x * (1.0d0 - (z / t))
end function
public static double code(double x, double y, double z, double t) {
return x * (1.0 - (z / t));
}
def code(x, y, z, t): return x * (1.0 - (z / t))
function code(x, y, z, t) return Float64(x * Float64(1.0 - Float64(z / t))) end
function tmp = code(x, y, z, t) tmp = x * (1.0 - (z / t)); end
code[x_, y_, z_, t_] := N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(1 - \frac{z}{t}\right)
\end{array}
Initial program 93.6%
Taylor expanded in x around inf 64.0%
mul-1-neg64.0%
unsub-neg64.0%
Simplified64.0%
Final simplification64.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 93.6%
Taylor expanded in z around 0 38.0%
Final simplification38.0%
(FPCore (x y z t)
:precision binary64
(if (< x -9.025511195533005e-135)
(- x (* (/ z t) (- x y)))
(if (< x 4.275032163700715e-250)
(+ x (* (/ (- y x) t) z))
(+ x (/ (- y x) (/ t z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x < -9.025511195533005e-135) {
tmp = x - ((z / t) * (x - y));
} else if (x < 4.275032163700715e-250) {
tmp = x + (((y - x) / t) * z);
} else {
tmp = x + ((y - 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 (x < (-9.025511195533005d-135)) then
tmp = x - ((z / t) * (x - y))
else if (x < 4.275032163700715d-250) then
tmp = x + (((y - x) / t) * z)
else
tmp = x + ((y - x) / (t / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x < -9.025511195533005e-135) {
tmp = x - ((z / t) * (x - y));
} else if (x < 4.275032163700715e-250) {
tmp = x + (((y - x) / t) * z);
} else {
tmp = x + ((y - x) / (t / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x < -9.025511195533005e-135: tmp = x - ((z / t) * (x - y)) elif x < 4.275032163700715e-250: tmp = x + (((y - x) / t) * z) else: tmp = x + ((y - x) / (t / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x < -9.025511195533005e-135) tmp = Float64(x - Float64(Float64(z / t) * Float64(x - y))); elseif (x < 4.275032163700715e-250) tmp = Float64(x + Float64(Float64(Float64(y - x) / t) * z)); else tmp = Float64(x + Float64(Float64(y - x) / Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x < -9.025511195533005e-135) tmp = x - ((z / t) * (x - y)); elseif (x < 4.275032163700715e-250) tmp = x + (((y - x) / t) * z); else tmp = x + ((y - x) / (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Less[x, -9.025511195533005e-135], N[(x - N[(N[(z / t), $MachinePrecision] * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Less[x, 4.275032163700715e-250], N[(x + N[(N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y - x), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x < -9.025511195533005 \cdot 10^{-135}:\\
\;\;\;\;x - \frac{z}{t} \cdot \left(x - y\right)\\
\mathbf{elif}\;x < 4.275032163700715 \cdot 10^{-250}:\\
\;\;\;\;x + \frac{y - x}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\
\end{array}
\end{array}
herbie shell --seed 2023322
(FPCore (x y z t)
:name "Numeric.Histogram:binBounds from Chart-1.5.3"
:precision binary64
:herbie-target
(if (< x -9.025511195533005e-135) (- x (* (/ z t) (- x y))) (if (< x 4.275032163700715e-250) (+ x (* (/ (- y x) t) z)) (+ x (/ (- y x) (/ t z)))))
(+ x (/ (* (- y x) z) t)))