
(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 (+ 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.6%
associate-/l*98.8%
Simplified98.8%
Final simplification98.8%
(FPCore (x y z t) :precision binary64 (if (or (<= y -5.2e+59) (not (<= y 1.02e+46))) (+ x (* y (/ z t))) (* x (- 1.0 (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -5.2e+59) || !(y <= 1.02e+46)) {
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 <= (-5.2d+59)) .or. (.not. (y <= 1.02d+46))) 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 <= -5.2e+59) || !(y <= 1.02e+46)) {
tmp = x + (y * (z / t));
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -5.2e+59) or not (y <= 1.02e+46): 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 <= -5.2e+59) || !(y <= 1.02e+46)) 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 <= -5.2e+59) || ~((y <= 1.02e+46))) 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, -5.2e+59], N[Not[LessEqual[y, 1.02e+46]], $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 -5.2 \cdot 10^{+59} \lor \neg \left(y \leq 1.02 \cdot 10^{+46}\right):\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\end{array}
\end{array}
if y < -5.19999999999999999e59 or 1.0199999999999999e46 < y Initial program 89.3%
Taylor expanded in y around inf 85.4%
associate-*r/93.3%
Simplified93.3%
if -5.19999999999999999e59 < y < 1.0199999999999999e46Initial program 95.0%
+-commutative95.0%
*-commutative95.0%
associate-*l/98.6%
fma-def98.6%
Simplified98.6%
Taylor expanded in y around 0 82.6%
*-rgt-identity82.6%
mul-1-neg82.6%
associate-*r/85.8%
distribute-rgt-neg-in85.8%
mul-1-neg85.8%
distribute-lft-in85.8%
mul-1-neg85.8%
unsub-neg85.8%
Simplified85.8%
Final simplification88.9%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2.7e+62) (not (<= y 1.45e+46))) (+ x (/ y (/ t z))) (* x (- 1.0 (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.7e+62) || !(y <= 1.45e+46)) {
tmp = x + (y / (t / z));
} 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.7d+62)) .or. (.not. (y <= 1.45d+46))) then
tmp = x + (y / (t / z))
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.7e+62) || !(y <= 1.45e+46)) {
tmp = x + (y / (t / z));
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2.7e+62) or not (y <= 1.45e+46): tmp = x + (y / (t / z)) else: tmp = x * (1.0 - (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2.7e+62) || !(y <= 1.45e+46)) tmp = Float64(x + Float64(y / Float64(t / z))); 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.7e+62) || ~((y <= 1.45e+46))) tmp = x + (y / (t / z)); else tmp = x * (1.0 - (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2.7e+62], N[Not[LessEqual[y, 1.45e+46]], $MachinePrecision]], N[(x + N[(y / N[(t / z), $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.7 \cdot 10^{+62} \lor \neg \left(y \leq 1.45 \cdot 10^{+46}\right):\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\end{array}
\end{array}
if y < -2.7e62 or 1.4500000000000001e46 < y Initial program 89.3%
Taylor expanded in y around inf 85.4%
associate-*r/93.3%
Simplified93.3%
clear-num93.3%
un-div-inv93.3%
Applied egg-rr93.3%
if -2.7e62 < y < 1.4500000000000001e46Initial program 95.0%
+-commutative95.0%
*-commutative95.0%
associate-*l/98.6%
fma-def98.6%
Simplified98.6%
Taylor expanded in y around 0 82.6%
*-rgt-identity82.6%
mul-1-neg82.6%
associate-*r/85.8%
distribute-rgt-neg-in85.8%
mul-1-neg85.8%
distribute-lft-in85.8%
mul-1-neg85.8%
unsub-neg85.8%
Simplified85.8%
Final simplification88.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -6e+98) (not (<= z 3.7e+18))) (* x (/ (- z) t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6e+98) || !(z <= 3.7e+18)) {
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 <= (-6d+98)) .or. (.not. (z <= 3.7d+18))) 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 <= -6e+98) || !(z <= 3.7e+18)) {
tmp = x * (-z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -6e+98) or not (z <= 3.7e+18): tmp = x * (-z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -6e+98) || !(z <= 3.7e+18)) tmp = Float64(x * Float64(Float64(-z) / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -6e+98) || ~((z <= 3.7e+18))) tmp = x * (-z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -6e+98], N[Not[LessEqual[z, 3.7e+18]], $MachinePrecision]], N[(x * N[((-z) / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6 \cdot 10^{+98} \lor \neg \left(z \leq 3.7 \cdot 10^{+18}\right):\\
\;\;\;\;x \cdot \frac{-z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -6.0000000000000003e98 or 3.7e18 < z Initial program 87.0%
+-commutative87.0%
*-commutative87.0%
associate-*l/98.1%
fma-def98.1%
Simplified98.1%
Taylor expanded in y around 0 57.0%
*-rgt-identity57.0%
mul-1-neg57.0%
associate-*r/63.2%
distribute-rgt-neg-in63.2%
mul-1-neg63.2%
distribute-lft-in63.2%
mul-1-neg63.2%
unsub-neg63.2%
Simplified63.2%
Taylor expanded in z around inf 54.6%
mul-1-neg54.6%
distribute-frac-neg54.6%
Simplified54.6%
if -6.0000000000000003e98 < z < 3.7e18Initial program 96.7%
+-commutative96.7%
*-commutative96.7%
associate-*l/99.2%
fma-def99.2%
Simplified99.2%
Taylor expanded in z around 0 60.3%
Final simplification57.9%
(FPCore (x y z t) :precision binary64 (if (<= z -1.35e+106) (/ x (/ (- t) z)) (if (<= z 1.42e+17) x (* x (/ (- z) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.35e+106) {
tmp = x / (-t / z);
} else if (z <= 1.42e+17) {
tmp = x;
} 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) :: tmp
if (z <= (-1.35d+106)) then
tmp = x / (-t / z)
else if (z <= 1.42d+17) then
tmp = x
else
tmp = 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 <= -1.35e+106) {
tmp = x / (-t / z);
} else if (z <= 1.42e+17) {
tmp = x;
} else {
tmp = x * (-z / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.35e+106: tmp = x / (-t / z) elif z <= 1.42e+17: tmp = x else: tmp = x * (-z / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.35e+106) tmp = Float64(x / Float64(Float64(-t) / z)); elseif (z <= 1.42e+17) tmp = x; else tmp = Float64(x * Float64(Float64(-z) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.35e+106) tmp = x / (-t / z); elseif (z <= 1.42e+17) tmp = x; else tmp = x * (-z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.35e+106], N[(x / N[((-t) / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.42e+17], x, N[(x * N[((-z) / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.35 \cdot 10^{+106}:\\
\;\;\;\;\frac{x}{\frac{-t}{z}}\\
\mathbf{elif}\;z \leq 1.42 \cdot 10^{+17}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-z}{t}\\
\end{array}
\end{array}
if z < -1.35000000000000003e106Initial program 83.0%
+-commutative83.0%
*-commutative83.0%
associate-*l/99.7%
fma-def99.7%
Simplified99.7%
Taylor expanded in y around 0 55.8%
*-rgt-identity55.8%
mul-1-neg55.8%
associate-*r/61.5%
distribute-rgt-neg-in61.5%
mul-1-neg61.5%
distribute-lft-in61.5%
mul-1-neg61.5%
unsub-neg61.5%
Simplified61.5%
Taylor expanded in z around inf 53.8%
mul-1-neg53.8%
distribute-frac-neg53.8%
Simplified53.8%
expm1-log1p-u21.8%
expm1-udef20.4%
add-sqr-sqrt20.4%
sqrt-unprod21.8%
sqr-neg21.8%
sqrt-unprod0.0%
add-sqr-sqrt9.1%
Applied egg-rr9.1%
expm1-def9.2%
expm1-log1p11.3%
associate-*r/5.8%
associate-*l/5.7%
Simplified5.7%
associate-*l/5.8%
associate-/l*11.3%
add-sqr-sqrt8.6%
sqrt-unprod23.9%
sqr-neg23.9%
sqrt-unprod20.3%
add-sqr-sqrt53.9%
frac-2neg53.9%
add-sqr-sqrt20.3%
sqrt-unprod23.9%
sqr-neg23.9%
sqrt-unprod8.6%
add-sqr-sqrt11.3%
add-sqr-sqrt2.7%
sqrt-unprod30.4%
sqr-neg30.4%
sqrt-unprod33.4%
add-sqr-sqrt53.9%
Applied egg-rr53.9%
distribute-neg-frac53.9%
Simplified53.9%
if -1.35000000000000003e106 < z < 1.42e17Initial program 96.7%
+-commutative96.7%
*-commutative96.7%
associate-*l/99.2%
fma-def99.2%
Simplified99.2%
Taylor expanded in z around 0 60.3%
if 1.42e17 < z Initial program 90.4%
+-commutative90.4%
*-commutative90.4%
associate-*l/96.8%
fma-def96.8%
Simplified96.8%
Taylor expanded in y around 0 58.1%
*-rgt-identity58.1%
mul-1-neg58.1%
associate-*r/64.7%
distribute-rgt-neg-in64.7%
mul-1-neg64.7%
distribute-lft-in64.7%
mul-1-neg64.7%
unsub-neg64.7%
Simplified64.7%
Taylor expanded in z around inf 55.2%
mul-1-neg55.2%
distribute-frac-neg55.2%
Simplified55.2%
Final simplification57.9%
(FPCore (x y z t) :precision binary64 (if (<= y -8.6e+169) (+ x (/ y (/ t z))) (+ x (/ (* (- y x) z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -8.6e+169) {
tmp = x + (y / (t / z));
} 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 (y <= (-8.6d+169)) then
tmp = x + (y / (t / z))
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 (y <= -8.6e+169) {
tmp = x + (y / (t / z));
} else {
tmp = x + (((y - x) * z) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -8.6e+169: tmp = x + (y / (t / z)) else: tmp = x + (((y - x) * z) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -8.6e+169) tmp = Float64(x + Float64(y / Float64(t / z))); else tmp = Float64(x + Float64(Float64(Float64(y - x) * z) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -8.6e+169) tmp = x + (y / (t / z)); else tmp = x + (((y - x) * z) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -8.6e+169], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.6 \cdot 10^{+169}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{\left(y - x\right) \cdot z}{t}\\
\end{array}
\end{array}
if y < -8.6000000000000003e169Initial program 75.2%
Taylor expanded in y around inf 78.3%
associate-*r/96.6%
Simplified96.6%
clear-num96.6%
un-div-inv96.8%
Applied egg-rr96.8%
if -8.6000000000000003e169 < y Initial program 94.9%
Final simplification95.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 92.6%
+-commutative92.6%
*-commutative92.6%
associate-*l/98.7%
fma-def98.7%
Simplified98.7%
Taylor expanded in y around 0 64.5%
*-rgt-identity64.5%
mul-1-neg64.5%
associate-*r/67.9%
distribute-rgt-neg-in67.9%
mul-1-neg67.9%
distribute-lft-in67.9%
mul-1-neg67.9%
unsub-neg67.9%
Simplified67.9%
Final simplification67.9%
(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.6%
+-commutative92.6%
*-commutative92.6%
associate-*l/98.7%
fma-def98.7%
Simplified98.7%
Taylor expanded in z around 0 39.5%
Final simplification39.5%
(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 2024020
(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)))