
(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 (if (<= z -4.1e-197) (+ x (/ z (/ t (- y x)))) (+ x (* (- y x) (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.1e-197) {
tmp = x + (z / (t / (y - x)));
} else {
tmp = x + ((y - 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) :: tmp
if (z <= (-4.1d-197)) then
tmp = x + (z / (t / (y - x)))
else
tmp = x + ((y - x) * (z / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.1e-197) {
tmp = x + (z / (t / (y - x)));
} else {
tmp = x + ((y - x) * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -4.1e-197: tmp = x + (z / (t / (y - x))) else: tmp = x + ((y - x) * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -4.1e-197) tmp = Float64(x + Float64(z / Float64(t / Float64(y - x)))); else tmp = Float64(x + Float64(Float64(y - x) * Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -4.1e-197) tmp = x + (z / (t / (y - x))); else tmp = x + ((y - x) * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -4.1e-197], N[(x + N[(z / N[(t / N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.1 \cdot 10^{-197}:\\
\;\;\;\;x + \frac{z}{\frac{t}{y - x}}\\
\mathbf{else}:\\
\;\;\;\;x + \left(y - x\right) \cdot \frac{z}{t}\\
\end{array}
\end{array}
if z < -4.1e-197Initial program 89.9%
associate-/l*95.7%
Simplified95.7%
Taylor expanded in y around 0 82.9%
+-commutative82.9%
associate-*r/83.0%
associate-/l*88.6%
associate-*r*88.6%
neg-mul-188.6%
distribute-rgt-out95.7%
sub-neg95.7%
associate-*l/89.9%
associate-*r/99.0%
Simplified99.0%
clear-num99.0%
un-div-inv99.7%
Applied egg-rr99.7%
if -4.1e-197 < z Initial program 95.3%
associate-/l*98.5%
Simplified98.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.4e-202) (not (<= z 3.7e-200))) (+ 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-202) || !(z <= 3.7e-200)) {
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-202)) .or. (.not. (z <= 3.7d-200))) 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-202) || !(z <= 3.7e-200)) {
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-202) or not (z <= 3.7e-200): 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-202) || !(z <= 3.7e-200)) 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-202) || ~((z <= 3.7e-200))) 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-202], N[Not[LessEqual[z, 3.7e-200]], $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^{-202} \lor \neg \left(z \leq 3.7 \cdot 10^{-200}\right):\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\end{array}
\end{array}
if z < -2.4000000000000001e-202 or 3.70000000000000011e-200 < z Initial program 92.5%
associate-/l*96.8%
Simplified96.8%
Taylor expanded in y around 0 86.1%
+-commutative86.1%
associate-*r/85.3%
associate-/l*88.9%
associate-*r*88.9%
neg-mul-188.9%
distribute-rgt-out96.8%
sub-neg96.8%
associate-*l/92.5%
associate-*r/96.8%
Simplified96.8%
if -2.4000000000000001e-202 < z < 3.70000000000000011e-200Initial program 94.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around inf 94.1%
associate-*r/99.0%
Simplified99.0%
clear-num99.0%
div-inv99.0%
Applied egg-rr99.0%
Final simplification97.2%
(FPCore (x y z t) :precision binary64 (if (or (<= x -7.8e+15) (not (<= x 1.6e+76))) (* x (- 1.0 (/ z t))) (+ x (/ y (/ t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -7.8e+15) || !(x <= 1.6e+76)) {
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 <= (-7.8d+15)) .or. (.not. (x <= 1.6d+76))) 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 <= -7.8e+15) || !(x <= 1.6e+76)) {
tmp = x * (1.0 - (z / t));
} else {
tmp = x + (y / (t / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -7.8e+15) or not (x <= 1.6e+76): 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 <= -7.8e+15) || !(x <= 1.6e+76)) 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 <= -7.8e+15) || ~((x <= 1.6e+76))) 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, -7.8e+15], N[Not[LessEqual[x, 1.6e+76]], $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 -7.8 \cdot 10^{+15} \lor \neg \left(x \leq 1.6 \cdot 10^{+76}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\end{array}
\end{array}
if x < -7.8e15 or 1.59999999999999988e76 < x Initial program 91.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in x around inf 92.6%
mul-1-neg92.6%
unsub-neg92.6%
Simplified92.6%
if -7.8e15 < x < 1.59999999999999988e76Initial program 93.4%
associate-/l*95.7%
Simplified95.7%
Taylor expanded in y around inf 82.4%
associate-*r/84.7%
Simplified84.7%
clear-num84.7%
div-inv85.3%
Applied egg-rr85.3%
Final simplification88.0%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2.3e-33) (not (<= y 1.82e-59))) (+ x (* y (/ z t))) (* x (- 1.0 (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.3e-33) || !(y <= 1.82e-59)) {
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 <= (-2.3d-33)) .or. (.not. (y <= 1.82d-59))) 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 <= -2.3e-33) || !(y <= 1.82e-59)) {
tmp = x + (y * (z / t));
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2.3e-33) or not (y <= 1.82e-59): 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 <= -2.3e-33) || !(y <= 1.82e-59)) 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 <= -2.3e-33) || ~((y <= 1.82e-59))) 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, -2.3e-33], N[Not[LessEqual[y, 1.82e-59]], $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 -2.3 \cdot 10^{-33} \lor \neg \left(y \leq 1.82 \cdot 10^{-59}\right):\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\end{array}
\end{array}
if y < -2.29999999999999986e-33 or 1.8199999999999999e-59 < y Initial program 91.7%
associate-/l*98.6%
Simplified98.6%
Taylor expanded in y around inf 86.2%
associate-*r/89.3%
Simplified89.3%
if -2.29999999999999986e-33 < y < 1.8199999999999999e-59Initial program 94.6%
associate-/l*95.4%
Simplified95.4%
Taylor expanded in x around inf 85.7%
mul-1-neg85.7%
unsub-neg85.7%
Simplified85.7%
Final simplification87.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.6e+110) (not (<= z 2.9e+96))) (* x (/ z (- t))) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.6e+110) || !(z <= 2.9e+96)) {
tmp = x * (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 <= (-1.6d+110)) .or. (.not. (z <= 2.9d+96))) then
tmp = x * (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 <= -1.6e+110) || !(z <= 2.9e+96)) {
tmp = x * (z / -t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.6e+110) or not (z <= 2.9e+96): tmp = x * (z / -t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.6e+110) || !(z <= 2.9e+96)) tmp = Float64(x * Float64(z / Float64(-t))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.6e+110) || ~((z <= 2.9e+96))) tmp = x * (z / -t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.6e+110], N[Not[LessEqual[z, 2.9e+96]], $MachinePrecision]], N[(x * N[(z / (-t)), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.6 \cdot 10^{+110} \lor \neg \left(z \leq 2.9 \cdot 10^{+96}\right):\\
\;\;\;\;x \cdot \frac{z}{-t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.59999999999999997e110 or 2.89999999999999978e96 < z Initial program 88.7%
associate-/l*93.2%
Simplified93.2%
Taylor expanded in x around inf 57.4%
mul-1-neg57.4%
unsub-neg57.4%
Simplified57.4%
Taylor expanded in z around inf 49.8%
mul-1-neg49.8%
distribute-frac-neg249.8%
Simplified49.8%
if -1.59999999999999997e110 < z < 2.89999999999999978e96Initial program 94.9%
associate-/l*99.3%
Simplified99.3%
Taylor expanded in z around 0 51.4%
Final simplification50.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.55e+111) (not (<= z 1.65e+97))) (* (/ x t) (- z)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.55e+111) || !(z <= 1.65e+97)) {
tmp = (x / t) * -z;
} 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.55d+111)) .or. (.not. (z <= 1.65d+97))) then
tmp = (x / t) * -z
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.55e+111) || !(z <= 1.65e+97)) {
tmp = (x / t) * -z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.55e+111) or not (z <= 1.65e+97): tmp = (x / t) * -z else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.55e+111) || !(z <= 1.65e+97)) tmp = Float64(Float64(x / t) * Float64(-z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.55e+111) || ~((z <= 1.65e+97))) tmp = (x / t) * -z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.55e+111], N[Not[LessEqual[z, 1.65e+97]], $MachinePrecision]], N[(N[(x / t), $MachinePrecision] * (-z)), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.55 \cdot 10^{+111} \lor \neg \left(z \leq 1.65 \cdot 10^{+97}\right):\\
\;\;\;\;\frac{x}{t} \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.55e111 or 1.6500000000000001e97 < z Initial program 88.7%
associate-/l*93.2%
Simplified93.2%
Taylor expanded in x around inf 57.4%
mul-1-neg57.4%
unsub-neg57.4%
Simplified57.4%
Taylor expanded in z around inf 49.8%
mul-1-neg49.8%
distribute-frac-neg249.8%
Simplified49.8%
associate-*r/40.6%
distribute-frac-neg240.6%
*-commutative40.6%
associate-/l*45.3%
Applied egg-rr45.3%
if -1.55e111 < z < 1.6500000000000001e97Initial program 94.9%
associate-/l*99.3%
Simplified99.3%
Taylor expanded in z around 0 51.4%
Final simplification49.4%
(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 92.9%
associate-/l*97.3%
Simplified97.3%
clear-num97.2%
un-div-inv97.6%
Applied egg-rr97.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.9%
associate-/l*97.3%
Simplified97.3%
(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 92.9%
associate-/l*97.3%
Simplified97.3%
Taylor expanded in x around inf 62.7%
mul-1-neg62.7%
unsub-neg62.7%
Simplified62.7%
(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.9%
associate-/l*97.3%
Simplified97.3%
Taylor expanded in z around 0 37.2%
(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 2024145
(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)))