
(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 9 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) (/ 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.1%
associate-/l*97.7%
Simplified97.7%
(FPCore (x y z t) :precision binary64 (if (or (<= x -8e+113) (not (<= x 5.8e+103))) (* x (- 1.0 (/ z t))) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -8e+113) || !(x <= 5.8e+103)) {
tmp = x * (1.0 - (z / t));
} else {
tmp = x + (y * (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 <= (-8d+113)) .or. (.not. (x <= 5.8d+103))) then
tmp = x * (1.0d0 - (z / t))
else
tmp = x + (y * (z / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -8e+113) || !(x <= 5.8e+103)) {
tmp = x * (1.0 - (z / t));
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -8e+113) or not (x <= 5.8e+103): tmp = x * (1.0 - (z / t)) else: tmp = x + (y * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -8e+113) || !(x <= 5.8e+103)) tmp = Float64(x * Float64(1.0 - Float64(z / t))); else tmp = Float64(x + Float64(y * Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -8e+113) || ~((x <= 5.8e+103))) tmp = x * (1.0 - (z / t)); else tmp = x + (y * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -8e+113], N[Not[LessEqual[x, 5.8e+103]], $MachinePrecision]], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8 \cdot 10^{+113} \lor \neg \left(x \leq 5.8 \cdot 10^{+103}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if x < -8e113 or 5.7999999999999997e103 < x Initial program 86.2%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in x around inf 94.0%
mul-1-neg94.0%
unsub-neg94.0%
Simplified94.0%
if -8e113 < x < 5.7999999999999997e103Initial program 94.9%
associate-/l*96.6%
Simplified96.6%
Taylor expanded in y around inf 83.4%
associate-*r/86.7%
Simplified86.7%
Final simplification89.0%
(FPCore (x y z t) :precision binary64 (if (<= x -1.25e+114) (- x (* z (/ x t))) (if (<= x 1.9e+104) (+ x (* y (/ z t))) (* x (- 1.0 (/ z t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.25e+114) {
tmp = x - (z * (x / t));
} else if (x <= 1.9e+104) {
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 (x <= (-1.25d+114)) then
tmp = x - (z * (x / t))
else if (x <= 1.9d+104) 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 (x <= -1.25e+114) {
tmp = x - (z * (x / t));
} else if (x <= 1.9e+104) {
tmp = x + (y * (z / t));
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.25e+114: tmp = x - (z * (x / t)) elif x <= 1.9e+104: tmp = x + (y * (z / t)) else: tmp = x * (1.0 - (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.25e+114) tmp = Float64(x - Float64(z * Float64(x / t))); elseif (x <= 1.9e+104) 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 (x <= -1.25e+114) tmp = x - (z * (x / t)); elseif (x <= 1.9e+104) tmp = x + (y * (z / t)); else tmp = x * (1.0 - (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.25e+114], N[(x - N[(z * N[(x / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.9e+104], 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}\;x \leq -1.25 \cdot 10^{+114}:\\
\;\;\;\;x - z \cdot \frac{x}{t}\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{+104}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\end{array}
\end{array}
if x < -1.25e114Initial program 83.0%
Taylor expanded in y around 0 76.5%
neg-mul-176.5%
Simplified76.5%
associate-/l*93.5%
add-sqr-sqrt93.4%
sqrt-unprod46.5%
sqr-neg46.5%
sqrt-unprod0.0%
add-sqr-sqrt45.4%
cancel-sign-sub45.4%
associate-/l*36.0%
*-commutative36.0%
associate-/l*45.4%
add-sqr-sqrt45.4%
sqrt-unprod7.7%
sqr-neg7.7%
sqrt-unprod0.0%
add-sqr-sqrt93.5%
Applied egg-rr93.5%
if -1.25e114 < x < 1.89999999999999984e104Initial program 94.9%
associate-/l*96.6%
Simplified96.6%
Taylor expanded in y around inf 83.4%
associate-*r/86.7%
Simplified86.7%
if 1.89999999999999984e104 < x Initial program 90.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in x around inf 94.7%
mul-1-neg94.7%
unsub-neg94.7%
Simplified94.7%
(FPCore (x y z t) :precision binary64 (if (<= t -6.2e+37) x (if (<= t 5.2e-171) (/ (- z) (/ t x)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -6.2e+37) {
tmp = x;
} else if (t <= 5.2e-171) {
tmp = -z / (t / x);
} 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 (t <= (-6.2d+37)) then
tmp = x
else if (t <= 5.2d-171) then
tmp = -z / (t / x)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -6.2e+37) {
tmp = x;
} else if (t <= 5.2e-171) {
tmp = -z / (t / x);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -6.2e+37: tmp = x elif t <= 5.2e-171: tmp = -z / (t / x) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -6.2e+37) tmp = x; elseif (t <= 5.2e-171) tmp = Float64(Float64(-z) / Float64(t / x)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -6.2e+37) tmp = x; elseif (t <= 5.2e-171) tmp = -z / (t / x); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -6.2e+37], x, If[LessEqual[t, 5.2e-171], N[((-z) / N[(t / x), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.2 \cdot 10^{+37}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 5.2 \cdot 10^{-171}:\\
\;\;\;\;\frac{-z}{\frac{t}{x}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -6.2000000000000004e37 or 5.2000000000000001e-171 < t Initial program 88.4%
associate-/l*97.3%
Simplified97.3%
Taylor expanded in z around 0 56.5%
if -6.2000000000000004e37 < t < 5.2000000000000001e-171Initial program 97.2%
associate-/l*98.1%
Simplified98.1%
Taylor expanded in x around inf 49.4%
mul-1-neg49.4%
unsub-neg49.4%
Simplified49.4%
Taylor expanded in z around inf 43.1%
mul-1-neg43.1%
*-commutative43.1%
distribute-neg-frac243.1%
associate-*r/43.9%
Simplified43.9%
distribute-frac-neg243.9%
distribute-rgt-neg-in43.9%
clear-num43.9%
div-inv43.9%
distribute-neg-frac43.9%
Applied egg-rr43.9%
(FPCore (x y z t) :precision binary64 (if (<= t -7.6e+37) x (if (<= t 5.2e-171) (* z (/ x (- t))) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -7.6e+37) {
tmp = x;
} else if (t <= 5.2e-171) {
tmp = z * (x / -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 (t <= (-7.6d+37)) then
tmp = x
else if (t <= 5.2d-171) then
tmp = z * (x / -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 (t <= -7.6e+37) {
tmp = x;
} else if (t <= 5.2e-171) {
tmp = z * (x / -t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -7.6e+37: tmp = x elif t <= 5.2e-171: tmp = z * (x / -t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -7.6e+37) tmp = x; elseif (t <= 5.2e-171) tmp = Float64(z * Float64(x / Float64(-t))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -7.6e+37) tmp = x; elseif (t <= 5.2e-171) tmp = z * (x / -t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -7.6e+37], x, If[LessEqual[t, 5.2e-171], N[(z * N[(x / (-t)), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.6 \cdot 10^{+37}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 5.2 \cdot 10^{-171}:\\
\;\;\;\;z \cdot \frac{x}{-t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -7.59999999999999979e37 or 5.2000000000000001e-171 < t Initial program 88.4%
associate-/l*97.3%
Simplified97.3%
Taylor expanded in z around 0 56.5%
if -7.59999999999999979e37 < t < 5.2000000000000001e-171Initial program 97.2%
associate-/l*98.1%
Simplified98.1%
Taylor expanded in x around inf 49.4%
mul-1-neg49.4%
unsub-neg49.4%
Simplified49.4%
Taylor expanded in z around inf 43.1%
mul-1-neg43.1%
*-commutative43.1%
distribute-neg-frac243.1%
associate-*r/43.9%
Simplified43.9%
(FPCore (x y z t) :precision binary64 (if (<= t -6.2e+37) x (if (<= t 3.4e-171) (* x (/ z (- t))) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -6.2e+37) {
tmp = x;
} else if (t <= 3.4e-171) {
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 (t <= (-6.2d+37)) then
tmp = x
else if (t <= 3.4d-171) 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 (t <= -6.2e+37) {
tmp = x;
} else if (t <= 3.4e-171) {
tmp = x * (z / -t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -6.2e+37: tmp = x elif t <= 3.4e-171: tmp = x * (z / -t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -6.2e+37) tmp = x; elseif (t <= 3.4e-171) 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 (t <= -6.2e+37) tmp = x; elseif (t <= 3.4e-171) tmp = x * (z / -t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -6.2e+37], x, If[LessEqual[t, 3.4e-171], N[(x * N[(z / (-t)), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.2 \cdot 10^{+37}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 3.4 \cdot 10^{-171}:\\
\;\;\;\;x \cdot \frac{z}{-t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -6.2000000000000004e37 or 3.39999999999999985e-171 < t Initial program 88.4%
associate-/l*97.3%
Simplified97.3%
Taylor expanded in z around 0 56.5%
if -6.2000000000000004e37 < t < 3.39999999999999985e-171Initial program 97.2%
associate-/l*98.1%
Simplified98.1%
Taylor expanded in x around inf 49.4%
mul-1-neg49.4%
unsub-neg49.4%
Simplified49.4%
Taylor expanded in z around inf 43.9%
associate-*r/43.9%
neg-mul-143.9%
Simplified43.9%
Final simplification51.3%
(FPCore (x y z t) :precision binary64 (if (<= z -6.2e+141) (/ (* x z) z) x))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -6.2e+141) {
tmp = (x * z) / 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 <= (-6.2d+141)) then
tmp = (x * z) / 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 <= -6.2e+141) {
tmp = (x * z) / z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -6.2e+141: tmp = (x * z) / z else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -6.2e+141) tmp = Float64(Float64(x * z) / z); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -6.2e+141) tmp = (x * z) / z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -6.2e+141], N[(N[(x * z), $MachinePrecision] / z), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.2 \cdot 10^{+141}:\\
\;\;\;\;\frac{x \cdot z}{z}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -6.20000000000000007e141Initial program 94.5%
Taylor expanded in y around 0 63.3%
neg-mul-163.3%
Simplified63.3%
Taylor expanded in z around inf 63.0%
mul-1-neg63.0%
+-commutative63.0%
unsub-neg63.0%
Simplified63.0%
Taylor expanded in z around 0 8.5%
associate-*r/27.9%
Applied egg-rr27.9%
if -6.20000000000000007e141 < z Initial program 91.8%
associate-/l*97.7%
Simplified97.7%
Taylor expanded in z around 0 40.4%
Final simplification38.8%
(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.1%
associate-/l*97.7%
Simplified97.7%
Taylor expanded in x around inf 60.7%
mul-1-neg60.7%
unsub-neg60.7%
Simplified60.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.1%
associate-/l*97.7%
Simplified97.7%
Taylor expanded in z around 0 36.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 2024165
(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)))