
(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 (if (<= z 1.25e-171) (+ x (* (- y x) (/ z t))) (+ x (/ z (/ t (- y x))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.25e-171) {
tmp = x + ((y - x) * (z / t));
} else {
tmp = x + (z / (t / (y - 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 <= 1.25d-171) then
tmp = x + ((y - x) * (z / t))
else
tmp = x + (z / (t / (y - x)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.25e-171) {
tmp = x + ((y - x) * (z / t));
} else {
tmp = x + (z / (t / (y - x)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= 1.25e-171: tmp = x + ((y - x) * (z / t)) else: tmp = x + (z / (t / (y - x))) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= 1.25e-171) tmp = Float64(x + Float64(Float64(y - x) * Float64(z / t))); else tmp = Float64(x + Float64(z / Float64(t / Float64(y - x)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= 1.25e-171) tmp = x + ((y - x) * (z / t)); else tmp = x + (z / (t / (y - x))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, 1.25e-171], N[(x + N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z / N[(t / N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.25 \cdot 10^{-171}:\\
\;\;\;\;x + \left(y - x\right) \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z}{\frac{t}{y - x}}\\
\end{array}
\end{array}
if z < 1.24999999999999998e-171Initial program 93.5%
associate-/l*99.2%
Simplified99.2%
if 1.24999999999999998e-171 < z Initial program 92.7%
associate-/l*93.8%
Simplified93.8%
Taylor expanded in y around 0 86.1%
+-commutative86.1%
associate-*r/80.7%
mul-1-neg80.7%
associate-/l*84.7%
distribute-lft-neg-out84.7%
distribute-rgt-out93.8%
sub-neg93.8%
associate-*l/92.7%
associate-*r/99.8%
Simplified99.8%
clear-num99.8%
un-div-inv99.9%
Applied egg-rr99.9%
Final simplification99.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.4e-164) (not (<= z 1.25e-171))) (+ x (* z (/ (- y x) t))) (+ x (/ y (/ t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.4e-164) || !(z <= 1.25e-171)) {
tmp = x + (z * ((y - x) / 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 ((z <= (-2.4d-164)) .or. (.not. (z <= 1.25d-171))) then
tmp = x + (z * ((y - x) / 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 ((z <= -2.4e-164) || !(z <= 1.25e-171)) {
tmp = x + (z * ((y - x) / t));
} else {
tmp = x + (y / (t / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.4e-164) or not (z <= 1.25e-171): tmp = x + (z * ((y - x) / t)) else: tmp = x + (y / (t / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.4e-164) || !(z <= 1.25e-171)) tmp = Float64(x + Float64(z * Float64(Float64(y - x) / 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 ((z <= -2.4e-164) || ~((z <= 1.25e-171))) tmp = x + (z * ((y - x) / t)); else tmp = x + (y / (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.4e-164], N[Not[LessEqual[z, 1.25e-171]], $MachinePrecision]], N[(x + N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.4 \cdot 10^{-164} \lor \neg \left(z \leq 1.25 \cdot 10^{-171}\right):\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\end{array}
\end{array}
if z < -2.39999999999999983e-164 or 1.24999999999999998e-171 < z Initial program 91.2%
associate-/l*96.4%
Simplified96.4%
Taylor expanded in y around 0 87.4%
+-commutative87.4%
associate-*r/85.2%
mul-1-neg85.2%
associate-/l*90.8%
distribute-lft-neg-out90.8%
distribute-rgt-out96.4%
sub-neg96.4%
associate-*l/91.2%
associate-*r/98.8%
Simplified98.8%
if -2.39999999999999983e-164 < z < 1.24999999999999998e-171Initial program 98.5%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around inf 93.0%
associate-*r/94.3%
Simplified94.3%
clear-num94.2%
div-inv94.4%
Applied egg-rr94.4%
Final simplification97.6%
(FPCore (x y z t) :precision binary64 (if (or (<= y -7e+26) (not (<= y 3e-28))) (+ x (* y (/ z t))) (* x (- 1.0 (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -7e+26) || !(y <= 3e-28)) {
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 <= (-7d+26)) .or. (.not. (y <= 3d-28))) 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 <= -7e+26) || !(y <= 3e-28)) {
tmp = x + (y * (z / t));
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -7e+26) or not (y <= 3e-28): 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 <= -7e+26) || !(y <= 3e-28)) 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 <= -7e+26) || ~((y <= 3e-28))) 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, -7e+26], N[Not[LessEqual[y, 3e-28]], $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 -7 \cdot 10^{+26} \lor \neg \left(y \leq 3 \cdot 10^{-28}\right):\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\end{array}
\end{array}
if y < -6.9999999999999998e26 or 3.00000000000000003e-28 < y Initial program 92.8%
associate-/l*99.0%
Simplified99.0%
Taylor expanded in y around inf 88.5%
associate-*r/93.9%
Simplified93.9%
if -6.9999999999999998e26 < y < 3.00000000000000003e-28Initial program 93.6%
associate-/l*95.5%
Simplified95.5%
Taylor expanded in x around inf 86.5%
mul-1-neg86.5%
unsub-neg86.5%
Simplified86.5%
Final simplification90.3%
(FPCore (x y z t) :precision binary64 (if (<= y -8.6e+25) (+ x (* y (/ z t))) (if (<= y 9.5e-126) (* x (- 1.0 (/ z t))) (+ x (/ y (/ t z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -8.6e+25) {
tmp = x + (y * (z / t));
} else if (y <= 9.5e-126) {
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 <= (-8.6d+25)) then
tmp = x + (y * (z / t))
else if (y <= 9.5d-126) 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 <= -8.6e+25) {
tmp = x + (y * (z / t));
} else if (y <= 9.5e-126) {
tmp = x * (1.0 - (z / t));
} else {
tmp = x + (y / (t / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -8.6e+25: tmp = x + (y * (z / t)) elif y <= 9.5e-126: 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 <= -8.6e+25) tmp = Float64(x + Float64(y * Float64(z / t))); elseif (y <= 9.5e-126) 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 <= -8.6e+25) tmp = x + (y * (z / t)); elseif (y <= 9.5e-126) 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, -8.6e+25], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9.5e-126], 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 -8.6 \cdot 10^{+25}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{elif}\;y \leq 9.5 \cdot 10^{-126}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\end{array}
\end{array}
if y < -8.59999999999999996e25Initial program 92.1%
associate-/l*99.6%
Simplified99.6%
Taylor expanded in y around inf 90.4%
associate-*r/96.4%
Simplified96.4%
if -8.59999999999999996e25 < y < 9.5000000000000003e-126Initial program 92.8%
associate-/l*95.7%
Simplified95.7%
Taylor expanded in x around inf 87.9%
mul-1-neg87.9%
unsub-neg87.9%
Simplified87.9%
if 9.5000000000000003e-126 < y Initial program 94.5%
associate-/l*97.7%
Simplified97.7%
Taylor expanded in y around inf 85.9%
associate-*r/89.0%
Simplified89.0%
clear-num88.9%
div-inv89.8%
Applied egg-rr89.8%
Final simplification90.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.5e-21) (not (<= z 5.5e+21))) (* z (/ x (- t))) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.5e-21) || !(z <= 5.5e+21)) {
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 ((z <= (-1.5d-21)) .or. (.not. (z <= 5.5d+21))) 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 ((z <= -1.5e-21) || !(z <= 5.5e+21)) {
tmp = z * (x / -t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.5e-21) or not (z <= 5.5e+21): tmp = z * (x / -t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.5e-21) || !(z <= 5.5e+21)) tmp = Float64(z * Float64(x / Float64(-t))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.5e-21) || ~((z <= 5.5e+21))) tmp = z * (x / -t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.5e-21], N[Not[LessEqual[z, 5.5e+21]], $MachinePrecision]], N[(z * N[(x / (-t)), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.5 \cdot 10^{-21} \lor \neg \left(z \leq 5.5 \cdot 10^{+21}\right):\\
\;\;\;\;z \cdot \frac{x}{-t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.49999999999999996e-21 or 5.5e21 < z Initial program 87.5%
associate-/l*95.6%
Simplified95.6%
clear-num95.6%
un-div-inv97.5%
Applied egg-rr97.5%
Taylor expanded in y around 0 53.5%
mul-1-neg53.5%
associate-*l/58.7%
distribute-lft-neg-in58.7%
distribute-neg-frac58.7%
Simplified58.7%
add-sqr-sqrt32.4%
sqrt-unprod30.7%
sqr-neg30.7%
sqrt-unprod6.3%
add-sqr-sqrt17.2%
cancel-sign-sub17.2%
distribute-frac-neg17.2%
*-commutative17.2%
div-inv17.2%
div-inv17.2%
add-sqr-sqrt10.9%
sqrt-unprod31.8%
sqr-neg31.8%
sqrt-unprod26.1%
add-sqr-sqrt58.7%
Applied egg-rr58.7%
Taylor expanded in z around inf 42.3%
mul-1-neg42.3%
associate-*l/43.6%
distribute-rgt-neg-out43.6%
Simplified43.6%
if -1.49999999999999996e-21 < z < 5.5e21Initial program 99.1%
associate-/l*99.0%
Simplified99.0%
Taylor expanded in z around 0 66.9%
Final simplification55.1%
(FPCore (x y z t) :precision binary64 (if (<= z 1.25e-171) (+ x (* (- y x) (/ z t))) (+ x (* z (/ (- y x) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.25e-171) {
tmp = x + ((y - x) * (z / t));
} else {
tmp = x + (z * ((y - x) / 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.25d-171) then
tmp = x + ((y - x) * (z / t))
else
tmp = x + (z * ((y - x) / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.25e-171) {
tmp = x + ((y - x) * (z / t));
} else {
tmp = x + (z * ((y - x) / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= 1.25e-171: tmp = x + ((y - x) * (z / t)) else: tmp = x + (z * ((y - x) / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= 1.25e-171) tmp = Float64(x + Float64(Float64(y - x) * Float64(z / t))); else tmp = Float64(x + Float64(z * Float64(Float64(y - x) / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= 1.25e-171) tmp = x + ((y - x) * (z / t)); else tmp = x + (z * ((y - x) / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, 1.25e-171], N[(x + N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.25 \cdot 10^{-171}:\\
\;\;\;\;x + \left(y - x\right) \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\
\end{array}
\end{array}
if z < 1.24999999999999998e-171Initial program 93.5%
associate-/l*99.2%
Simplified99.2%
if 1.24999999999999998e-171 < z Initial program 92.7%
associate-/l*93.8%
Simplified93.8%
Taylor expanded in y around 0 86.1%
+-commutative86.1%
associate-*r/80.7%
mul-1-neg80.7%
associate-/l*84.7%
distribute-lft-neg-out84.7%
distribute-rgt-out93.8%
sub-neg93.8%
associate-*l/92.7%
associate-*r/99.8%
Simplified99.8%
Final simplification99.5%
(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.2%
associate-/l*97.3%
Simplified97.3%
clear-num96.9%
un-div-inv97.9%
Applied egg-rr97.9%
Final simplification97.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 93.2%
associate-/l*97.3%
Simplified97.3%
Taylor expanded in x around inf 66.3%
mul-1-neg66.3%
unsub-neg66.3%
Simplified66.3%
Final simplification66.3%
(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.2%
associate-/l*97.3%
Simplified97.3%
Taylor expanded in z around 0 41.4%
Final simplification41.4%
(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 2024079
(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)))