
(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 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (/ (* (- y x) z) t)))
double code(double x, double y, double z, double t) {
return x + (((y - x) * z) / t);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + (((y - x) * z) / t)
end function
public static double code(double x, double y, double z, double t) {
return x + (((y - x) * z) / t);
}
def code(x, y, z, t): return x + (((y - x) * z) / t)
function code(x, y, z, t) return Float64(x + Float64(Float64(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 (+ 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 95.1%
associate-/l*98.0%
Simplified98.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4.9e-77) (not (<= z 3.5e-129))) (+ x (* z (/ (- y x) t))) (+ x (/ (* y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.9e-77) || !(z <= 3.5e-129)) {
tmp = x + (z * ((y - x) / 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 <= (-4.9d-77)) .or. (.not. (z <= 3.5d-129))) then
tmp = x + (z * ((y - x) / 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 <= -4.9e-77) || !(z <= 3.5e-129)) {
tmp = x + (z * ((y - x) / t));
} else {
tmp = x + ((y * z) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4.9e-77) or not (z <= 3.5e-129): tmp = x + (z * ((y - x) / t)) else: tmp = x + ((y * z) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4.9e-77) || !(z <= 3.5e-129)) tmp = Float64(x + Float64(z * Float64(Float64(y - x) / t))); else tmp = Float64(x + Float64(Float64(y * z) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -4.9e-77) || ~((z <= 3.5e-129))) tmp = x + (z * ((y - x) / t)); else tmp = x + ((y * z) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4.9e-77], N[Not[LessEqual[z, 3.5e-129]], $MachinePrecision]], N[(x + N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.9 \cdot 10^{-77} \lor \neg \left(z \leq 3.5 \cdot 10^{-129}\right):\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot z}{t}\\
\end{array}
\end{array}
if z < -4.8999999999999997e-77 or 3.4999999999999997e-129 < z Initial program 93.0%
*-commutative93.0%
associate-/l*97.3%
Applied egg-rr97.3%
if -4.8999999999999997e-77 < z < 3.4999999999999997e-129Initial program 99.9%
Taylor expanded in y around inf 99.2%
*-commutative99.2%
Simplified99.2%
Final simplification97.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -5.2e+44) (not (<= x 3.5e+139))) (* x (- 1.0 (/ z t))) (+ x (/ y (/ t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -5.2e+44) || !(x <= 3.5e+139)) {
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 ((x <= (-5.2d+44)) .or. (.not. (x <= 3.5d+139))) 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 ((x <= -5.2e+44) || !(x <= 3.5e+139)) {
tmp = x * (1.0 - (z / t));
} else {
tmp = x + (y / (t / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -5.2e+44) or not (x <= 3.5e+139): tmp = x * (1.0 - (z / t)) else: tmp = x + (y / (t / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -5.2e+44) || !(x <= 3.5e+139)) 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 ((x <= -5.2e+44) || ~((x <= 3.5e+139))) tmp = x * (1.0 - (z / t)); else tmp = x + (y / (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -5.2e+44], N[Not[LessEqual[x, 3.5e+139]], $MachinePrecision]], 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}\;x \leq -5.2 \cdot 10^{+44} \lor \neg \left(x \leq 3.5 \cdot 10^{+139}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\end{array}
\end{array}
if x < -5.1999999999999998e44 or 3.49999999999999978e139 < x Initial program 95.8%
Taylor expanded in y around 0 89.9%
mul-1-neg89.9%
distribute-lft-neg-out89.9%
*-commutative89.9%
Simplified89.9%
Taylor expanded in x around 0 92.0%
mul-1-neg92.0%
unsub-neg92.0%
Simplified92.0%
if -5.1999999999999998e44 < x < 3.49999999999999978e139Initial program 94.7%
associate-/l*96.9%
Simplified96.9%
Taylor expanded in y around inf 83.8%
associate-*r/87.7%
Simplified87.7%
clear-num87.7%
div-inv87.8%
Applied egg-rr87.8%
Final simplification89.3%
(FPCore (x y z t) :precision binary64 (if (or (<= x -7.6e+46) (not (<= x 2.9e+138))) (* x (- 1.0 (/ z t))) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -7.6e+46) || !(x <= 2.9e+138)) {
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 <= (-7.6d+46)) .or. (.not. (x <= 2.9d+138))) 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 <= -7.6e+46) || !(x <= 2.9e+138)) {
tmp = x * (1.0 - (z / t));
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -7.6e+46) or not (x <= 2.9e+138): 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 <= -7.6e+46) || !(x <= 2.9e+138)) 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 <= -7.6e+46) || ~((x <= 2.9e+138))) 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, -7.6e+46], N[Not[LessEqual[x, 2.9e+138]], $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 -7.6 \cdot 10^{+46} \lor \neg \left(x \leq 2.9 \cdot 10^{+138}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if x < -7.5999999999999998e46 or 2.9000000000000001e138 < x Initial program 95.8%
Taylor expanded in y around 0 89.9%
mul-1-neg89.9%
distribute-lft-neg-out89.9%
*-commutative89.9%
Simplified89.9%
Taylor expanded in x around 0 92.0%
mul-1-neg92.0%
unsub-neg92.0%
Simplified92.0%
if -7.5999999999999998e46 < x < 2.9000000000000001e138Initial program 94.7%
associate-/l*96.9%
Simplified96.9%
Taylor expanded in y around inf 83.8%
associate-*r/87.7%
Simplified87.7%
Final simplification89.3%
(FPCore (x y z t) :precision binary64 (if (<= x -2.8e+46) (- x (/ (* x z) t)) (if (<= x 3.5e+139) (+ x (/ y (/ t z))) (* x (- 1.0 (/ z t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.8e+46) {
tmp = x - ((x * z) / t);
} else if (x <= 3.5e+139) {
tmp = x + (y / (t / z));
} 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 (x <= (-2.8d+46)) then
tmp = x - ((x * z) / t)
else if (x <= 3.5d+139) then
tmp = x + (y / (t / z))
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 (x <= -2.8e+46) {
tmp = x - ((x * z) / t);
} else if (x <= 3.5e+139) {
tmp = x + (y / (t / z));
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.8e+46: tmp = x - ((x * z) / t) elif x <= 3.5e+139: tmp = x + (y / (t / z)) else: tmp = x * (1.0 - (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.8e+46) tmp = Float64(x - Float64(Float64(x * z) / t)); elseif (x <= 3.5e+139) tmp = Float64(x + Float64(y / Float64(t / z))); 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 (x <= -2.8e+46) tmp = x - ((x * z) / t); elseif (x <= 3.5e+139) tmp = x + (y / (t / z)); else tmp = x * (1.0 - (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.8e+46], N[(x - N[(N[(x * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.5e+139], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.8 \cdot 10^{+46}:\\
\;\;\;\;x - \frac{x \cdot z}{t}\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{+139}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\end{array}
\end{array}
if x < -2.80000000000000018e46Initial program 98.2%
Taylor expanded in y around 0 91.4%
mul-1-neg91.4%
distribute-lft-neg-out91.4%
*-commutative91.4%
Simplified91.4%
if -2.80000000000000018e46 < x < 3.49999999999999978e139Initial program 94.7%
associate-/l*96.9%
Simplified96.9%
Taylor expanded in y around inf 83.8%
associate-*r/87.7%
Simplified87.7%
clear-num87.7%
div-inv87.8%
Applied egg-rr87.8%
if 3.49999999999999978e139 < x Initial program 92.8%
Taylor expanded in y around 0 87.9%
mul-1-neg87.9%
distribute-lft-neg-out87.9%
*-commutative87.9%
Simplified87.9%
Taylor expanded in x around 0 95.1%
mul-1-neg95.1%
unsub-neg95.1%
Simplified95.1%
Final simplification89.7%
(FPCore (x y z t) :precision binary64 (if (<= x -6.8e+44) (- x (* z (/ x t))) (if (<= x 2.15e+138) (+ x (/ y (/ t z))) (* x (- 1.0 (/ z t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -6.8e+44) {
tmp = x - (z * (x / t));
} else if (x <= 2.15e+138) {
tmp = x + (y / (t / z));
} 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 (x <= (-6.8d+44)) then
tmp = x - (z * (x / t))
else if (x <= 2.15d+138) then
tmp = x + (y / (t / z))
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 (x <= -6.8e+44) {
tmp = x - (z * (x / t));
} else if (x <= 2.15e+138) {
tmp = x + (y / (t / z));
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -6.8e+44: tmp = x - (z * (x / t)) elif x <= 2.15e+138: tmp = x + (y / (t / z)) else: tmp = x * (1.0 - (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -6.8e+44) tmp = Float64(x - Float64(z * Float64(x / t))); elseif (x <= 2.15e+138) tmp = Float64(x + Float64(y / Float64(t / z))); 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 (x <= -6.8e+44) tmp = x - (z * (x / t)); elseif (x <= 2.15e+138) tmp = x + (y / (t / z)); else tmp = x * (1.0 - (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -6.8e+44], N[(x - N[(z * N[(x / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.15e+138], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.8 \cdot 10^{+44}:\\
\;\;\;\;x - z \cdot \frac{x}{t}\\
\mathbf{elif}\;x \leq 2.15 \cdot 10^{+138}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\end{array}
\end{array}
if x < -6.8e44Initial program 98.2%
Taylor expanded in y around 0 91.4%
mul-1-neg91.4%
distribute-lft-neg-out91.4%
*-commutative91.4%
Simplified91.4%
div-inv91.4%
*-commutative91.4%
*-commutative91.4%
add-sqr-sqrt91.4%
sqrt-unprod67.4%
sqr-neg67.4%
sqrt-unprod0.0%
add-sqr-sqrt39.0%
remove-double-neg39.0%
distribute-rgt-neg-out39.0%
cancel-sign-sub-inv39.0%
div-inv39.0%
associate-/l*39.0%
add-sqr-sqrt39.0%
sqrt-unprod18.6%
sqr-neg18.6%
sqrt-unprod0.0%
add-sqr-sqrt91.3%
Applied egg-rr91.3%
if -6.8e44 < x < 2.1499999999999999e138Initial program 94.7%
associate-/l*96.9%
Simplified96.9%
Taylor expanded in y around inf 83.8%
associate-*r/87.7%
Simplified87.7%
clear-num87.7%
div-inv87.8%
Applied egg-rr87.8%
if 2.1499999999999999e138 < x Initial program 92.8%
Taylor expanded in y around 0 87.9%
mul-1-neg87.9%
distribute-lft-neg-out87.9%
*-commutative87.9%
Simplified87.9%
Taylor expanded in x around 0 95.1%
mul-1-neg95.1%
unsub-neg95.1%
Simplified95.1%
(FPCore (x y z t) :precision binary64 (if (<= t -4.7e-64) x (if (<= t 5.5e-40) (* x (/ (- z) t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -4.7e-64) {
tmp = x;
} else if (t <= 5.5e-40) {
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 (t <= (-4.7d-64)) then
tmp = x
else if (t <= 5.5d-40) 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 (t <= -4.7e-64) {
tmp = x;
} else if (t <= 5.5e-40) {
tmp = x * (-z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -4.7e-64: tmp = x elif t <= 5.5e-40: tmp = x * (-z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -4.7e-64) tmp = x; elseif (t <= 5.5e-40) tmp = Float64(x * Float64(Float64(-z) / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -4.7e-64) tmp = x; elseif (t <= 5.5e-40) tmp = x * (-z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -4.7e-64], x, If[LessEqual[t, 5.5e-40], N[(x * N[((-z) / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.7 \cdot 10^{-64}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 5.5 \cdot 10^{-40}:\\
\;\;\;\;x \cdot \frac{-z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -4.6999999999999998e-64 or 5.50000000000000002e-40 < t Initial program 91.5%
associate-/l*98.4%
Simplified98.4%
Taylor expanded in y around inf 84.5%
associate-*r/87.9%
Simplified87.9%
Taylor expanded in x around inf 59.7%
if -4.6999999999999998e-64 < t < 5.50000000000000002e-40Initial program 99.0%
Taylor expanded in y around 0 51.3%
mul-1-neg51.3%
distribute-lft-neg-out51.3%
*-commutative51.3%
Simplified51.3%
Taylor expanded in x around 0 54.4%
mul-1-neg54.4%
unsub-neg54.4%
Simplified54.4%
Taylor expanded in z around inf 46.7%
mul-1-neg46.7%
distribute-frac-neg46.7%
distribute-rgt-neg-in46.7%
associate-*r/49.9%
Simplified49.9%
(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 95.1%
Taylor expanded in y around 0 60.1%
mul-1-neg60.1%
distribute-lft-neg-out60.1%
*-commutative60.1%
Simplified60.1%
Taylor expanded in x around 0 62.8%
mul-1-neg62.8%
unsub-neg62.8%
Simplified62.8%
(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 95.1%
associate-/l*98.0%
Simplified98.0%
Taylor expanded in y around inf 76.1%
associate-*r/79.7%
Simplified79.7%
Taylor expanded in x around inf 34.5%
(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 2024106
(FPCore (x y z t)
:name "Numeric.Histogram:binBounds from Chart-1.5.3"
:precision binary64
:alt
(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)))