
(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 8 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 (/ (+ x y) (- 1.0 (/ y z)))))
(if (<= t_0 -2e-281)
t_0
(if (<= t_0 2e-265)
(* z (- -1.0 (/ x y)))
(/ (+ x y) (+ -1.0 (- 2.0 (/ y z))))))))
double code(double x, double y, double z) {
double t_0 = (x + y) / (1.0 - (y / z));
double tmp;
if (t_0 <= -2e-281) {
tmp = t_0;
} else if (t_0 <= 2e-265) {
tmp = z * (-1.0 - (x / y));
} else {
tmp = (x + y) / (-1.0 + (2.0 - (y / 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) :: t_0
real(8) :: tmp
t_0 = (x + y) / (1.0d0 - (y / z))
if (t_0 <= (-2d-281)) then
tmp = t_0
else if (t_0 <= 2d-265) then
tmp = z * ((-1.0d0) - (x / y))
else
tmp = (x + y) / ((-1.0d0) + (2.0d0 - (y / z)))
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-281) {
tmp = t_0;
} else if (t_0 <= 2e-265) {
tmp = z * (-1.0 - (x / y));
} else {
tmp = (x + y) / (-1.0 + (2.0 - (y / z)));
}
return tmp;
}
def code(x, y, z): t_0 = (x + y) / (1.0 - (y / z)) tmp = 0 if t_0 <= -2e-281: tmp = t_0 elif t_0 <= 2e-265: tmp = z * (-1.0 - (x / y)) else: tmp = (x + y) / (-1.0 + (2.0 - (y / z))) 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-281) tmp = t_0; elseif (t_0 <= 2e-265) tmp = Float64(z * Float64(-1.0 - Float64(x / y))); else tmp = Float64(Float64(x + y) / Float64(-1.0 + Float64(2.0 - Float64(y / z)))); 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-281) tmp = t_0; elseif (t_0 <= 2e-265) tmp = z * (-1.0 - (x / y)); else tmp = (x + y) / (-1.0 + (2.0 - (y / z))); 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[LessEqual[t$95$0, -2e-281], t$95$0, If[LessEqual[t$95$0, 2e-265], N[(z * N[(-1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + y), $MachinePrecision] / N[(-1.0 + N[(2.0 - N[(y / z), $MachinePrecision]), $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^{-281}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-265}:\\
\;\;\;\;z \cdot \left(-1 - \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x + y}{-1 + \left(2 - \frac{y}{z}\right)}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < -2e-281Initial program 99.9%
if -2e-281 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < 1.99999999999999997e-265Initial program 8.8%
clear-num8.8%
inv-pow8.8%
Applied egg-rr8.8%
unpow-18.8%
div-inv8.8%
div-inv8.8%
+-commutative8.8%
Applied egg-rr8.8%
Taylor expanded in z around 0 97.1%
mul-1-neg97.1%
associate-/l*100.0%
+-commutative100.0%
distribute-rgt-neg-in100.0%
neg-sub0100.0%
*-lft-identity100.0%
associate-*l/99.7%
distribute-rgt-in99.7%
rgt-mult-inverse99.9%
associate-*r/100.0%
*-rgt-identity100.0%
associate--r+100.0%
metadata-eval100.0%
Simplified100.0%
if 1.99999999999999997e-265 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) Initial program 99.8%
expm1-log1p-u79.9%
Applied egg-rr79.9%
expm1-undefine79.9%
sub-neg79.9%
log1p-undefine79.9%
rem-exp-log99.8%
associate-+r-99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (+ x y) (- 1.0 (/ y z)))))
(if (or (<= t_0 -2e-281) (not (<= t_0 2e-265)))
t_0
(* z (- -1.0 (/ 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-281) || !(t_0 <= 2e-265)) {
tmp = t_0;
} else {
tmp = z * (-1.0 - (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-281)) .or. (.not. (t_0 <= 2d-265))) then
tmp = t_0
else
tmp = z * ((-1.0d0) - (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-281) || !(t_0 <= 2e-265)) {
tmp = t_0;
} else {
tmp = z * (-1.0 - (x / y));
}
return tmp;
}
def code(x, y, z): t_0 = (x + y) / (1.0 - (y / z)) tmp = 0 if (t_0 <= -2e-281) or not (t_0 <= 2e-265): tmp = t_0 else: tmp = z * (-1.0 - (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-281) || !(t_0 <= 2e-265)) tmp = t_0; else tmp = Float64(z * Float64(-1.0 - 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-281) || ~((t_0 <= 2e-265))) tmp = t_0; else tmp = z * (-1.0 - (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-281], N[Not[LessEqual[t$95$0, 2e-265]], $MachinePrecision]], t$95$0, N[(z * N[(-1.0 - 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^{-281} \lor \neg \left(t\_0 \leq 2 \cdot 10^{-265}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-1 - \frac{x}{y}\right)\\
\end{array}
\end{array}
if (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < -2e-281 or 1.99999999999999997e-265 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) Initial program 99.9%
if -2e-281 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < 1.99999999999999997e-265Initial program 8.8%
clear-num8.8%
inv-pow8.8%
Applied egg-rr8.8%
unpow-18.8%
div-inv8.8%
div-inv8.8%
+-commutative8.8%
Applied egg-rr8.8%
Taylor expanded in z around 0 97.1%
mul-1-neg97.1%
associate-/l*100.0%
+-commutative100.0%
distribute-rgt-neg-in100.0%
neg-sub0100.0%
*-lft-identity100.0%
associate-*l/99.7%
distribute-rgt-in99.7%
rgt-mult-inverse99.9%
associate-*r/100.0%
*-rgt-identity100.0%
associate--r+100.0%
metadata-eval100.0%
Simplified100.0%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -64000000.0) (not (<= z 3.6e-56))) (+ x y) (/ (* z (- (- x) y)) y)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -64000000.0) || !(z <= 3.6e-56)) {
tmp = x + y;
} else {
tmp = (z * (-x - y)) / 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 <= (-64000000.0d0)) .or. (.not. (z <= 3.6d-56))) then
tmp = x + y
else
tmp = (z * (-x - y)) / y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -64000000.0) || !(z <= 3.6e-56)) {
tmp = x + y;
} else {
tmp = (z * (-x - y)) / y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -64000000.0) or not (z <= 3.6e-56): tmp = x + y else: tmp = (z * (-x - y)) / y return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -64000000.0) || !(z <= 3.6e-56)) tmp = Float64(x + y); else tmp = Float64(Float64(z * Float64(Float64(-x) - y)) / y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -64000000.0) || ~((z <= 3.6e-56))) tmp = x + y; else tmp = (z * (-x - y)) / y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -64000000.0], N[Not[LessEqual[z, 3.6e-56]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(N[(z * N[((-x) - y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -64000000 \lor \neg \left(z \leq 3.6 \cdot 10^{-56}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;\frac{z \cdot \left(\left(-x\right) - y\right)}{y}\\
\end{array}
\end{array}
if z < -6.4e7 or 3.59999999999999978e-56 < z Initial program 99.2%
Taylor expanded in z around inf 77.0%
+-commutative77.0%
Simplified77.0%
if -6.4e7 < z < 3.59999999999999978e-56Initial program 74.4%
Taylor expanded in z around 0 78.3%
associate-*r/78.3%
*-commutative78.3%
associate-*r*78.3%
neg-mul-178.3%
distribute-neg-in78.3%
unsub-neg78.3%
Simplified78.3%
Final simplification77.6%
(FPCore (x y z) :precision binary64 (if (or (<= z -18000000000.0) (not (<= z 1.6e-55))) (+ x y) (* z (- -1.0 (/ x y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -18000000000.0) || !(z <= 1.6e-55)) {
tmp = x + y;
} else {
tmp = z * (-1.0 - (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 <= (-18000000000.0d0)) .or. (.not. (z <= 1.6d-55))) then
tmp = x + y
else
tmp = z * ((-1.0d0) - (x / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -18000000000.0) || !(z <= 1.6e-55)) {
tmp = x + y;
} else {
tmp = z * (-1.0 - (x / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -18000000000.0) or not (z <= 1.6e-55): tmp = x + y else: tmp = z * (-1.0 - (x / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -18000000000.0) || !(z <= 1.6e-55)) tmp = Float64(x + y); else tmp = Float64(z * Float64(-1.0 - Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -18000000000.0) || ~((z <= 1.6e-55))) tmp = x + y; else tmp = z * (-1.0 - (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -18000000000.0], N[Not[LessEqual[z, 1.6e-55]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(z * N[(-1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -18000000000 \lor \neg \left(z \leq 1.6 \cdot 10^{-55}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-1 - \frac{x}{y}\right)\\
\end{array}
\end{array}
if z < -1.8e10 or 1.6000000000000001e-55 < z Initial program 99.2%
Taylor expanded in z around inf 77.0%
+-commutative77.0%
Simplified77.0%
if -1.8e10 < z < 1.6000000000000001e-55Initial program 74.4%
clear-num74.1%
inv-pow74.1%
Applied egg-rr74.1%
unpow-174.1%
div-inv74.0%
div-inv74.1%
+-commutative74.1%
Applied egg-rr74.1%
Taylor expanded in z around 0 78.3%
mul-1-neg78.3%
associate-/l*76.2%
+-commutative76.2%
distribute-rgt-neg-in76.2%
neg-sub076.2%
*-lft-identity76.2%
associate-*l/76.1%
distribute-rgt-in76.1%
rgt-mult-inverse76.2%
associate-*r/76.2%
*-rgt-identity76.2%
associate--r+76.2%
metadata-eval76.2%
Simplified76.2%
Final simplification76.6%
(FPCore (x y z) :precision binary64 (if (or (<= y -4.6e+110) (not (<= y 7.8e+177))) (- z) (+ x y)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -4.6e+110) || !(y <= 7.8e+177)) {
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 <= (-4.6d+110)) .or. (.not. (y <= 7.8d+177))) 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 <= -4.6e+110) || !(y <= 7.8e+177)) {
tmp = -z;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -4.6e+110) or not (y <= 7.8e+177): tmp = -z else: tmp = x + y return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -4.6e+110) || !(y <= 7.8e+177)) tmp = Float64(-z); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -4.6e+110) || ~((y <= 7.8e+177))) tmp = -z; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -4.6e+110], N[Not[LessEqual[y, 7.8e+177]], $MachinePrecision]], (-z), N[(x + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.6 \cdot 10^{+110} \lor \neg \left(y \leq 7.8 \cdot 10^{+177}\right):\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if y < -4.6e110 or 7.7999999999999998e177 < y Initial program 59.1%
Taylor expanded in y around inf 82.5%
neg-mul-182.5%
Simplified82.5%
if -4.6e110 < y < 7.7999999999999998e177Initial program 98.4%
Taylor expanded in z around inf 64.3%
+-commutative64.3%
Simplified64.3%
Final simplification69.2%
(FPCore (x y z) :precision binary64 (if (or (<= y -155.0) (not (<= y 2.2e-86))) (- z) x))
double code(double x, double y, double z) {
double tmp;
if ((y <= -155.0) || !(y <= 2.2e-86)) {
tmp = -z;
} 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 ((y <= (-155.0d0)) .or. (.not. (y <= 2.2d-86))) then
tmp = -z
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -155.0) || !(y <= 2.2e-86)) {
tmp = -z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -155.0) or not (y <= 2.2e-86): tmp = -z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -155.0) || !(y <= 2.2e-86)) tmp = Float64(-z); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -155.0) || ~((y <= 2.2e-86))) tmp = -z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -155.0], N[Not[LessEqual[y, 2.2e-86]], $MachinePrecision]], (-z), x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -155 \lor \neg \left(y \leq 2.2 \cdot 10^{-86}\right):\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -155 or 2.2000000000000002e-86 < y Initial program 79.1%
Taylor expanded in y around inf 54.2%
neg-mul-154.2%
Simplified54.2%
if -155 < y < 2.2000000000000002e-86Initial program 99.9%
Taylor expanded in y around 0 64.0%
Final simplification58.3%
(FPCore (x y z) :precision binary64 (if (<= x -2.05e-221) x (if (<= x 3.6e-145) y x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -2.05e-221) {
tmp = x;
} else if (x <= 3.6e-145) {
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 <= (-2.05d-221)) then
tmp = x
else if (x <= 3.6d-145) 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 <= -2.05e-221) {
tmp = x;
} else if (x <= 3.6e-145) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -2.05e-221: tmp = x elif x <= 3.6e-145: tmp = y else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -2.05e-221) tmp = x; elseif (x <= 3.6e-145) tmp = y; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -2.05e-221) tmp = x; elseif (x <= 3.6e-145) tmp = y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -2.05e-221], x, If[LessEqual[x, 3.6e-145], y, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.05 \cdot 10^{-221}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 3.6 \cdot 10^{-145}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -2.04999999999999991e-221 or 3.6e-145 < x Initial program 86.0%
Taylor expanded in y around 0 39.5%
if -2.04999999999999991e-221 < x < 3.6e-145Initial program 93.5%
Taylor expanded in z around inf 57.7%
+-commutative57.7%
Simplified57.7%
Taylor expanded in y around inf 45.2%
(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 87.8%
Taylor expanded in y around 0 33.6%
(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 2024172
(FPCore (x y z)
:name "Graphics.Rendering.Chart.Backend.Diagrams:calcFontMetrics from Chart-diagrams-1.5.1, A"
:precision binary64
:alt
(! :herbie-platform default (if (< y -3742931076268985600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (* (/ (+ y x) (- y)) z) (if (< y 3553466245608673400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (/ (+ x y) (- 1 (/ y z))) (* (/ (+ y x) (- y)) z))))
(/ (+ x y) (- 1.0 (/ y z))))