
(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 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(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 (let* ((t_1 (+ x (/ (* z (- y x)) t)))) (if (<= t_1 1e+289) t_1 (+ x (/ z (/ t (- y x)))))))
double code(double x, double y, double z, double t) {
double t_1 = x + ((z * (y - x)) / t);
double tmp;
if (t_1 <= 1e+289) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = x + ((z * (y - x)) / t)
if (t_1 <= 1d+289) then
tmp = t_1
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 t_1 = x + ((z * (y - x)) / t);
double tmp;
if (t_1 <= 1e+289) {
tmp = t_1;
} else {
tmp = x + (z / (t / (y - x)));
}
return tmp;
}
def code(x, y, z, t): t_1 = x + ((z * (y - x)) / t) tmp = 0 if t_1 <= 1e+289: tmp = t_1 else: tmp = x + (z / (t / (y - x))) 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 <= 1e+289) tmp = t_1; else tmp = Float64(x + Float64(z / Float64(t / Float64(y - x)))); 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 <= 1e+289) tmp = t_1; else tmp = x + (z / (t / (y - x))); 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[LessEqual[t$95$1, 1e+289], t$95$1, N[(x + N[(z / N[(t / N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{z \cdot \left(y - x\right)}{t}\\
\mathbf{if}\;t_1 \leq 10^{+289}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z}{\frac{t}{y - x}}\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < 1.0000000000000001e289Initial program 97.0%
if 1.0000000000000001e289 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) Initial program 83.5%
associate-*l/99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 72.7%
associate-*r/74.1%
+-commutative74.1%
mul-1-neg74.1%
sub-neg74.1%
associate-*r/72.7%
associate-/l*74.1%
associate-/l*80.3%
div-sub97.9%
associate-/l*83.5%
*-commutative83.5%
associate-/l*100.0%
Simplified100.0%
Final simplification97.5%
(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 94.6%
+-commutative94.6%
*-commutative94.6%
associate-*l/97.1%
fma-def97.1%
Simplified97.1%
Final simplification97.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.5e-75) (not (<= x 1050.0))) (* x (- 1.0 (/ z t))) (+ x (* (/ z t) y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.5e-75) || !(x <= 1050.0)) {
tmp = x * (1.0 - (z / t));
} else {
tmp = x + ((z / t) * y);
}
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.5d-75)) .or. (.not. (x <= 1050.0d0))) then
tmp = x * (1.0d0 - (z / t))
else
tmp = x + ((z / t) * y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.5e-75) || !(x <= 1050.0)) {
tmp = x * (1.0 - (z / t));
} else {
tmp = x + ((z / t) * y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.5e-75) or not (x <= 1050.0): tmp = x * (1.0 - (z / t)) else: tmp = x + ((z / t) * y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.5e-75) || !(x <= 1050.0)) tmp = Float64(x * Float64(1.0 - Float64(z / t))); else tmp = Float64(x + Float64(Float64(z / t) * y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -2.5e-75) || ~((x <= 1050.0))) tmp = x * (1.0 - (z / t)); else tmp = x + ((z / t) * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.5e-75], N[Not[LessEqual[x, 1050.0]], $MachinePrecision]], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(z / t), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.5 \cdot 10^{-75} \lor \neg \left(x \leq 1050\right):\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z}{t} \cdot y\\
\end{array}
\end{array}
if x < -2.49999999999999989e-75 or 1050 < x Initial program 96.6%
+-commutative96.6%
*-commutative96.6%
associate-*l/99.9%
fma-def100.0%
Simplified100.0%
Taylor expanded in y around 0 85.7%
associate-*r/88.4%
neg-mul-188.4%
*-rgt-identity88.4%
distribute-rgt-neg-in88.4%
mul-1-neg88.4%
distribute-lft-in88.4%
mul-1-neg88.4%
unsub-neg88.4%
Simplified88.4%
if -2.49999999999999989e-75 < x < 1050Initial program 91.9%
Taylor expanded in y around inf 84.6%
associate-*r/87.7%
Simplified87.7%
Final simplification88.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -3.2e-75) (not (<= x 620.0))) (* x (- 1.0 (/ z t))) (+ x (/ y (/ t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.2e-75) || !(x <= 620.0)) {
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 <= (-3.2d-75)) .or. (.not. (x <= 620.0d0))) 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 <= -3.2e-75) || !(x <= 620.0)) {
tmp = x * (1.0 - (z / t));
} else {
tmp = x + (y / (t / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -3.2e-75) or not (x <= 620.0): 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 <= -3.2e-75) || !(x <= 620.0)) 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 <= -3.2e-75) || ~((x <= 620.0))) 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, -3.2e-75], N[Not[LessEqual[x, 620.0]], $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 -3.2 \cdot 10^{-75} \lor \neg \left(x \leq 620\right):\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\end{array}
\end{array}
if x < -3.19999999999999977e-75 or 620 < x Initial program 96.6%
+-commutative96.6%
*-commutative96.6%
associate-*l/99.9%
fma-def100.0%
Simplified100.0%
Taylor expanded in y around 0 85.7%
associate-*r/88.4%
neg-mul-188.4%
*-rgt-identity88.4%
distribute-rgt-neg-in88.4%
mul-1-neg88.4%
distribute-lft-in88.4%
mul-1-neg88.4%
unsub-neg88.4%
Simplified88.4%
if -3.19999999999999977e-75 < x < 620Initial program 91.9%
+-commutative91.9%
*-commutative91.9%
associate-*l/93.4%
fma-def93.4%
Simplified93.4%
fma-udef93.4%
*-commutative93.4%
Applied egg-rr93.4%
Taylor expanded in y around inf 84.6%
associate-/l*87.7%
Simplified87.7%
Final simplification88.1%
(FPCore (x y z t) :precision binary64 (if (<= x 5.8e+183) (+ x (* z (/ (- y x) t))) (* x (- 1.0 (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 5.8e+183) {
tmp = x + (z * ((y - x) / 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 (x <= 5.8d+183) then
tmp = x + (z * ((y - x) / 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 (x <= 5.8e+183) {
tmp = x + (z * ((y - x) / t));
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= 5.8e+183: tmp = x + (z * ((y - x) / t)) else: tmp = x * (1.0 - (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= 5.8e+183) tmp = Float64(x + Float64(z * Float64(Float64(y - x) / 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 (x <= 5.8e+183) tmp = x + (z * ((y - x) / t)); else tmp = x * (1.0 - (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, 5.8e+183], N[(x + N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 5.8 \cdot 10^{+183}:\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\end{array}
\end{array}
if x < 5.8000000000000001e183Initial program 94.1%
associate-*l/93.0%
Applied egg-rr93.0%
if 5.8000000000000001e183 < x Initial program 100.0%
+-commutative100.0%
*-commutative100.0%
associate-*l/100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
associate-*r/100.0%
neg-mul-1100.0%
*-rgt-identity100.0%
distribute-rgt-neg-in100.0%
mul-1-neg100.0%
distribute-lft-in100.0%
mul-1-neg100.0%
unsub-neg100.0%
Simplified100.0%
Final simplification93.6%
(FPCore (x y z t) :precision binary64 (if (<= x 1.15e+185) (+ x (/ z (/ t (- y x)))) (* x (- 1.0 (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.15e+185) {
tmp = x + (z / (t / (y - x)));
} 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 <= 1.15d+185) then
tmp = x + (z / (t / (y - x)))
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 <= 1.15e+185) {
tmp = x + (z / (t / (y - x)));
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= 1.15e+185: tmp = x + (z / (t / (y - x))) else: tmp = x * (1.0 - (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= 1.15e+185) tmp = Float64(x + Float64(z / Float64(t / Float64(y - x)))); 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 <= 1.15e+185) tmp = x + (z / (t / (y - x))); else tmp = x * (1.0 - (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, 1.15e+185], N[(x + N[(z / N[(t / N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.15 \cdot 10^{+185}:\\
\;\;\;\;x + \frac{z}{\frac{t}{y - x}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\end{array}
\end{array}
if x < 1.1500000000000001e185Initial program 94.1%
associate-*l/93.0%
Applied egg-rr93.0%
Taylor expanded in y around 0 89.4%
associate-*r/88.4%
+-commutative88.4%
mul-1-neg88.4%
sub-neg88.4%
associate-*r/89.4%
associate-/l*88.4%
associate-/l*89.5%
div-sub96.8%
associate-/l*94.1%
*-commutative94.1%
associate-/l*93.8%
Simplified93.8%
if 1.1500000000000001e185 < x Initial program 100.0%
+-commutative100.0%
*-commutative100.0%
associate-*l/100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
associate-*r/100.0%
neg-mul-1100.0%
*-rgt-identity100.0%
distribute-rgt-neg-in100.0%
mul-1-neg100.0%
distribute-lft-in100.0%
mul-1-neg100.0%
unsub-neg100.0%
Simplified100.0%
Final simplification94.3%
(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 94.6%
associate-/l*97.1%
Simplified97.1%
Final simplification97.1%
(FPCore (x y z t) :precision binary64 (+ x (* (/ z t) (- y x))))
double code(double x, double y, double z, double t) {
return x + ((z / t) * (y - 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 + ((z / t) * (y - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((z / t) * (y - x));
}
def code(x, y, z, t): return x + ((z / t) * (y - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(z / t) * Float64(y - x))) end
function tmp = code(x, y, z, t) tmp = x + ((z / t) * (y - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(z / t), $MachinePrecision] * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{z}{t} \cdot \left(y - x\right)
\end{array}
Initial program 94.6%
+-commutative94.6%
*-commutative94.6%
associate-*l/97.1%
fma-def97.1%
Simplified97.1%
fma-udef97.1%
*-commutative97.1%
Applied egg-rr97.1%
Final simplification97.1%
(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 94.6%
+-commutative94.6%
*-commutative94.6%
associate-*l/97.1%
fma-def97.1%
Simplified97.1%
Taylor expanded in y around 0 66.0%
associate-*r/67.5%
neg-mul-167.5%
*-rgt-identity67.5%
distribute-rgt-neg-in67.5%
mul-1-neg67.5%
distribute-lft-in67.5%
mul-1-neg67.5%
unsub-neg67.5%
Simplified67.5%
Final simplification67.5%
(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 94.6%
+-commutative94.6%
*-commutative94.6%
associate-*l/97.1%
fma-def97.1%
Simplified97.1%
Taylor expanded in z around 0 38.6%
Final simplification38.6%
(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 2024024
(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)))