
(FPCore (x y z) :precision binary64 (+ (+ x (sin y)) (* z (cos y))))
double code(double x, double y, double z) {
return (x + sin(y)) + (z * cos(y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + sin(y)) + (z * cos(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.sin(y)) + (z * Math.cos(y));
}
def code(x, y, z): return (x + math.sin(y)) + (z * math.cos(y))
function code(x, y, z) return Float64(Float64(x + sin(y)) + Float64(z * cos(y))) end
function tmp = code(x, y, z) tmp = (x + sin(y)) + (z * cos(y)); end
code[x_, y_, z_] := N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \sin y\right) + z \cdot \cos y
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ (+ x (sin y)) (* z (cos y))))
double code(double x, double y, double z) {
return (x + sin(y)) + (z * cos(y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + sin(y)) + (z * cos(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.sin(y)) + (z * Math.cos(y));
}
def code(x, y, z): return (x + math.sin(y)) + (z * math.cos(y))
function code(x, y, z) return Float64(Float64(x + sin(y)) + Float64(z * cos(y))) end
function tmp = code(x, y, z) tmp = (x + sin(y)) + (z * cos(y)); end
code[x_, y_, z_] := N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \sin y\right) + z \cdot \cos y
\end{array}
(FPCore (x y z) :precision binary64 (+ (+ x (sin y)) (* z (cos y))))
double code(double x, double y, double z) {
return (x + sin(y)) + (z * cos(y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + sin(y)) + (z * cos(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.sin(y)) + (z * Math.cos(y));
}
def code(x, y, z): return (x + math.sin(y)) + (z * math.cos(y))
function code(x, y, z) return Float64(Float64(x + sin(y)) + Float64(z * cos(y))) end
function tmp = code(x, y, z) tmp = (x + sin(y)) + (z * cos(y)); end
code[x_, y_, z_] := N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \sin y\right) + z \cdot \cos y
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= x -1.16e+18)
(+ x z)
(if (<= x -1.6e-177)
t_0
(if (<= x -6.2e-249)
(sin y)
(if (<= x 2.3e-125)
t_0
(if (<= x 7.4e-78)
(+ y (+ x z))
(if (<= x 1.2e-19) t_0 (+ x z)))))))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (x <= -1.16e+18) {
tmp = x + z;
} else if (x <= -1.6e-177) {
tmp = t_0;
} else if (x <= -6.2e-249) {
tmp = sin(y);
} else if (x <= 2.3e-125) {
tmp = t_0;
} else if (x <= 7.4e-78) {
tmp = y + (x + z);
} else if (x <= 1.2e-19) {
tmp = t_0;
} else {
tmp = x + 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 = z * cos(y)
if (x <= (-1.16d+18)) then
tmp = x + z
else if (x <= (-1.6d-177)) then
tmp = t_0
else if (x <= (-6.2d-249)) then
tmp = sin(y)
else if (x <= 2.3d-125) then
tmp = t_0
else if (x <= 7.4d-78) then
tmp = y + (x + z)
else if (x <= 1.2d-19) then
tmp = t_0
else
tmp = x + z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * Math.cos(y);
double tmp;
if (x <= -1.16e+18) {
tmp = x + z;
} else if (x <= -1.6e-177) {
tmp = t_0;
} else if (x <= -6.2e-249) {
tmp = Math.sin(y);
} else if (x <= 2.3e-125) {
tmp = t_0;
} else if (x <= 7.4e-78) {
tmp = y + (x + z);
} else if (x <= 1.2e-19) {
tmp = t_0;
} else {
tmp = x + z;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if x <= -1.16e+18: tmp = x + z elif x <= -1.6e-177: tmp = t_0 elif x <= -6.2e-249: tmp = math.sin(y) elif x <= 2.3e-125: tmp = t_0 elif x <= 7.4e-78: tmp = y + (x + z) elif x <= 1.2e-19: tmp = t_0 else: tmp = x + z return tmp
function code(x, y, z) t_0 = Float64(z * cos(y)) tmp = 0.0 if (x <= -1.16e+18) tmp = Float64(x + z); elseif (x <= -1.6e-177) tmp = t_0; elseif (x <= -6.2e-249) tmp = sin(y); elseif (x <= 2.3e-125) tmp = t_0; elseif (x <= 7.4e-78) tmp = Float64(y + Float64(x + z)); elseif (x <= 1.2e-19) tmp = t_0; else tmp = Float64(x + z); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * cos(y); tmp = 0.0; if (x <= -1.16e+18) tmp = x + z; elseif (x <= -1.6e-177) tmp = t_0; elseif (x <= -6.2e-249) tmp = sin(y); elseif (x <= 2.3e-125) tmp = t_0; elseif (x <= 7.4e-78) tmp = y + (x + z); elseif (x <= 1.2e-19) tmp = t_0; else tmp = x + z; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.16e+18], N[(x + z), $MachinePrecision], If[LessEqual[x, -1.6e-177], t$95$0, If[LessEqual[x, -6.2e-249], N[Sin[y], $MachinePrecision], If[LessEqual[x, 2.3e-125], t$95$0, If[LessEqual[x, 7.4e-78], N[(y + N[(x + z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.2e-19], t$95$0, N[(x + z), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;x \leq -1.16 \cdot 10^{+18}:\\
\;\;\;\;x + z\\
\mathbf{elif}\;x \leq -1.6 \cdot 10^{-177}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -6.2 \cdot 10^{-249}:\\
\;\;\;\;\sin y\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{-125}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 7.4 \cdot 10^{-78}:\\
\;\;\;\;y + \left(x + z\right)\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{-19}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;x + z\\
\end{array}
\end{array}
if x < -1.16e18 or 1.20000000000000011e-19 < x Initial program 100.0%
Taylor expanded in y around 0 90.9%
if -1.16e18 < x < -1.5999999999999999e-177 or -6.19999999999999971e-249 < x < 2.2999999999999999e-125 or 7.40000000000000011e-78 < x < 1.20000000000000011e-19Initial program 99.9%
Taylor expanded in x around inf 78.5%
Taylor expanded in x around 0 76.6%
if -1.5999999999999999e-177 < x < -6.19999999999999971e-249Initial program 100.0%
Taylor expanded in x around 0 100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in z around 0 61.0%
if 2.2999999999999999e-125 < x < 7.40000000000000011e-78Initial program 100.0%
Taylor expanded in y around 0 90.5%
Final simplification83.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= x -1.65e-23)
(+ x z)
(if (<= x 1.65e-209)
(+ (sin y) z)
(if (<= x 3.6e-126)
t_0
(if (<= x 1.3e-77)
(+ y (+ x z))
(if (<= x 1.15e-19) t_0 (+ x z))))))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (x <= -1.65e-23) {
tmp = x + z;
} else if (x <= 1.65e-209) {
tmp = sin(y) + z;
} else if (x <= 3.6e-126) {
tmp = t_0;
} else if (x <= 1.3e-77) {
tmp = y + (x + z);
} else if (x <= 1.15e-19) {
tmp = t_0;
} else {
tmp = x + 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 = z * cos(y)
if (x <= (-1.65d-23)) then
tmp = x + z
else if (x <= 1.65d-209) then
tmp = sin(y) + z
else if (x <= 3.6d-126) then
tmp = t_0
else if (x <= 1.3d-77) then
tmp = y + (x + z)
else if (x <= 1.15d-19) then
tmp = t_0
else
tmp = x + z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * Math.cos(y);
double tmp;
if (x <= -1.65e-23) {
tmp = x + z;
} else if (x <= 1.65e-209) {
tmp = Math.sin(y) + z;
} else if (x <= 3.6e-126) {
tmp = t_0;
} else if (x <= 1.3e-77) {
tmp = y + (x + z);
} else if (x <= 1.15e-19) {
tmp = t_0;
} else {
tmp = x + z;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if x <= -1.65e-23: tmp = x + z elif x <= 1.65e-209: tmp = math.sin(y) + z elif x <= 3.6e-126: tmp = t_0 elif x <= 1.3e-77: tmp = y + (x + z) elif x <= 1.15e-19: tmp = t_0 else: tmp = x + z return tmp
function code(x, y, z) t_0 = Float64(z * cos(y)) tmp = 0.0 if (x <= -1.65e-23) tmp = Float64(x + z); elseif (x <= 1.65e-209) tmp = Float64(sin(y) + z); elseif (x <= 3.6e-126) tmp = t_0; elseif (x <= 1.3e-77) tmp = Float64(y + Float64(x + z)); elseif (x <= 1.15e-19) tmp = t_0; else tmp = Float64(x + z); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * cos(y); tmp = 0.0; if (x <= -1.65e-23) tmp = x + z; elseif (x <= 1.65e-209) tmp = sin(y) + z; elseif (x <= 3.6e-126) tmp = t_0; elseif (x <= 1.3e-77) tmp = y + (x + z); elseif (x <= 1.15e-19) tmp = t_0; else tmp = x + z; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.65e-23], N[(x + z), $MachinePrecision], If[LessEqual[x, 1.65e-209], N[(N[Sin[y], $MachinePrecision] + z), $MachinePrecision], If[LessEqual[x, 3.6e-126], t$95$0, If[LessEqual[x, 1.3e-77], N[(y + N[(x + z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.15e-19], t$95$0, N[(x + z), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;x \leq -1.65 \cdot 10^{-23}:\\
\;\;\;\;x + z\\
\mathbf{elif}\;x \leq 1.65 \cdot 10^{-209}:\\
\;\;\;\;\sin y + z\\
\mathbf{elif}\;x \leq 3.6 \cdot 10^{-126}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{-77}:\\
\;\;\;\;y + \left(x + z\right)\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{-19}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;x + z\\
\end{array}
\end{array}
if x < -1.6500000000000001e-23 or 1.1499999999999999e-19 < x Initial program 100.0%
Taylor expanded in y around 0 88.8%
if -1.6500000000000001e-23 < x < 1.64999999999999987e-209Initial program 99.9%
Taylor expanded in x around 0 98.6%
Taylor expanded in y around 0 82.2%
if 1.64999999999999987e-209 < x < 3.5999999999999999e-126 or 1.3000000000000001e-77 < x < 1.1499999999999999e-19Initial program 99.8%
Taylor expanded in x around inf 85.5%
Taylor expanded in x around 0 85.7%
if 3.5999999999999999e-126 < x < 1.3000000000000001e-77Initial program 100.0%
Taylor expanded in y around 0 82.4%
Final simplification86.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= z -1450000.0)
t_0
(if (<= z 7.5e-16) (+ x (sin y)) (if (<= z 9.8e+199) (+ x z) t_0)))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -1450000.0) {
tmp = t_0;
} else if (z <= 7.5e-16) {
tmp = x + sin(y);
} else if (z <= 9.8e+199) {
tmp = x + 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 = z * cos(y)
if (z <= (-1450000.0d0)) then
tmp = t_0
else if (z <= 7.5d-16) then
tmp = x + sin(y)
else if (z <= 9.8d+199) then
tmp = x + z
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * Math.cos(y);
double tmp;
if (z <= -1450000.0) {
tmp = t_0;
} else if (z <= 7.5e-16) {
tmp = x + Math.sin(y);
} else if (z <= 9.8e+199) {
tmp = x + z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if z <= -1450000.0: tmp = t_0 elif z <= 7.5e-16: tmp = x + math.sin(y) elif z <= 9.8e+199: tmp = x + z else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * cos(y)) tmp = 0.0 if (z <= -1450000.0) tmp = t_0; elseif (z <= 7.5e-16) tmp = Float64(x + sin(y)); elseif (z <= 9.8e+199) tmp = Float64(x + z); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * cos(y); tmp = 0.0; if (z <= -1450000.0) tmp = t_0; elseif (z <= 7.5e-16) tmp = x + sin(y); elseif (z <= 9.8e+199) tmp = x + z; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1450000.0], t$95$0, If[LessEqual[z, 7.5e-16], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9.8e+199], N[(x + z), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -1450000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{-16}:\\
\;\;\;\;x + \sin y\\
\mathbf{elif}\;z \leq 9.8 \cdot 10^{+199}:\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < -1.45e6 or 9.7999999999999993e199 < z Initial program 99.9%
Taylor expanded in x around inf 99.9%
Taylor expanded in x around 0 82.8%
if -1.45e6 < z < 7.5e-16Initial program 100.0%
+-commutative100.0%
add-cube-cbrt99.8%
associate-*l*99.8%
fma-def99.8%
pow299.8%
Applied egg-rr99.8%
Taylor expanded in z around 0 91.9%
if 7.5e-16 < z < 9.7999999999999993e199Initial program 99.9%
Taylor expanded in y around 0 79.7%
Final simplification86.6%
(FPCore (x y z) :precision binary64 (if (or (<= z -2.3e-52) (not (<= z 5.6e-16))) (+ x (* z (cos y))) (+ x (sin y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.3e-52) || !(z <= 5.6e-16)) {
tmp = x + (z * cos(y));
} else {
tmp = x + sin(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 <= (-2.3d-52)) .or. (.not. (z <= 5.6d-16))) then
tmp = x + (z * cos(y))
else
tmp = x + sin(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -2.3e-52) || !(z <= 5.6e-16)) {
tmp = x + (z * Math.cos(y));
} else {
tmp = x + Math.sin(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.3e-52) or not (z <= 5.6e-16): tmp = x + (z * math.cos(y)) else: tmp = x + math.sin(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2.3e-52) || !(z <= 5.6e-16)) tmp = Float64(x + Float64(z * cos(y))); else tmp = Float64(x + sin(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -2.3e-52) || ~((z <= 5.6e-16))) tmp = x + (z * cos(y)); else tmp = x + sin(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.3e-52], N[Not[LessEqual[z, 5.6e-16]], $MachinePrecision]], N[(x + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.3 \cdot 10^{-52} \lor \neg \left(z \leq 5.6 \cdot 10^{-16}\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;x + \sin y\\
\end{array}
\end{array}
if z < -2.29999999999999994e-52 or 5.6000000000000003e-16 < z Initial program 99.9%
Taylor expanded in x around inf 98.0%
if -2.29999999999999994e-52 < z < 5.6000000000000003e-16Initial program 100.0%
+-commutative100.0%
add-cube-cbrt99.8%
associate-*l*99.8%
fma-def99.8%
pow299.8%
Applied egg-rr99.8%
Taylor expanded in z around 0 93.6%
Final simplification96.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -6e+14) (not (<= z 1.35e-15))) (+ x (* z (cos y))) (+ z (+ x (sin y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -6e+14) || !(z <= 1.35e-15)) {
tmp = x + (z * cos(y));
} else {
tmp = z + (x + sin(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 <= (-6d+14)) .or. (.not. (z <= 1.35d-15))) then
tmp = x + (z * cos(y))
else
tmp = z + (x + sin(y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -6e+14) || !(z <= 1.35e-15)) {
tmp = x + (z * Math.cos(y));
} else {
tmp = z + (x + Math.sin(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -6e+14) or not (z <= 1.35e-15): tmp = x + (z * math.cos(y)) else: tmp = z + (x + math.sin(y)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -6e+14) || !(z <= 1.35e-15)) tmp = Float64(x + Float64(z * cos(y))); else tmp = Float64(z + Float64(x + sin(y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -6e+14) || ~((z <= 1.35e-15))) tmp = x + (z * cos(y)); else tmp = z + (x + sin(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -6e+14], N[Not[LessEqual[z, 1.35e-15]], $MachinePrecision]], N[(x + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6 \cdot 10^{+14} \lor \neg \left(z \leq 1.35 \cdot 10^{-15}\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;z + \left(x + \sin y\right)\\
\end{array}
\end{array}
if z < -6e14 or 1.35000000000000005e-15 < z Initial program 99.9%
Taylor expanded in x around inf 99.9%
if -6e14 < z < 1.35000000000000005e-15Initial program 100.0%
Taylor expanded in y around 0 99.6%
Final simplification99.8%
(FPCore (x y z) :precision binary64 (if (<= y -9.5) (+ x z) (if (<= y 108000.0) (+ y (+ x z)) (+ x z))))
double code(double x, double y, double z) {
double tmp;
if (y <= -9.5) {
tmp = x + z;
} else if (y <= 108000.0) {
tmp = y + (x + z);
} else {
tmp = x + 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 <= (-9.5d0)) then
tmp = x + z
else if (y <= 108000.0d0) then
tmp = y + (x + z)
else
tmp = x + z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -9.5) {
tmp = x + z;
} else if (y <= 108000.0) {
tmp = y + (x + z);
} else {
tmp = x + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -9.5: tmp = x + z elif y <= 108000.0: tmp = y + (x + z) else: tmp = x + z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -9.5) tmp = Float64(x + z); elseif (y <= 108000.0) tmp = Float64(y + Float64(x + z)); else tmp = Float64(x + z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -9.5) tmp = x + z; elseif (y <= 108000.0) tmp = y + (x + z); else tmp = x + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -9.5], N[(x + z), $MachinePrecision], If[LessEqual[y, 108000.0], N[(y + N[(x + z), $MachinePrecision]), $MachinePrecision], N[(x + z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.5:\\
\;\;\;\;x + z\\
\mathbf{elif}\;y \leq 108000:\\
\;\;\;\;y + \left(x + z\right)\\
\mathbf{else}:\\
\;\;\;\;x + z\\
\end{array}
\end{array}
if y < -9.5 or 108000 < y Initial program 99.8%
Taylor expanded in y around 0 45.0%
if -9.5 < y < 108000Initial program 100.0%
Taylor expanded in y around 0 97.1%
Final simplification75.0%
(FPCore (x y z) :precision binary64 (if (<= x -2.3e+63) x (if (<= x 4.2e-8) z x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -2.3e+63) {
tmp = x;
} else if (x <= 4.2e-8) {
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 (x <= (-2.3d+63)) then
tmp = x
else if (x <= 4.2d-8) 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 (x <= -2.3e+63) {
tmp = x;
} else if (x <= 4.2e-8) {
tmp = z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -2.3e+63: tmp = x elif x <= 4.2e-8: tmp = z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -2.3e+63) tmp = x; elseif (x <= 4.2e-8) tmp = z; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -2.3e+63) tmp = x; elseif (x <= 4.2e-8) tmp = z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -2.3e+63], x, If[LessEqual[x, 4.2e-8], z, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.3 \cdot 10^{+63}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 4.2 \cdot 10^{-8}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -2.29999999999999993e63 or 4.19999999999999989e-8 < x Initial program 99.9%
+-commutative99.9%
add-cube-cbrt99.6%
associate-*l*99.6%
fma-def99.6%
pow299.6%
Applied egg-rr99.6%
Taylor expanded in x around inf 81.0%
if -2.29999999999999993e63 < x < 4.19999999999999989e-8Initial program 99.9%
Taylor expanded in x around 0 93.2%
Taylor expanded in y around 0 72.7%
Taylor expanded in z around inf 47.2%
Final simplification63.1%
(FPCore (x y z) :precision binary64 (+ x z))
double code(double x, double y, double z) {
return x + 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 + z
end function
public static double code(double x, double y, double z) {
return x + z;
}
def code(x, y, z): return x + z
function code(x, y, z) return Float64(x + z) end
function tmp = code(x, y, z) tmp = x + z; end
code[x_, y_, z_] := N[(x + z), $MachinePrecision]
\begin{array}{l}
\\
x + z
\end{array}
Initial program 99.9%
Taylor expanded in y around 0 71.0%
Final simplification71.0%
(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 99.9%
+-commutative99.9%
add-cube-cbrt99.2%
associate-*l*99.2%
fma-def99.2%
pow299.2%
Applied egg-rr99.2%
Taylor expanded in x around inf 42.6%
Final simplification42.6%
herbie shell --seed 2023268
(FPCore (x y z)
:name "Graphics.Rasterific.Svg.PathConverter:segmentToBezier from rasterific-svg-0.2.3.1, C"
:precision binary64
(+ (+ x (sin y)) (* z (cos y))))