
(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 10 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 (or (<= t_0 -5e-223) (not (<= t_0 5e-292)))
t_0
(- (- z) (/ (* z (+ x z)) y)))))
double code(double x, double y, double z) {
double t_0 = (x + y) / (1.0 - (y / z));
double tmp;
if ((t_0 <= -5e-223) || !(t_0 <= 5e-292)) {
tmp = t_0;
} else {
tmp = -z - ((z * (x + z)) / 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 <= (-5d-223)) .or. (.not. (t_0 <= 5d-292))) then
tmp = t_0
else
tmp = -z - ((z * (x + z)) / 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 <= -5e-223) || !(t_0 <= 5e-292)) {
tmp = t_0;
} else {
tmp = -z - ((z * (x + z)) / y);
}
return tmp;
}
def code(x, y, z): t_0 = (x + y) / (1.0 - (y / z)) tmp = 0 if (t_0 <= -5e-223) or not (t_0 <= 5e-292): tmp = t_0 else: tmp = -z - ((z * (x + z)) / 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 <= -5e-223) || !(t_0 <= 5e-292)) tmp = t_0; else tmp = Float64(Float64(-z) - Float64(Float64(z * Float64(x + z)) / 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 <= -5e-223) || ~((t_0 <= 5e-292))) tmp = t_0; else tmp = -z - ((z * (x + z)) / 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, -5e-223], N[Not[LessEqual[t$95$0, 5e-292]], $MachinePrecision]], t$95$0, N[((-z) - N[(N[(z * N[(x + z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x + y}{1 - \frac{y}{z}}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-223} \lor \neg \left(t\_0 \leq 5 \cdot 10^{-292}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(-z\right) - \frac{z \cdot \left(x + z\right)}{y}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < -5.00000000000000024e-223 or 4.99999999999999981e-292 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) Initial program 99.8%
if -5.00000000000000024e-223 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < 4.99999999999999981e-292Initial program 17.1%
Taylor expanded in y around inf 100.0%
associate--l+100.0%
associate-*r/100.0%
div-sub100.0%
remove-double-neg100.0%
mul-1-neg100.0%
neg-mul-1100.0%
distribute-lft-out--100.0%
mul-1-neg100.0%
distribute-neg-frac100.0%
unsub-neg100.0%
mul-1-neg100.0%
cancel-sign-sub-inv100.0%
metadata-eval100.0%
*-lft-identity100.0%
+-commutative100.0%
unpow2100.0%
distribute-rgt-out100.0%
Simplified100.0%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (let* ((t_0 (/ (+ x y) (- 1.0 (/ y z))))) (if (or (<= t_0 -5e-223) (not (<= t_0 0.0))) t_0 (* z (/ (+ x y) (- y))))))
double code(double x, double y, double z) {
double t_0 = (x + y) / (1.0 - (y / z));
double tmp;
if ((t_0 <= -5e-223) || !(t_0 <= 0.0)) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = (x + y) / (1.0d0 - (y / z))
if ((t_0 <= (-5d-223)) .or. (.not. (t_0 <= 0.0d0))) then
tmp = t_0
else
tmp = z * ((x + y) / -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 <= -5e-223) || !(t_0 <= 0.0)) {
tmp = t_0;
} else {
tmp = z * ((x + y) / -y);
}
return tmp;
}
def code(x, y, z): t_0 = (x + y) / (1.0 - (y / z)) tmp = 0 if (t_0 <= -5e-223) or not (t_0 <= 0.0): tmp = t_0 else: tmp = z * ((x + y) / -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 <= -5e-223) || !(t_0 <= 0.0)) tmp = t_0; else tmp = Float64(z * Float64(Float64(x + y) / Float64(-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 <= -5e-223) || ~((t_0 <= 0.0))) tmp = t_0; else tmp = z * ((x + y) / -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, -5e-223], N[Not[LessEqual[t$95$0, 0.0]], $MachinePrecision]], t$95$0, N[(z * N[(N[(x + y), $MachinePrecision] / (-y)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x + y}{1 - \frac{y}{z}}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-223} \lor \neg \left(t\_0 \leq 0\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{x + y}{-y}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < -5.00000000000000024e-223 or 0.0 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) Initial program 99.8%
if -5.00000000000000024e-223 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < 0.0Initial program 14.7%
Taylor expanded in z around 0 99.2%
mul-1-neg99.2%
associate-/l*100.0%
distribute-rgt-neg-in100.0%
distribute-neg-frac2100.0%
+-commutative100.0%
Simplified100.0%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ x (- 1.0 (/ y z)))))
(if (<= x -3.6e-31)
t_0
(if (<= x 3e-192)
(+ x y)
(if (<= x 9.2e-86)
(- z)
(if (<= x 520000000000.0) (+ x y) (if (<= x 9.5e+32) (- z) t_0)))))))
double code(double x, double y, double z) {
double t_0 = x / (1.0 - (y / z));
double tmp;
if (x <= -3.6e-31) {
tmp = t_0;
} else if (x <= 3e-192) {
tmp = x + y;
} else if (x <= 9.2e-86) {
tmp = -z;
} else if (x <= 520000000000.0) {
tmp = x + y;
} else if (x <= 9.5e+32) {
tmp = -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 = x / (1.0d0 - (y / z))
if (x <= (-3.6d-31)) then
tmp = t_0
else if (x <= 3d-192) then
tmp = x + y
else if (x <= 9.2d-86) then
tmp = -z
else if (x <= 520000000000.0d0) then
tmp = x + y
else if (x <= 9.5d+32) then
tmp = -z
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x / (1.0 - (y / z));
double tmp;
if (x <= -3.6e-31) {
tmp = t_0;
} else if (x <= 3e-192) {
tmp = x + y;
} else if (x <= 9.2e-86) {
tmp = -z;
} else if (x <= 520000000000.0) {
tmp = x + y;
} else if (x <= 9.5e+32) {
tmp = -z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x / (1.0 - (y / z)) tmp = 0 if x <= -3.6e-31: tmp = t_0 elif x <= 3e-192: tmp = x + y elif x <= 9.2e-86: tmp = -z elif x <= 520000000000.0: tmp = x + y elif x <= 9.5e+32: tmp = -z else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x / Float64(1.0 - Float64(y / z))) tmp = 0.0 if (x <= -3.6e-31) tmp = t_0; elseif (x <= 3e-192) tmp = Float64(x + y); elseif (x <= 9.2e-86) tmp = Float64(-z); elseif (x <= 520000000000.0) tmp = Float64(x + y); elseif (x <= 9.5e+32) tmp = Float64(-z); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x / (1.0 - (y / z)); tmp = 0.0; if (x <= -3.6e-31) tmp = t_0; elseif (x <= 3e-192) tmp = x + y; elseif (x <= 9.2e-86) tmp = -z; elseif (x <= 520000000000.0) tmp = x + y; elseif (x <= 9.5e+32) tmp = -z; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.6e-31], t$95$0, If[LessEqual[x, 3e-192], N[(x + y), $MachinePrecision], If[LessEqual[x, 9.2e-86], (-z), If[LessEqual[x, 520000000000.0], N[(x + y), $MachinePrecision], If[LessEqual[x, 9.5e+32], (-z), t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{1 - \frac{y}{z}}\\
\mathbf{if}\;x \leq -3.6 \cdot 10^{-31}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 3 \cdot 10^{-192}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;x \leq 9.2 \cdot 10^{-86}:\\
\;\;\;\;-z\\
\mathbf{elif}\;x \leq 520000000000:\\
\;\;\;\;x + y\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{+32}:\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -3.60000000000000004e-31 or 9.50000000000000006e32 < x Initial program 90.2%
Taylor expanded in x around inf 77.9%
if -3.60000000000000004e-31 < x < 2.9999999999999999e-192 or 9.19999999999999985e-86 < x < 5.2e11Initial program 90.9%
Taylor expanded in z around inf 64.6%
+-commutative64.6%
Simplified64.6%
if 2.9999999999999999e-192 < x < 9.19999999999999985e-86 or 5.2e11 < x < 9.50000000000000006e32Initial program 68.7%
Taylor expanded in y around inf 74.8%
mul-1-neg74.8%
Simplified74.8%
Final simplification72.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (+ x y) (+ 1.0 (/ y z)))))
(if (<= z -2.55e+45)
t_0
(if (<= z -6.3e-24)
(/ x (- 1.0 (/ y z)))
(if (<= z -5e-33)
(+ x y)
(if (<= z 5.7e-24) (/ (* z (- (- y) x)) y) t_0))))))
double code(double x, double y, double z) {
double t_0 = (x + y) * (1.0 + (y / z));
double tmp;
if (z <= -2.55e+45) {
tmp = t_0;
} else if (z <= -6.3e-24) {
tmp = x / (1.0 - (y / z));
} else if (z <= -5e-33) {
tmp = x + y;
} else if (z <= 5.7e-24) {
tmp = (z * (-y - x)) / y;
} 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 = (x + y) * (1.0d0 + (y / z))
if (z <= (-2.55d+45)) then
tmp = t_0
else if (z <= (-6.3d-24)) then
tmp = x / (1.0d0 - (y / z))
else if (z <= (-5d-33)) then
tmp = x + y
else if (z <= 5.7d-24) then
tmp = (z * (-y - x)) / y
else
tmp = t_0
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 (z <= -2.55e+45) {
tmp = t_0;
} else if (z <= -6.3e-24) {
tmp = x / (1.0 - (y / z));
} else if (z <= -5e-33) {
tmp = x + y;
} else if (z <= 5.7e-24) {
tmp = (z * (-y - x)) / y;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (x + y) * (1.0 + (y / z)) tmp = 0 if z <= -2.55e+45: tmp = t_0 elif z <= -6.3e-24: tmp = x / (1.0 - (y / z)) elif z <= -5e-33: tmp = x + y elif z <= 5.7e-24: tmp = (z * (-y - x)) / y else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(x + y) * Float64(1.0 + Float64(y / z))) tmp = 0.0 if (z <= -2.55e+45) tmp = t_0; elseif (z <= -6.3e-24) tmp = Float64(x / Float64(1.0 - Float64(y / z))); elseif (z <= -5e-33) tmp = Float64(x + y); elseif (z <= 5.7e-24) tmp = Float64(Float64(z * Float64(Float64(-y) - x)) / y); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x + y) * (1.0 + (y / z)); tmp = 0.0; if (z <= -2.55e+45) tmp = t_0; elseif (z <= -6.3e-24) tmp = x / (1.0 - (y / z)); elseif (z <= -5e-33) tmp = x + y; elseif (z <= 5.7e-24) tmp = (z * (-y - x)) / y; else tmp = t_0; 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[z, -2.55e+45], t$95$0, If[LessEqual[z, -6.3e-24], N[(x / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -5e-33], N[(x + y), $MachinePrecision], If[LessEqual[z, 5.7e-24], N[(N[(z * N[((-y) - x), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x + y\right) \cdot \left(1 + \frac{y}{z}\right)\\
\mathbf{if}\;z \leq -2.55 \cdot 10^{+45}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -6.3 \cdot 10^{-24}:\\
\;\;\;\;\frac{x}{1 - \frac{y}{z}}\\
\mathbf{elif}\;z \leq -5 \cdot 10^{-33}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 5.7 \cdot 10^{-24}:\\
\;\;\;\;\frac{z \cdot \left(\left(-y\right) - x\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -2.5499999999999999e45 or 5.70000000000000002e-24 < z Initial program 99.9%
Taylor expanded in z around inf 67.2%
associate-+r+67.2%
*-rgt-identity67.2%
*-commutative67.2%
associate-/l*81.4%
distribute-lft-in81.4%
+-commutative81.4%
Simplified81.4%
if -2.5499999999999999e45 < z < -6.29999999999999979e-24Initial program 100.0%
Taylor expanded in x around inf 79.7%
if -6.29999999999999979e-24 < z < -5.00000000000000028e-33Initial program 100.0%
Taylor expanded in z around inf 100.0%
+-commutative100.0%
Simplified100.0%
if -5.00000000000000028e-33 < z < 5.70000000000000002e-24Initial program 71.7%
Taylor expanded in z around 0 81.7%
mul-1-neg81.7%
+-commutative81.7%
Simplified81.7%
Final simplification81.8%
(FPCore (x y z)
:precision binary64
(if (<= z -9.5e+38)
(+ x y)
(if (<= z -3.35e-25)
(/ x (- 1.0 (/ y z)))
(if (or (<= z -3.6e-33) (not (<= z 9e-5)))
(+ x y)
(/ (* z (- (- y) x)) y)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -9.5e+38) {
tmp = x + y;
} else if (z <= -3.35e-25) {
tmp = x / (1.0 - (y / z));
} else if ((z <= -3.6e-33) || !(z <= 9e-5)) {
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 <= (-9.5d+38)) then
tmp = x + y
else if (z <= (-3.35d-25)) then
tmp = x / (1.0d0 - (y / z))
else if ((z <= (-3.6d-33)) .or. (.not. (z <= 9d-5))) 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 <= -9.5e+38) {
tmp = x + y;
} else if (z <= -3.35e-25) {
tmp = x / (1.0 - (y / z));
} else if ((z <= -3.6e-33) || !(z <= 9e-5)) {
tmp = x + y;
} else {
tmp = (z * (-y - x)) / y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -9.5e+38: tmp = x + y elif z <= -3.35e-25: tmp = x / (1.0 - (y / z)) elif (z <= -3.6e-33) or not (z <= 9e-5): tmp = x + y else: tmp = (z * (-y - x)) / y return tmp
function code(x, y, z) tmp = 0.0 if (z <= -9.5e+38) tmp = Float64(x + y); elseif (z <= -3.35e-25) tmp = Float64(x / Float64(1.0 - Float64(y / z))); elseif ((z <= -3.6e-33) || !(z <= 9e-5)) tmp = Float64(x + y); else tmp = Float64(Float64(z * Float64(Float64(-y) - x)) / y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -9.5e+38) tmp = x + y; elseif (z <= -3.35e-25) tmp = x / (1.0 - (y / z)); elseif ((z <= -3.6e-33) || ~((z <= 9e-5))) tmp = x + y; else tmp = (z * (-y - x)) / y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -9.5e+38], N[(x + y), $MachinePrecision], If[LessEqual[z, -3.35e-25], N[(x / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -3.6e-33], N[Not[LessEqual[z, 9e-5]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(N[(z * N[((-y) - x), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.5 \cdot 10^{+38}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq -3.35 \cdot 10^{-25}:\\
\;\;\;\;\frac{x}{1 - \frac{y}{z}}\\
\mathbf{elif}\;z \leq -3.6 \cdot 10^{-33} \lor \neg \left(z \leq 9 \cdot 10^{-5}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;\frac{z \cdot \left(\left(-y\right) - x\right)}{y}\\
\end{array}
\end{array}
if z < -9.4999999999999995e38 or -3.35000000000000016e-25 < z < -3.60000000000000034e-33 or 9.00000000000000057e-5 < z Initial program 99.9%
Taylor expanded in z around inf 82.3%
+-commutative82.3%
Simplified82.3%
if -9.4999999999999995e38 < z < -3.35000000000000016e-25Initial program 100.0%
Taylor expanded in x around inf 79.7%
if -3.60000000000000034e-33 < z < 9.00000000000000057e-5Initial program 72.2%
Taylor expanded in z around 0 81.1%
mul-1-neg81.1%
+-commutative81.1%
Simplified81.1%
Final simplification81.7%
(FPCore (x y z)
:precision binary64
(if (<= y -6.8e+75)
(- z)
(if (<= y -1.05e+16)
y
(if (or (<= y -52000.0) (not (<= y 3e+94))) (- z) x))))
double code(double x, double y, double z) {
double tmp;
if (y <= -6.8e+75) {
tmp = -z;
} else if (y <= -1.05e+16) {
tmp = y;
} else if ((y <= -52000.0) || !(y <= 3e+94)) {
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 <= (-6.8d+75)) then
tmp = -z
else if (y <= (-1.05d+16)) then
tmp = y
else if ((y <= (-52000.0d0)) .or. (.not. (y <= 3d+94))) 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 <= -6.8e+75) {
tmp = -z;
} else if (y <= -1.05e+16) {
tmp = y;
} else if ((y <= -52000.0) || !(y <= 3e+94)) {
tmp = -z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -6.8e+75: tmp = -z elif y <= -1.05e+16: tmp = y elif (y <= -52000.0) or not (y <= 3e+94): tmp = -z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -6.8e+75) tmp = Float64(-z); elseif (y <= -1.05e+16) tmp = y; elseif ((y <= -52000.0) || !(y <= 3e+94)) tmp = Float64(-z); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -6.8e+75) tmp = -z; elseif (y <= -1.05e+16) tmp = y; elseif ((y <= -52000.0) || ~((y <= 3e+94))) tmp = -z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -6.8e+75], (-z), If[LessEqual[y, -1.05e+16], y, If[Or[LessEqual[y, -52000.0], N[Not[LessEqual[y, 3e+94]], $MachinePrecision]], (-z), x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.8 \cdot 10^{+75}:\\
\;\;\;\;-z\\
\mathbf{elif}\;y \leq -1.05 \cdot 10^{+16}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq -52000 \lor \neg \left(y \leq 3 \cdot 10^{+94}\right):\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -6.80000000000000022e75 or -1.05e16 < y < -52000 or 3.0000000000000001e94 < y Initial program 72.1%
Taylor expanded in y around inf 65.3%
mul-1-neg65.3%
Simplified65.3%
if -6.80000000000000022e75 < y < -1.05e16Initial program 93.3%
Taylor expanded in x around 0 51.8%
Taylor expanded in y around 0 43.5%
if -52000 < y < 3.0000000000000001e94Initial program 98.6%
Taylor expanded in y around 0 55.8%
Final simplification58.8%
(FPCore (x y z) :precision binary64 (let* ((t_0 (- 1.0 (/ y z)))) (if (or (<= x -3.3e-34) (not (<= x 3.65e-72))) (/ x t_0) (/ y t_0))))
double code(double x, double y, double z) {
double t_0 = 1.0 - (y / z);
double tmp;
if ((x <= -3.3e-34) || !(x <= 3.65e-72)) {
tmp = x / t_0;
} else {
tmp = y / 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 = 1.0d0 - (y / z)
if ((x <= (-3.3d-34)) .or. (.not. (x <= 3.65d-72))) then
tmp = x / t_0
else
tmp = y / 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 tmp;
if ((x <= -3.3e-34) || !(x <= 3.65e-72)) {
tmp = x / t_0;
} else {
tmp = y / t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 - (y / z) tmp = 0 if (x <= -3.3e-34) or not (x <= 3.65e-72): tmp = x / t_0 else: tmp = y / t_0 return tmp
function code(x, y, z) t_0 = Float64(1.0 - Float64(y / z)) tmp = 0.0 if ((x <= -3.3e-34) || !(x <= 3.65e-72)) tmp = Float64(x / t_0); else tmp = Float64(y / t_0); end return tmp end
function tmp_2 = code(x, y, z) t_0 = 1.0 - (y / z); tmp = 0.0; if ((x <= -3.3e-34) || ~((x <= 3.65e-72))) tmp = x / t_0; else tmp = y / t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[x, -3.3e-34], N[Not[LessEqual[x, 3.65e-72]], $MachinePrecision]], N[(x / t$95$0), $MachinePrecision], N[(y / t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \frac{y}{z}\\
\mathbf{if}\;x \leq -3.3 \cdot 10^{-34} \lor \neg \left(x \leq 3.65 \cdot 10^{-72}\right):\\
\;\;\;\;\frac{x}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t\_0}\\
\end{array}
\end{array}
if x < -3.29999999999999983e-34 or 3.65000000000000001e-72 < x Initial program 88.7%
Taylor expanded in x around inf 74.0%
if -3.29999999999999983e-34 < x < 3.65000000000000001e-72Initial program 87.3%
Taylor expanded in x around 0 72.5%
Final simplification73.4%
(FPCore (x y z) :precision binary64 (if (or (<= z -4e-34) (not (<= z 1.3e-24))) (+ x y) (- z)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -4e-34) || !(z <= 1.3e-24)) {
tmp = x + y;
} 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 ((z <= (-4d-34)) .or. (.not. (z <= 1.3d-24))) then
tmp = x + y
else
tmp = -z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -4e-34) || !(z <= 1.3e-24)) {
tmp = x + y;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -4e-34) or not (z <= 1.3e-24): tmp = x + y else: tmp = -z return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -4e-34) || !(z <= 1.3e-24)) tmp = Float64(x + y); else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -4e-34) || ~((z <= 1.3e-24))) tmp = x + y; else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -4e-34], N[Not[LessEqual[z, 1.3e-24]], $MachinePrecision]], N[(x + y), $MachinePrecision], (-z)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4 \cdot 10^{-34} \lor \neg \left(z \leq 1.3 \cdot 10^{-24}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if z < -3.99999999999999971e-34 or 1.3e-24 < z Initial program 99.9%
Taylor expanded in z around inf 78.2%
+-commutative78.2%
Simplified78.2%
if -3.99999999999999971e-34 < z < 1.3e-24Initial program 71.7%
Taylor expanded in y around inf 52.2%
mul-1-neg52.2%
Simplified52.2%
Final simplification67.4%
(FPCore (x y z) :precision binary64 (if (<= x -1.08e-152) x (if (<= x 5e-72) y x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.08e-152) {
tmp = x;
} else if (x <= 5e-72) {
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 <= (-1.08d-152)) then
tmp = x
else if (x <= 5d-72) 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 <= -1.08e-152) {
tmp = x;
} else if (x <= 5e-72) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.08e-152: tmp = x elif x <= 5e-72: tmp = y else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.08e-152) tmp = x; elseif (x <= 5e-72) tmp = y; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.08e-152) tmp = x; elseif (x <= 5e-72) tmp = y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.08e-152], x, If[LessEqual[x, 5e-72], y, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.08 \cdot 10^{-152}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 5 \cdot 10^{-72}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.08000000000000004e-152 or 4.9999999999999996e-72 < x Initial program 87.8%
Taylor expanded in y around 0 45.8%
if -1.08000000000000004e-152 < x < 4.9999999999999996e-72Initial program 89.3%
Taylor expanded in x around 0 80.0%
Taylor expanded in y around 0 52.7%
Final simplification47.7%
(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 88.2%
Taylor expanded in y around 0 36.0%
Final simplification36.0%
(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 2024076
(FPCore (x y z)
:name "Graphics.Rendering.Chart.Backend.Diagrams:calcFontMetrics from Chart-diagrams-1.5.1, A"
:precision binary64
:alt
(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))))