
(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 8 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 (- 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 92.7%
+-commutative92.7%
associate-/l*99.2%
fma-define99.2%
Simplified99.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (/ z t))))
(if (<= z -1.7e+46)
t_1
(if (<= z 7.5e+52) x (if (<= z 2e+198) t_1 (* x (/ z (- t))))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (z / t);
double tmp;
if (z <= -1.7e+46) {
tmp = t_1;
} else if (z <= 7.5e+52) {
tmp = x;
} else if (z <= 2e+198) {
tmp = t_1;
} else {
tmp = x * (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) :: tmp
t_1 = y * (z / t)
if (z <= (-1.7d+46)) then
tmp = t_1
else if (z <= 7.5d+52) then
tmp = x
else if (z <= 2d+198) then
tmp = t_1
else
tmp = x * (z / -t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * (z / t);
double tmp;
if (z <= -1.7e+46) {
tmp = t_1;
} else if (z <= 7.5e+52) {
tmp = x;
} else if (z <= 2e+198) {
tmp = t_1;
} else {
tmp = x * (z / -t);
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (z / t) tmp = 0 if z <= -1.7e+46: tmp = t_1 elif z <= 7.5e+52: tmp = x elif z <= 2e+198: tmp = t_1 else: tmp = x * (z / -t) return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(z / t)) tmp = 0.0 if (z <= -1.7e+46) tmp = t_1; elseif (z <= 7.5e+52) tmp = x; elseif (z <= 2e+198) tmp = t_1; else tmp = Float64(x * Float64(z / Float64(-t))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (z / t); tmp = 0.0; if (z <= -1.7e+46) tmp = t_1; elseif (z <= 7.5e+52) tmp = x; elseif (z <= 2e+198) tmp = t_1; else tmp = x * (z / -t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.7e+46], t$95$1, If[LessEqual[z, 7.5e+52], x, If[LessEqual[z, 2e+198], t$95$1, N[(x * N[(z / (-t)), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z}{t}\\
\mathbf{if}\;z \leq -1.7 \cdot 10^{+46}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{+52}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2 \cdot 10^{+198}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{z}{-t}\\
\end{array}
\end{array}
if z < -1.6999999999999999e46 or 7.49999999999999995e52 < z < 2.00000000000000004e198Initial program 82.6%
+-commutative82.6%
associate-/l*98.8%
fma-define98.8%
Simplified98.8%
Taylor expanded in z around inf 85.7%
Taylor expanded in y around inf 52.1%
associate-*r/63.5%
Simplified63.5%
if -1.6999999999999999e46 < z < 7.49999999999999995e52Initial program 97.8%
+-commutative97.8%
associate-/l*99.3%
fma-define99.3%
Simplified99.3%
Taylor expanded in z around 0 65.3%
if 2.00000000000000004e198 < z Initial program 95.7%
+-commutative95.7%
associate-/l*99.8%
fma-define99.8%
Simplified99.8%
Taylor expanded in z around inf 99.9%
Taylor expanded in y around 0 72.0%
neg-mul-172.0%
associate-*r/80.6%
*-commutative80.6%
distribute-rgt-neg-in80.6%
Simplified80.6%
Final simplification66.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (/ z t))))
(if (<= z -2.15e+46)
t_1
(if (<= z 3.8e+53) x (if (<= z 1.02e+201) t_1 (* z (/ x (- t))))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (z / t);
double tmp;
if (z <= -2.15e+46) {
tmp = t_1;
} else if (z <= 3.8e+53) {
tmp = x;
} else if (z <= 1.02e+201) {
tmp = t_1;
} else {
tmp = z * (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) :: t_1
real(8) :: tmp
t_1 = y * (z / t)
if (z <= (-2.15d+46)) then
tmp = t_1
else if (z <= 3.8d+53) then
tmp = x
else if (z <= 1.02d+201) then
tmp = t_1
else
tmp = z * (x / -t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * (z / t);
double tmp;
if (z <= -2.15e+46) {
tmp = t_1;
} else if (z <= 3.8e+53) {
tmp = x;
} else if (z <= 1.02e+201) {
tmp = t_1;
} else {
tmp = z * (x / -t);
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (z / t) tmp = 0 if z <= -2.15e+46: tmp = t_1 elif z <= 3.8e+53: tmp = x elif z <= 1.02e+201: tmp = t_1 else: tmp = z * (x / -t) return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(z / t)) tmp = 0.0 if (z <= -2.15e+46) tmp = t_1; elseif (z <= 3.8e+53) tmp = x; elseif (z <= 1.02e+201) tmp = t_1; else tmp = Float64(z * Float64(x / Float64(-t))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (z / t); tmp = 0.0; if (z <= -2.15e+46) tmp = t_1; elseif (z <= 3.8e+53) tmp = x; elseif (z <= 1.02e+201) tmp = t_1; else tmp = z * (x / -t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.15e+46], t$95$1, If[LessEqual[z, 3.8e+53], x, If[LessEqual[z, 1.02e+201], t$95$1, N[(z * N[(x / (-t)), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z}{t}\\
\mathbf{if}\;z \leq -2.15 \cdot 10^{+46}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.8 \cdot 10^{+53}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.02 \cdot 10^{+201}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{x}{-t}\\
\end{array}
\end{array}
if z < -2.15000000000000002e46 or 3.79999999999999997e53 < z < 1.02e201Initial program 82.6%
+-commutative82.6%
associate-/l*98.8%
fma-define98.8%
Simplified98.8%
Taylor expanded in z around inf 85.7%
Taylor expanded in y around inf 52.1%
associate-*r/63.5%
Simplified63.5%
if -2.15000000000000002e46 < z < 3.79999999999999997e53Initial program 97.8%
+-commutative97.8%
associate-/l*99.3%
fma-define99.3%
Simplified99.3%
Taylor expanded in z around 0 65.3%
if 1.02e201 < z Initial program 95.7%
+-commutative95.7%
associate-/l*99.8%
fma-define99.8%
Simplified99.8%
Taylor expanded in z around inf 99.9%
Taylor expanded in y around 0 72.0%
associate-*r/72.0%
neg-mul-172.0%
Simplified72.0%
Final simplification65.3%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.7e+23) (not (<= x 5.5e+64))) (* x (- 1.0 (/ z t))) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.7e+23) || !(x <= 5.5e+64)) {
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 <= (-2.7d+23)) .or. (.not. (x <= 5.5d+64))) 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 <= -2.7e+23) || !(x <= 5.5e+64)) {
tmp = x * (1.0 - (z / t));
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.7e+23) or not (x <= 5.5e+64): 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 <= -2.7e+23) || !(x <= 5.5e+64)) 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 <= -2.7e+23) || ~((x <= 5.5e+64))) 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, -2.7e+23], N[Not[LessEqual[x, 5.5e+64]], $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 -2.7 \cdot 10^{+23} \lor \neg \left(x \leq 5.5 \cdot 10^{+64}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if x < -2.6999999999999999e23 or 5.4999999999999996e64 < x Initial program 92.2%
+-commutative92.2%
associate-/l*100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around 0 85.4%
mul-1-neg85.4%
unsub-neg85.4%
*-commutative85.4%
associate-*l/93.0%
cancel-sign-sub-inv93.0%
mul-1-neg93.0%
*-lft-identity93.0%
distribute-rgt-in93.0%
mul-1-neg93.0%
unsub-neg93.0%
Simplified93.0%
if -2.6999999999999999e23 < x < 5.4999999999999996e64Initial program 93.1%
associate-/l*98.5%
Simplified98.5%
Taylor expanded in y around inf 83.8%
associate-*r/89.1%
Simplified89.1%
Final simplification90.9%
(FPCore (x y z t) :precision binary64 (if (<= y -3.7e+132) (* y (/ z t)) (if (<= y 1.4e+68) (* x (- 1.0 (/ z t))) (* z (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.7e+132) {
tmp = y * (z / t);
} else if (y <= 1.4e+68) {
tmp = x * (1.0 - (z / t));
} else {
tmp = 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 (y <= (-3.7d+132)) then
tmp = y * (z / t)
else if (y <= 1.4d+68) then
tmp = x * (1.0d0 - (z / t))
else
tmp = z * (y / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.7e+132) {
tmp = y * (z / t);
} else if (y <= 1.4e+68) {
tmp = x * (1.0 - (z / t));
} else {
tmp = z * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -3.7e+132: tmp = y * (z / t) elif y <= 1.4e+68: tmp = x * (1.0 - (z / t)) else: tmp = z * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -3.7e+132) tmp = Float64(y * Float64(z / t)); elseif (y <= 1.4e+68) tmp = Float64(x * Float64(1.0 - Float64(z / t))); else tmp = Float64(z * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -3.7e+132) tmp = y * (z / t); elseif (y <= 1.4e+68) tmp = x * (1.0 - (z / t)); else tmp = z * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -3.7e+132], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.4e+68], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.7 \cdot 10^{+132}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{elif}\;y \leq 1.4 \cdot 10^{+68}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if y < -3.70000000000000011e132Initial program 81.5%
+-commutative81.5%
associate-/l*99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in z around inf 71.6%
Taylor expanded in y around inf 62.6%
associate-*r/75.7%
Simplified75.7%
if -3.70000000000000011e132 < y < 1.4e68Initial program 95.7%
+-commutative95.7%
associate-/l*99.4%
fma-define99.4%
Simplified99.4%
Taylor expanded in y around 0 79.0%
mul-1-neg79.0%
unsub-neg79.0%
*-commutative79.0%
associate-*l/83.3%
cancel-sign-sub-inv83.3%
mul-1-neg83.3%
*-lft-identity83.3%
distribute-rgt-in83.3%
mul-1-neg83.3%
unsub-neg83.3%
Simplified83.3%
if 1.4e68 < y Initial program 90.8%
+-commutative90.8%
associate-/l*98.1%
fma-define98.1%
Simplified98.1%
Taylor expanded in z around inf 71.2%
Taylor expanded in y around inf 60.1%
associate-*l/67.4%
*-commutative67.4%
Simplified67.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -9e+46) (not (<= z 9.5e+51))) (* y (/ z t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -9e+46) || !(z <= 9.5e+51)) {
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 <= (-9d+46)) .or. (.not. (z <= 9.5d+51))) 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 <= -9e+46) || !(z <= 9.5e+51)) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -9e+46) or not (z <= 9.5e+51): tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -9e+46) || !(z <= 9.5e+51)) 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 <= -9e+46) || ~((z <= 9.5e+51))) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -9e+46], N[Not[LessEqual[z, 9.5e+51]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{+46} \lor \neg \left(z \leq 9.5 \cdot 10^{+51}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -9.00000000000000019e46 or 9.4999999999999999e51 < z Initial program 85.3%
+-commutative85.3%
associate-/l*99.0%
fma-define99.0%
Simplified99.0%
Taylor expanded in z around inf 88.7%
Taylor expanded in y around inf 46.4%
associate-*r/56.2%
Simplified56.2%
if -9.00000000000000019e46 < z < 9.4999999999999999e51Initial program 97.8%
+-commutative97.8%
associate-/l*99.3%
fma-define99.3%
Simplified99.3%
Taylor expanded in z around 0 65.3%
Final simplification61.6%
(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 92.7%
associate-/l*99.2%
Simplified99.2%
(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 92.7%
+-commutative92.7%
associate-/l*99.2%
fma-define99.2%
Simplified99.2%
Taylor expanded in z around 0 43.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 2024096
(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)))