
(FPCore (x y z) :precision binary64 (/ (+ x y) (- 1.0 (/ y z))))
double code(double x, double y, double z) {
return (x + y) / (1.0 - (y / z));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + y) / (1.0d0 - (y / z))
end function
public static double code(double x, double y, double z) {
return (x + y) / (1.0 - (y / z));
}
def code(x, y, z): return (x + y) / (1.0 - (y / z))
function code(x, y, z) return Float64(Float64(x + y) / Float64(1.0 - Float64(y / z))) end
function tmp = code(x, y, z) tmp = (x + y) / (1.0 - (y / z)); end
code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + y}{1 - \frac{y}{z}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 7 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (+ x y) (- 1.0 (/ y z))))
double code(double x, double y, double z) {
return (x + y) / (1.0 - (y / z));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + y) / (1.0d0 - (y / z))
end function
public static double code(double x, double y, double z) {
return (x + y) / (1.0 - (y / z));
}
def code(x, y, z): return (x + y) / (1.0 - (y / z))
function code(x, y, z) return Float64(Float64(x + y) / Float64(1.0 - Float64(y / z))) end
function tmp = code(x, y, z) tmp = (x + y) / (1.0 - (y / z)); end
code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + y}{1 - \frac{y}{z}}
\end{array}
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- 1.0 (/ y z))) (t_1 (/ (+ x y) t_0)))
(if (<= t_1 -2e-272)
t_1
(if (<= t_1 0.0) (/ (- z) (/ y (+ x y))) (* (+ x y) (/ 1.0 t_0))))))
double code(double x, double y, double z) {
double t_0 = 1.0 - (y / z);
double t_1 = (x + y) / t_0;
double tmp;
if (t_1 <= -2e-272) {
tmp = t_1;
} else if (t_1 <= 0.0) {
tmp = -z / (y / (x + y));
} else {
tmp = (x + y) * (1.0 / t_0);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 - (y / z)
t_1 = (x + y) / t_0
if (t_1 <= (-2d-272)) then
tmp = t_1
else if (t_1 <= 0.0d0) then
tmp = -z / (y / (x + y))
else
tmp = (x + y) * (1.0d0 / t_0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 1.0 - (y / z);
double t_1 = (x + y) / t_0;
double tmp;
if (t_1 <= -2e-272) {
tmp = t_1;
} else if (t_1 <= 0.0) {
tmp = -z / (y / (x + y));
} else {
tmp = (x + y) * (1.0 / t_0);
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 - (y / z) t_1 = (x + y) / t_0 tmp = 0 if t_1 <= -2e-272: tmp = t_1 elif t_1 <= 0.0: tmp = -z / (y / (x + y)) else: tmp = (x + y) * (1.0 / t_0) return tmp
function code(x, y, z) t_0 = Float64(1.0 - Float64(y / z)) t_1 = Float64(Float64(x + y) / t_0) tmp = 0.0 if (t_1 <= -2e-272) tmp = t_1; elseif (t_1 <= 0.0) tmp = Float64(Float64(-z) / Float64(y / Float64(x + y))); else tmp = Float64(Float64(x + y) * Float64(1.0 / t_0)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = 1.0 - (y / z); t_1 = (x + y) / t_0; tmp = 0.0; if (t_1 <= -2e-272) tmp = t_1; elseif (t_1 <= 0.0) tmp = -z / (y / (x + y)); else tmp = (x + y) * (1.0 / t_0); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x + y), $MachinePrecision] / t$95$0), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-272], t$95$1, If[LessEqual[t$95$1, 0.0], N[((-z) / N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + y), $MachinePrecision] * N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \frac{y}{z}\\
t_1 := \frac{x + y}{t_0}\\
\mathbf{if}\;t_1 \leq -2 \cdot 10^{-272}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;\frac{-z}{\frac{y}{x + y}}\\
\mathbf{else}:\\
\;\;\;\;\left(x + y\right) \cdot \frac{1}{t_0}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x y) (-.f64 1 (/.f64 y z))) < -1.99999999999999986e-272Initial program 99.9%
if -1.99999999999999986e-272 < (/.f64 (+.f64 x y) (-.f64 1 (/.f64 y z))) < 0.0Initial program 6.0%
Taylor expanded in z around 0 99.7%
mul-1-neg99.7%
associate-/l*100.0%
distribute-neg-frac100.0%
+-commutative100.0%
Simplified100.0%
if 0.0 < (/.f64 (+.f64 x y) (-.f64 1 (/.f64 y z))) Initial program 99.8%
clear-num99.6%
associate-/r/99.8%
Applied egg-rr99.8%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (let* ((t_0 (/ (+ x y) (- 1.0 (/ y z))))) (if (or (<= t_0 -2e-272) (not (<= t_0 0.0))) t_0 (/ (- z) (/ y (+ x y))))))
double code(double x, double y, double z) {
double t_0 = (x + y) / (1.0 - (y / z));
double tmp;
if ((t_0 <= -2e-272) || !(t_0 <= 0.0)) {
tmp = t_0;
} else {
tmp = -z / (y / (x + y));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = (x + y) / (1.0d0 - (y / z))
if ((t_0 <= (-2d-272)) .or. (.not. (t_0 <= 0.0d0))) then
tmp = t_0
else
tmp = -z / (y / (x + y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (x + y) / (1.0 - (y / z));
double tmp;
if ((t_0 <= -2e-272) || !(t_0 <= 0.0)) {
tmp = t_0;
} else {
tmp = -z / (y / (x + y));
}
return tmp;
}
def code(x, y, z): t_0 = (x + y) / (1.0 - (y / z)) tmp = 0 if (t_0 <= -2e-272) or not (t_0 <= 0.0): tmp = t_0 else: tmp = -z / (y / (x + y)) return tmp
function code(x, y, z) t_0 = Float64(Float64(x + y) / Float64(1.0 - Float64(y / z))) tmp = 0.0 if ((t_0 <= -2e-272) || !(t_0 <= 0.0)) tmp = t_0; else tmp = Float64(Float64(-z) / Float64(y / Float64(x + y))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x + y) / (1.0 - (y / z)); tmp = 0.0; if ((t_0 <= -2e-272) || ~((t_0 <= 0.0))) tmp = t_0; else tmp = -z / (y / (x + y)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x + y), $MachinePrecision] / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -2e-272], N[Not[LessEqual[t$95$0, 0.0]], $MachinePrecision]], t$95$0, N[((-z) / N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x + y}{1 - \frac{y}{z}}\\
\mathbf{if}\;t_0 \leq -2 \cdot 10^{-272} \lor \neg \left(t_0 \leq 0\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{-z}{\frac{y}{x + y}}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x y) (-.f64 1 (/.f64 y z))) < -1.99999999999999986e-272 or 0.0 < (/.f64 (+.f64 x y) (-.f64 1 (/.f64 y z))) Initial program 99.8%
if -1.99999999999999986e-272 < (/.f64 (+.f64 x y) (-.f64 1 (/.f64 y z))) < 0.0Initial program 6.0%
Taylor expanded in z around 0 99.7%
mul-1-neg99.7%
associate-/l*100.0%
distribute-neg-frac100.0%
+-commutative100.0%
Simplified100.0%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(if (<= y -6e+142)
(- z)
(if (<= y -15000000000.0)
y
(if (<= y -2.6e-56)
x
(if (<= y -1.8e-126) y (if (<= y 1.06e-38) x (- z)))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -6e+142) {
tmp = -z;
} else if (y <= -15000000000.0) {
tmp = y;
} else if (y <= -2.6e-56) {
tmp = x;
} else if (y <= -1.8e-126) {
tmp = y;
} else if (y <= 1.06e-38) {
tmp = x;
} else {
tmp = -z;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-6d+142)) then
tmp = -z
else if (y <= (-15000000000.0d0)) then
tmp = y
else if (y <= (-2.6d-56)) then
tmp = x
else if (y <= (-1.8d-126)) then
tmp = y
else if (y <= 1.06d-38) then
tmp = x
else
tmp = -z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -6e+142) {
tmp = -z;
} else if (y <= -15000000000.0) {
tmp = y;
} else if (y <= -2.6e-56) {
tmp = x;
} else if (y <= -1.8e-126) {
tmp = y;
} else if (y <= 1.06e-38) {
tmp = x;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -6e+142: tmp = -z elif y <= -15000000000.0: tmp = y elif y <= -2.6e-56: tmp = x elif y <= -1.8e-126: tmp = y elif y <= 1.06e-38: tmp = x else: tmp = -z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -6e+142) tmp = Float64(-z); elseif (y <= -15000000000.0) tmp = y; elseif (y <= -2.6e-56) tmp = x; elseif (y <= -1.8e-126) tmp = y; elseif (y <= 1.06e-38) tmp = x; else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -6e+142) tmp = -z; elseif (y <= -15000000000.0) tmp = y; elseif (y <= -2.6e-56) tmp = x; elseif (y <= -1.8e-126) tmp = y; elseif (y <= 1.06e-38) tmp = x; else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -6e+142], (-z), If[LessEqual[y, -15000000000.0], y, If[LessEqual[y, -2.6e-56], x, If[LessEqual[y, -1.8e-126], y, If[LessEqual[y, 1.06e-38], x, (-z)]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6 \cdot 10^{+142}:\\
\;\;\;\;-z\\
\mathbf{elif}\;y \leq -15000000000:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq -2.6 \cdot 10^{-56}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -1.8 \cdot 10^{-126}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 1.06 \cdot 10^{-38}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if y < -5.99999999999999949e142 or 1.06000000000000001e-38 < y Initial program 66.0%
Taylor expanded in y around inf 79.5%
mul-1-neg79.5%
Simplified79.5%
if -5.99999999999999949e142 < y < -1.5e10 or -2.59999999999999997e-56 < y < -1.8e-126Initial program 95.7%
Taylor expanded in x around 0 57.2%
Taylor expanded in y around 0 42.6%
if -1.5e10 < y < -2.59999999999999997e-56 or -1.8e-126 < y < 1.06000000000000001e-38Initial program 99.9%
Taylor expanded in y around 0 73.1%
Final simplification70.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -5.9e+51) (not (<= z 9e-37))) (+ x y) (/ (- z) (/ y (+ x y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -5.9e+51) || !(z <= 9e-37)) {
tmp = x + y;
} else {
tmp = -z / (y / (x + y));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-5.9d+51)) .or. (.not. (z <= 9d-37))) then
tmp = x + y
else
tmp = -z / (y / (x + y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -5.9e+51) || !(z <= 9e-37)) {
tmp = x + y;
} else {
tmp = -z / (y / (x + y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -5.9e+51) or not (z <= 9e-37): tmp = x + y else: tmp = -z / (y / (x + y)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -5.9e+51) || !(z <= 9e-37)) tmp = Float64(x + y); else tmp = Float64(Float64(-z) / Float64(y / Float64(x + y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -5.9e+51) || ~((z <= 9e-37))) tmp = x + y; else tmp = -z / (y / (x + y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -5.9e+51], N[Not[LessEqual[z, 9e-37]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[((-z) / N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.9 \cdot 10^{+51} \lor \neg \left(z \leq 9 \cdot 10^{-37}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;\frac{-z}{\frac{y}{x + y}}\\
\end{array}
\end{array}
if z < -5.89999999999999983e51 or 9.00000000000000081e-37 < z Initial program 99.2%
Taylor expanded in z around inf 80.7%
+-commutative80.7%
Simplified80.7%
if -5.89999999999999983e51 < z < 9.00000000000000081e-37Initial program 73.3%
Taylor expanded in z around 0 76.7%
mul-1-neg76.7%
associate-/l*76.9%
distribute-neg-frac76.9%
+-commutative76.9%
Simplified76.9%
Final simplification78.7%
(FPCore (x y z) :precision binary64 (if (<= x -6.2e-112) x (if (<= x 1.9e-188) y (if (<= x 2.8e-148) x (if (<= x 2.8e-108) y x)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -6.2e-112) {
tmp = x;
} else if (x <= 1.9e-188) {
tmp = y;
} else if (x <= 2.8e-148) {
tmp = x;
} else if (x <= 2.8e-108) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-6.2d-112)) then
tmp = x
else if (x <= 1.9d-188) then
tmp = y
else if (x <= 2.8d-148) then
tmp = x
else if (x <= 2.8d-108) then
tmp = y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -6.2e-112) {
tmp = x;
} else if (x <= 1.9e-188) {
tmp = y;
} else if (x <= 2.8e-148) {
tmp = x;
} else if (x <= 2.8e-108) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -6.2e-112: tmp = x elif x <= 1.9e-188: tmp = y elif x <= 2.8e-148: tmp = x elif x <= 2.8e-108: tmp = y else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -6.2e-112) tmp = x; elseif (x <= 1.9e-188) tmp = y; elseif (x <= 2.8e-148) tmp = x; elseif (x <= 2.8e-108) tmp = y; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -6.2e-112) tmp = x; elseif (x <= 1.9e-188) tmp = y; elseif (x <= 2.8e-148) tmp = x; elseif (x <= 2.8e-108) tmp = y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -6.2e-112], x, If[LessEqual[x, 1.9e-188], y, If[LessEqual[x, 2.8e-148], x, If[LessEqual[x, 2.8e-108], y, x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.2 \cdot 10^{-112}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{-188}:\\
\;\;\;\;y\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{-148}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{-108}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -6.1999999999999995e-112 or 1.9e-188 < x < 2.8e-148 or 2.8e-108 < x Initial program 86.6%
Taylor expanded in y around 0 47.5%
if -6.1999999999999995e-112 < x < 1.9e-188 or 2.8e-148 < x < 2.8e-108Initial program 84.4%
Taylor expanded in x around 0 72.6%
Taylor expanded in y around 0 37.0%
Final simplification44.3%
(FPCore (x y z) :precision binary64 (if (or (<= y -6.2e+143) (not (<= y 1e-18))) (- z) (+ x y)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -6.2e+143) || !(y <= 1e-18)) {
tmp = -z;
} else {
tmp = x + y;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-6.2d+143)) .or. (.not. (y <= 1d-18))) then
tmp = -z
else
tmp = x + y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -6.2e+143) || !(y <= 1e-18)) {
tmp = -z;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -6.2e+143) or not (y <= 1e-18): tmp = -z else: tmp = x + y return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -6.2e+143) || !(y <= 1e-18)) tmp = Float64(-z); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -6.2e+143) || ~((y <= 1e-18))) tmp = -z; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -6.2e+143], N[Not[LessEqual[y, 1e-18]], $MachinePrecision]], (-z), N[(x + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.2 \cdot 10^{+143} \lor \neg \left(y \leq 10^{-18}\right):\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if y < -6.1999999999999998e143 or 1.0000000000000001e-18 < y Initial program 63.9%
Taylor expanded in y around inf 83.2%
mul-1-neg83.2%
Simplified83.2%
if -6.1999999999999998e143 < y < 1.0000000000000001e-18Initial program 98.7%
Taylor expanded in z around inf 74.2%
+-commutative74.2%
Simplified74.2%
Final simplification77.5%
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
return x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x
end function
public static double code(double x, double y, double z) {
return x;
}
def code(x, y, z): return x
function code(x, y, z) return x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 85.9%
Taylor expanded in y around 0 37.1%
Final simplification37.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (/ (+ y x) (- y)) z)))
(if (< y -3.7429310762689856e+171)
t_0
(if (< y 3.5534662456086734e+168) (/ (+ x y) (- 1.0 (/ y z))) t_0))))
double code(double x, double y, double z) {
double t_0 = ((y + x) / -y) * z;
double tmp;
if (y < -3.7429310762689856e+171) {
tmp = t_0;
} else if (y < 3.5534662456086734e+168) {
tmp = (x + y) / (1.0 - (y / z));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = ((y + x) / -y) * z
if (y < (-3.7429310762689856d+171)) then
tmp = t_0
else if (y < 3.5534662456086734d+168) then
tmp = (x + y) / (1.0d0 - (y / z))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = ((y + x) / -y) * z;
double tmp;
if (y < -3.7429310762689856e+171) {
tmp = t_0;
} else if (y < 3.5534662456086734e+168) {
tmp = (x + y) / (1.0 - (y / z));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = ((y + x) / -y) * z tmp = 0 if y < -3.7429310762689856e+171: tmp = t_0 elif y < 3.5534662456086734e+168: tmp = (x + y) / (1.0 - (y / z)) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(y + x) / Float64(-y)) * z) tmp = 0.0 if (y < -3.7429310762689856e+171) tmp = t_0; elseif (y < 3.5534662456086734e+168) tmp = Float64(Float64(x + y) / Float64(1.0 - Float64(y / z))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = ((y + x) / -y) * z; tmp = 0.0; if (y < -3.7429310762689856e+171) tmp = t_0; elseif (y < 3.5534662456086734e+168) tmp = (x + y) / (1.0 - (y / z)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(y + x), $MachinePrecision] / (-y)), $MachinePrecision] * z), $MachinePrecision]}, If[Less[y, -3.7429310762689856e+171], t$95$0, If[Less[y, 3.5534662456086734e+168], N[(N[(x + y), $MachinePrecision] / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y + x}{-y} \cdot z\\
\mathbf{if}\;y < -3.7429310762689856 \cdot 10^{+171}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y < 3.5534662456086734 \cdot 10^{+168}:\\
\;\;\;\;\frac{x + y}{1 - \frac{y}{z}}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
herbie shell --seed 2023320
(FPCore (x y z)
:name "Graphics.Rendering.Chart.Backend.Diagrams:calcFontMetrics from Chart-diagrams-1.5.1, A"
:precision binary64
:herbie-target
(if (< y -3.7429310762689856e+171) (* (/ (+ y x) (- y)) z) (if (< y 3.5534662456086734e+168) (/ (+ x y) (- 1.0 (/ y z))) (* (/ (+ y x) (- y)) z)))
(/ (+ x y) (- 1.0 (/ y z))))