
(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 (+ 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 91.8%
lift--.f64N/A
lift-*.f64N/A
remove-double-negN/A
remove-double-negN/A
lift-*.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6498.0
Applied egg-rr98.0%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (fma y (/ z t) x))) (if (<= y -1.9e-126) t_1 (if (<= y 1.6e+27) (fma (/ z t) (- x) x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma(y, (z / t), x);
double tmp;
if (y <= -1.9e-126) {
tmp = t_1;
} else if (y <= 1.6e+27) {
tmp = fma((z / t), -x, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(y, Float64(z / t), x) tmp = 0.0 if (y <= -1.9e-126) tmp = t_1; elseif (y <= 1.6e+27) tmp = fma(Float64(z / t), Float64(-x), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(z / t), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[y, -1.9e-126], t$95$1, If[LessEqual[y, 1.6e+27], N[(N[(z / t), $MachinePrecision] * (-x) + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, \frac{z}{t}, x\right)\\
\mathbf{if}\;y \leq -1.9 \cdot 10^{-126}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{+27}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t}, -x, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.8999999999999999e-126 or 1.60000000000000008e27 < y Initial program 90.3%
Taylor expanded in y around inf
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6483.2
Simplified83.2%
lift-/.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-/r/N/A
lift-/.f64N/A
div-invN/A
lift-/.f64N/A
clear-numN/A
lower-fma.f64N/A
lower-/.f6488.3
Applied egg-rr88.3%
if -1.8999999999999999e-126 < y < 1.60000000000000008e27Initial program 93.9%
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6498.2
Applied egg-rr98.2%
Taylor expanded in y around 0
mul-1-negN/A
lower-neg.f6493.1
Simplified93.1%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (fma y (/ z t) x))) (if (<= y -3.5e-66) t_1 (if (<= y 9e+26) (fma (- z) (/ x t) x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma(y, (z / t), x);
double tmp;
if (y <= -3.5e-66) {
tmp = t_1;
} else if (y <= 9e+26) {
tmp = fma(-z, (x / t), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(y, Float64(z / t), x) tmp = 0.0 if (y <= -3.5e-66) tmp = t_1; elseif (y <= 9e+26) tmp = fma(Float64(-z), Float64(x / t), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(z / t), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[y, -3.5e-66], t$95$1, If[LessEqual[y, 9e+26], N[((-z) * N[(x / t), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, \frac{z}{t}, x\right)\\
\mathbf{if}\;y \leq -3.5 \cdot 10^{-66}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 9 \cdot 10^{+26}:\\
\;\;\;\;\mathsf{fma}\left(-z, \frac{x}{t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -3.5e-66 or 8.99999999999999957e26 < y Initial program 89.4%
Taylor expanded in y around inf
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6485.1
Simplified85.1%
lift-/.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-/r/N/A
lift-/.f64N/A
div-invN/A
lift-/.f64N/A
clear-numN/A
lower-fma.f64N/A
lower-/.f6489.3
Applied egg-rr89.3%
if -3.5e-66 < y < 8.99999999999999957e26Initial program 94.6%
Taylor expanded in x around inf
mul-1-negN/A
unsub-negN/A
distribute-lft-out--N/A
*-rgt-identityN/A
associate-/l*N/A
lower--.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6488.4
Simplified88.4%
lift-*.f64N/A
lift-/.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower-/.f6489.1
Applied egg-rr89.1%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (fma y (/ z t) x))) (if (<= y -1.05e-56) t_1 (if (<= y 7e+26) (- x (/ (* x z) t)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma(y, (z / t), x);
double tmp;
if (y <= -1.05e-56) {
tmp = t_1;
} else if (y <= 7e+26) {
tmp = x - ((x * z) / t);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(y, Float64(z / t), x) tmp = 0.0 if (y <= -1.05e-56) tmp = t_1; elseif (y <= 7e+26) tmp = Float64(x - Float64(Float64(x * z) / t)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(z / t), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[y, -1.05e-56], t$95$1, If[LessEqual[y, 7e+26], N[(x - N[(N[(x * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, \frac{z}{t}, x\right)\\
\mathbf{if}\;y \leq -1.05 \cdot 10^{-56}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 7 \cdot 10^{+26}:\\
\;\;\;\;x - \frac{x \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.05000000000000003e-56 or 6.9999999999999998e26 < y Initial program 89.2%
Taylor expanded in y around inf
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6484.9
Simplified84.9%
lift-/.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-/r/N/A
lift-/.f64N/A
div-invN/A
lift-/.f64N/A
clear-numN/A
lower-fma.f64N/A
lower-/.f6489.2
Applied egg-rr89.2%
if -1.05000000000000003e-56 < y < 6.9999999999999998e26Initial program 94.6%
Taylor expanded in x around inf
mul-1-negN/A
unsub-negN/A
distribute-lft-out--N/A
*-rgt-identityN/A
associate-/l*N/A
lower--.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6488.6
Simplified88.6%
Final simplification88.9%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* z (/ (- y x) t)))) (if (<= z -6.2e+37) t_1 (if (<= z 8e-17) (+ x (/ (* y z) t)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = z * ((y - x) / t);
double tmp;
if (z <= -6.2e+37) {
tmp = t_1;
} else if (z <= 8e-17) {
tmp = x + ((y * z) / t);
} else {
tmp = t_1;
}
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 = z * ((y - x) / t)
if (z <= (-6.2d+37)) then
tmp = t_1
else if (z <= 8d-17) then
tmp = x + ((y * z) / t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = z * ((y - x) / t);
double tmp;
if (z <= -6.2e+37) {
tmp = t_1;
} else if (z <= 8e-17) {
tmp = x + ((y * z) / t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * ((y - x) / t) tmp = 0 if z <= -6.2e+37: tmp = t_1 elif z <= 8e-17: tmp = x + ((y * z) / t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(Float64(y - x) / t)) tmp = 0.0 if (z <= -6.2e+37) tmp = t_1; elseif (z <= 8e-17) tmp = Float64(x + Float64(Float64(y * z) / t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * ((y - x) / t); tmp = 0.0; if (z <= -6.2e+37) tmp = t_1; elseif (z <= 8e-17) tmp = x + ((y * z) / t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -6.2e+37], t$95$1, If[LessEqual[z, 8e-17], N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \frac{y - x}{t}\\
\mathbf{if}\;z \leq -6.2 \cdot 10^{+37}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 8 \cdot 10^{-17}:\\
\;\;\;\;x + \frac{y \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -6.2000000000000004e37 or 8.00000000000000057e-17 < z Initial program 84.9%
Taylor expanded in z around inf
div-subN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6486.7
Simplified86.7%
if -6.2000000000000004e37 < z < 8.00000000000000057e-17Initial program 97.9%
Taylor expanded in y around inf
lower-*.f6488.6
Simplified88.6%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* z (/ (- y x) t)))) (if (<= z -1.7e+40) t_1 (if (<= z 1.05e-13) (fma y (/ z t) x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = z * ((y - x) / t);
double tmp;
if (z <= -1.7e+40) {
tmp = t_1;
} else if (z <= 1.05e-13) {
tmp = fma(y, (z / t), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(z * Float64(Float64(y - x) / t)) tmp = 0.0 if (z <= -1.7e+40) tmp = t_1; elseif (z <= 1.05e-13) tmp = fma(y, Float64(z / t), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.7e+40], t$95$1, If[LessEqual[z, 1.05e-13], N[(y * N[(z / t), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \frac{y - x}{t}\\
\mathbf{if}\;z \leq -1.7 \cdot 10^{+40}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.05 \cdot 10^{-13}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z}{t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.69999999999999994e40 or 1.04999999999999994e-13 < z Initial program 84.9%
Taylor expanded in z around inf
div-subN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6486.7
Simplified86.7%
if -1.69999999999999994e40 < z < 1.04999999999999994e-13Initial program 97.9%
Taylor expanded in y around inf
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6483.9
Simplified83.9%
lift-/.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-/r/N/A
lift-/.f64N/A
div-invN/A
lift-/.f64N/A
clear-numN/A
lower-fma.f64N/A
lower-/.f6488.1
Applied egg-rr88.1%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (fma y (/ z t) x))) (if (<= t -3.8e-218) t_1 (if (<= t 5.6e-261) (- (/ (* x z) t)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma(y, (z / t), x);
double tmp;
if (t <= -3.8e-218) {
tmp = t_1;
} else if (t <= 5.6e-261) {
tmp = -((x * z) / t);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(y, Float64(z / t), x) tmp = 0.0 if (t <= -3.8e-218) tmp = t_1; elseif (t <= 5.6e-261) tmp = Float64(-Float64(Float64(x * z) / t)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(z / t), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t, -3.8e-218], t$95$1, If[LessEqual[t, 5.6e-261], (-N[(N[(x * z), $MachinePrecision] / t), $MachinePrecision]), t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, \frac{z}{t}, x\right)\\
\mathbf{if}\;t \leq -3.8 \cdot 10^{-218}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 5.6 \cdot 10^{-261}:\\
\;\;\;\;-\frac{x \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -3.7999999999999999e-218 or 5.60000000000000018e-261 < t Initial program 91.0%
Taylor expanded in y around inf
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6480.3
Simplified80.3%
lift-/.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-/r/N/A
lift-/.f64N/A
div-invN/A
lift-/.f64N/A
clear-numN/A
lower-fma.f64N/A
lower-/.f6482.3
Applied egg-rr82.3%
if -3.7999999999999999e-218 < t < 5.60000000000000018e-261Initial program 99.9%
Taylor expanded in x around inf
mul-1-negN/A
unsub-negN/A
distribute-lft-out--N/A
*-rgt-identityN/A
associate-/l*N/A
lower--.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6480.6
Simplified80.6%
Taylor expanded in z around inf
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lower-*.f64N/A
lower-neg.f6479.7
Simplified79.7%
Final simplification82.0%
(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 91.8%
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6497.7
Applied egg-rr97.7%
(FPCore (x y z t) :precision binary64 (fma y (/ z t) x))
double code(double x, double y, double z, double t) {
return fma(y, (z / t), x);
}
function code(x, y, z, t) return fma(y, Float64(z / t), x) end
code[x_, y_, z_, t_] := N[(y * N[(z / t), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, \frac{z}{t}, x\right)
\end{array}
Initial program 91.8%
Taylor expanded in y around inf
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6474.6
Simplified74.6%
lift-/.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-/r/N/A
lift-/.f64N/A
div-invN/A
lift-/.f64N/A
clear-numN/A
lower-fma.f64N/A
lower-/.f6478.6
Applied egg-rr78.6%
(FPCore (x y z t) :precision binary64 (* y (/ z t)))
double code(double x, double y, double z, double t) {
return y * (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 = y * (z / t)
end function
public static double code(double x, double y, double z, double t) {
return y * (z / t);
}
def code(x, y, z, t): return y * (z / t)
function code(x, y, z, t) return Float64(y * Float64(z / t)) end
function tmp = code(x, y, z, t) tmp = y * (z / t); end
code[x_, y_, z_, t_] := N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \frac{z}{t}
\end{array}
Initial program 91.8%
Taylor expanded in x around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6433.6
Simplified33.6%
lift-/.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-/r/N/A
lift-/.f64N/A
div-invN/A
lift-/.f64N/A
clear-numN/A
lower-*.f64N/A
lower-/.f6438.0
Applied egg-rr38.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 2024207
(FPCore (x y z t)
:name "Numeric.Histogram:binBounds from Chart-1.5.3"
:precision binary64
:alt
(! :herbie-platform default (if (< x -1805102239106601/200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- x (* (/ z t) (- x y))) (if (< x 855006432740143/2000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ x (* (/ (- y x) t) z)) (+ x (/ (- y x) (/ t z))))))
(+ x (/ (* (- y x) z) t)))