
(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 95.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6497.9
Applied rewrites97.9%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (+ x (/ (* y z) t)))) (if (<= y -9.2e-98) t_1 (if (<= y 6.5e-40) (fma (/ z t) (- x) x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x + ((y * z) / t);
double tmp;
if (y <= -9.2e-98) {
tmp = t_1;
} else if (y <= 6.5e-40) {
tmp = fma((z / t), -x, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(x + Float64(Float64(y * z) / t)) tmp = 0.0 if (y <= -9.2e-98) tmp = t_1; elseif (y <= 6.5e-40) 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[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -9.2e-98], t$95$1, If[LessEqual[y, 6.5e-40], N[(N[(z / t), $MachinePrecision] * (-x) + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y \cdot z}{t}\\
\mathbf{if}\;y \leq -9.2 \cdot 10^{-98}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 6.5 \cdot 10^{-40}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t}, -x, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -9.20000000000000002e-98 or 6.4999999999999999e-40 < y Initial program 96.8%
Taylor expanded in y around inf
lower-*.f6491.5
Applied rewrites91.5%
if -9.20000000000000002e-98 < y < 6.4999999999999999e-40Initial program 94.1%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6498.0
Applied rewrites98.0%
Taylor expanded in y around 0
mul-1-negN/A
lower-neg.f6491.3
Applied rewrites91.3%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (+ x (/ (* y z) t)))) (if (<= y -9.2e-98) t_1 (if (<= y 6.5e-40) (- x (* x (/ z t))) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x + ((y * z) / t);
double tmp;
if (y <= -9.2e-98) {
tmp = t_1;
} else if (y <= 6.5e-40) {
tmp = x - (x * (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 = x + ((y * z) / t)
if (y <= (-9.2d-98)) then
tmp = t_1
else if (y <= 6.5d-40) then
tmp = x - (x * (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 = x + ((y * z) / t);
double tmp;
if (y <= -9.2e-98) {
tmp = t_1;
} else if (y <= 6.5e-40) {
tmp = x - (x * (z / t));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + ((y * z) / t) tmp = 0 if y <= -9.2e-98: tmp = t_1 elif y <= 6.5e-40: tmp = x - (x * (z / t)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(Float64(y * z) / t)) tmp = 0.0 if (y <= -9.2e-98) tmp = t_1; elseif (y <= 6.5e-40) tmp = Float64(x - Float64(x * Float64(z / t))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + ((y * z) / t); tmp = 0.0; if (y <= -9.2e-98) tmp = t_1; elseif (y <= 6.5e-40) tmp = x - (x * (z / t)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -9.2e-98], t$95$1, If[LessEqual[y, 6.5e-40], N[(x - N[(x * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y \cdot z}{t}\\
\mathbf{if}\;y \leq -9.2 \cdot 10^{-98}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 6.5 \cdot 10^{-40}:\\
\;\;\;\;x - x \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -9.20000000000000002e-98 or 6.4999999999999999e-40 < y Initial program 96.8%
Taylor expanded in y around inf
lower-*.f6491.5
Applied rewrites91.5%
if -9.20000000000000002e-98 < y < 6.4999999999999999e-40Initial program 94.1%
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-*.f6489.2
Applied rewrites89.2%
Applied rewrites91.2%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (- x (* x (/ z t))))) (if (<= t -2500000.0) t_1 (if (<= t 4.9e-24) (* (- y x) (/ z t)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x - (x * (z / t));
double tmp;
if (t <= -2500000.0) {
tmp = t_1;
} else if (t <= 4.9e-24) {
tmp = (y - x) * (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 = x - (x * (z / t))
if (t <= (-2500000.0d0)) then
tmp = t_1
else if (t <= 4.9d-24) then
tmp = (y - x) * (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 = x - (x * (z / t));
double tmp;
if (t <= -2500000.0) {
tmp = t_1;
} else if (t <= 4.9e-24) {
tmp = (y - x) * (z / t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x - (x * (z / t)) tmp = 0 if t <= -2500000.0: tmp = t_1 elif t <= 4.9e-24: tmp = (y - x) * (z / t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x - Float64(x * Float64(z / t))) tmp = 0.0 if (t <= -2500000.0) tmp = t_1; elseif (t <= 4.9e-24) tmp = Float64(Float64(y - x) * Float64(z / t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x - (x * (z / t)); tmp = 0.0; if (t <= -2500000.0) tmp = t_1; elseif (t <= 4.9e-24) tmp = (y - x) * (z / t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x - N[(x * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -2500000.0], t$95$1, If[LessEqual[t, 4.9e-24], N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - x \cdot \frac{z}{t}\\
\mathbf{if}\;t \leq -2500000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 4.9 \cdot 10^{-24}:\\
\;\;\;\;\left(y - x\right) \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -2.5e6 or 4.9000000000000001e-24 < t Initial program 93.1%
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-*.f6474.0
Applied rewrites74.0%
Applied rewrites78.2%
if -2.5e6 < t < 4.9000000000000001e-24Initial program 98.3%
Taylor expanded in z around inf
div-subN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6482.5
Applied rewrites82.5%
Applied rewrites87.3%
Final simplification82.8%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* y (/ z t)))) (if (<= y -1.3e-97) t_1 (if (<= y 4.8e-44) (* z (/ (- x) t)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = y * (z / t);
double tmp;
if (y <= -1.3e-97) {
tmp = t_1;
} else if (y <= 4.8e-44) {
tmp = z * (-x / 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 = y * (z / t)
if (y <= (-1.3d-97)) then
tmp = t_1
else if (y <= 4.8d-44) then
tmp = z * (-x / 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 = y * (z / t);
double tmp;
if (y <= -1.3e-97) {
tmp = t_1;
} else if (y <= 4.8e-44) {
tmp = z * (-x / t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (z / t) tmp = 0 if y <= -1.3e-97: tmp = t_1 elif y <= 4.8e-44: tmp = z * (-x / t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(z / t)) tmp = 0.0 if (y <= -1.3e-97) tmp = t_1; elseif (y <= 4.8e-44) tmp = Float64(z * Float64(Float64(-x) / t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (z / t); tmp = 0.0; if (y <= -1.3e-97) tmp = t_1; elseif (y <= 4.8e-44) tmp = z * (-x / t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.3e-97], t$95$1, If[LessEqual[y, 4.8e-44], N[(z * N[((-x) / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z}{t}\\
\mathbf{if}\;y \leq -1.3 \cdot 10^{-97}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 4.8 \cdot 10^{-44}:\\
\;\;\;\;z \cdot \frac{-x}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.30000000000000003e-97 or 4.80000000000000017e-44 < y Initial program 96.2%
Taylor expanded in x around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6457.2
Applied rewrites57.2%
Applied rewrites61.1%
if -1.30000000000000003e-97 < y < 4.80000000000000017e-44Initial program 95.0%
Taylor expanded in z around inf
div-subN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6452.7
Applied rewrites52.7%
Taylor expanded in y around 0
Applied rewrites48.9%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* y (/ z t)))) (if (<= y -1.3e-97) t_1 (if (<= y 4.8e-44) (/ (* x (- z)) t) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = y * (z / t);
double tmp;
if (y <= -1.3e-97) {
tmp = t_1;
} else if (y <= 4.8e-44) {
tmp = (x * -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 = y * (z / t)
if (y <= (-1.3d-97)) then
tmp = t_1
else if (y <= 4.8d-44) then
tmp = (x * -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 = y * (z / t);
double tmp;
if (y <= -1.3e-97) {
tmp = t_1;
} else if (y <= 4.8e-44) {
tmp = (x * -z) / t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (z / t) tmp = 0 if y <= -1.3e-97: tmp = t_1 elif y <= 4.8e-44: tmp = (x * -z) / t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(z / t)) tmp = 0.0 if (y <= -1.3e-97) tmp = t_1; elseif (y <= 4.8e-44) tmp = Float64(Float64(x * Float64(-z)) / t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (z / t); tmp = 0.0; if (y <= -1.3e-97) tmp = t_1; elseif (y <= 4.8e-44) tmp = (x * -z) / t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.3e-97], t$95$1, If[LessEqual[y, 4.8e-44], N[(N[(x * (-z)), $MachinePrecision] / t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z}{t}\\
\mathbf{if}\;y \leq -1.3 \cdot 10^{-97}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 4.8 \cdot 10^{-44}:\\
\;\;\;\;\frac{x \cdot \left(-z\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.30000000000000003e-97 or 4.80000000000000017e-44 < y Initial program 96.2%
Taylor expanded in x around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6457.2
Applied rewrites57.2%
Applied rewrites61.1%
if -1.30000000000000003e-97 < y < 4.80000000000000017e-44Initial program 95.0%
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-*.f6490.1
Applied rewrites90.1%
Taylor expanded in z around inf
Applied rewrites48.3%
Final simplification56.2%
(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 95.8%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6497.9
Applied rewrites97.9%
(FPCore (x y z t) :precision binary64 (* (- y x) (/ z t)))
double code(double x, double y, double z, double t) {
return (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 = (y - x) * (z / t)
end function
public static double code(double x, double y, double z, double t) {
return (y - x) * (z / t);
}
def code(x, y, z, t): return (y - x) * (z / t)
function code(x, y, z, t) return Float64(Float64(y - x) * Float64(z / t)) end
function tmp = code(x, y, z, t) tmp = (y - x) * (z / t); end
code[x_, y_, z_, t_] := N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(y - x\right) \cdot \frac{z}{t}
\end{array}
Initial program 95.8%
Taylor expanded in z around inf
div-subN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6459.3
Applied rewrites59.3%
Applied rewrites62.0%
Final simplification62.0%
(FPCore (x y z t) :precision binary64 (* z (/ (- y x) t)))
double code(double x, double y, double z, double t) {
return z * ((y - x) / 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 = z * ((y - x) / t)
end function
public static double code(double x, double y, double z, double t) {
return z * ((y - x) / t);
}
def code(x, y, z, t): return z * ((y - x) / t)
function code(x, y, z, t) return Float64(z * Float64(Float64(y - x) / t)) end
function tmp = code(x, y, z, t) tmp = z * ((y - x) / t); end
code[x_, y_, z_, t_] := N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
z \cdot \frac{y - x}{t}
\end{array}
Initial program 95.8%
Taylor expanded in z around inf
div-subN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6459.3
Applied rewrites59.3%
(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 95.8%
Taylor expanded in x around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6437.9
Applied rewrites37.9%
Applied rewrites41.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 2024238
(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)))