
(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 12 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 (fma z (cos y) (sin y))))
double code(double x, double y, double z) {
return x + fma(z, cos(y), sin(y));
}
function code(x, y, z) return Float64(x + fma(z, cos(y), sin(y))) end
code[x_, y_, z_] := N[(x + N[(z * N[Cos[y], $MachinePrecision] + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \mathsf{fma}\left(z, \cos y, \sin y\right)
\end{array}
Initial program 99.9%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
(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%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= z -2.5e+73)
t_0
(if (<= z -3.5e-58) (+ x z) (if (<= z 1.75e+22) (+ x (sin y)) t_0)))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -2.5e+73) {
tmp = t_0;
} else if (z <= -3.5e-58) {
tmp = x + z;
} else if (z <= 1.75e+22) {
tmp = x + sin(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 = z * cos(y)
if (z <= (-2.5d+73)) then
tmp = t_0
else if (z <= (-3.5d-58)) then
tmp = x + z
else if (z <= 1.75d+22) then
tmp = x + sin(y)
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 <= -2.5e+73) {
tmp = t_0;
} else if (z <= -3.5e-58) {
tmp = x + z;
} else if (z <= 1.75e+22) {
tmp = x + Math.sin(y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if z <= -2.5e+73: tmp = t_0 elif z <= -3.5e-58: tmp = x + z elif z <= 1.75e+22: tmp = x + math.sin(y) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * cos(y)) tmp = 0.0 if (z <= -2.5e+73) tmp = t_0; elseif (z <= -3.5e-58) tmp = Float64(x + z); elseif (z <= 1.75e+22) tmp = Float64(x + sin(y)); 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 <= -2.5e+73) tmp = t_0; elseif (z <= -3.5e-58) tmp = x + z; elseif (z <= 1.75e+22) tmp = x + sin(y); 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, -2.5e+73], t$95$0, If[LessEqual[z, -3.5e-58], N[(x + z), $MachinePrecision], If[LessEqual[z, 1.75e+22], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -2.5 \cdot 10^{+73}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -3.5 \cdot 10^{-58}:\\
\;\;\;\;x + z\\
\mathbf{elif}\;z \leq 1.75 \cdot 10^{+22}:\\
\;\;\;\;x + \sin y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -2.49999999999999988e73 or 1.75e22 < z Initial program 99.9%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in x around inf 74.9%
associate-+r+74.9%
associate-/l*74.7%
Simplified74.7%
Taylor expanded in z around inf 83.1%
if -2.49999999999999988e73 < z < -3.4999999999999999e-58Initial program 100.0%
associate-+l+100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around 0 83.1%
+-commutative83.1%
Simplified83.1%
if -3.4999999999999999e-58 < z < 1.75e22Initial program 99.9%
associate-+l+100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in z around 0 93.2%
+-commutative93.2%
Simplified93.2%
Final simplification87.5%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.14e+33) (not (<= z 0.86))) (+ x (* z (cos y))) (+ z (+ x (sin y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.14e+33) || !(z <= 0.86)) {
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 <= (-1.14d+33)) .or. (.not. (z <= 0.86d0))) 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 <= -1.14e+33) || !(z <= 0.86)) {
tmp = x + (z * Math.cos(y));
} else {
tmp = z + (x + Math.sin(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.14e+33) or not (z <= 0.86): 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 <= -1.14e+33) || !(z <= 0.86)) 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 <= -1.14e+33) || ~((z <= 0.86))) tmp = x + (z * cos(y)); else tmp = z + (x + sin(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.14e+33], N[Not[LessEqual[z, 0.86]], $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 -1.14 \cdot 10^{+33} \lor \neg \left(z \leq 0.86\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;z + \left(x + \sin y\right)\\
\end{array}
\end{array}
if z < -1.14e33 or 0.859999999999999987 < z Initial program 99.9%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in z around inf 99.9%
if -1.14e33 < z < 0.859999999999999987Initial program 99.9%
Taylor expanded in y around 0 99.4%
Final simplification99.7%
(FPCore (x y z) :precision binary64 (if (or (<= z -3.9e-57) (not (<= z 1.95e-33))) (+ x (* z (cos y))) (+ x (sin y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -3.9e-57) || !(z <= 1.95e-33)) {
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 <= (-3.9d-57)) .or. (.not. (z <= 1.95d-33))) 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 <= -3.9e-57) || !(z <= 1.95e-33)) {
tmp = x + (z * Math.cos(y));
} else {
tmp = x + Math.sin(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -3.9e-57) or not (z <= 1.95e-33): tmp = x + (z * math.cos(y)) else: tmp = x + math.sin(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -3.9e-57) || !(z <= 1.95e-33)) 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 <= -3.9e-57) || ~((z <= 1.95e-33))) tmp = x + (z * cos(y)); else tmp = x + sin(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -3.9e-57], N[Not[LessEqual[z, 1.95e-33]], $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 -3.9 \cdot 10^{-57} \lor \neg \left(z \leq 1.95 \cdot 10^{-33}\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;x + \sin y\\
\end{array}
\end{array}
if z < -3.90000000000000006e-57 or 1.94999999999999987e-33 < z Initial program 99.9%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in z around inf 96.9%
if -3.90000000000000006e-57 < z < 1.94999999999999987e-33Initial program 100.0%
associate-+l+100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in z around 0 95.1%
+-commutative95.1%
Simplified95.1%
Final simplification96.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -5.4e+73) (not (<= z 8.2e+88))) (* z (cos y)) (+ x z)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -5.4e+73) || !(z <= 8.2e+88)) {
tmp = z * cos(y);
} 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 ((z <= (-5.4d+73)) .or. (.not. (z <= 8.2d+88))) then
tmp = z * cos(y)
else
tmp = x + z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -5.4e+73) || !(z <= 8.2e+88)) {
tmp = z * Math.cos(y);
} else {
tmp = x + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -5.4e+73) or not (z <= 8.2e+88): tmp = z * math.cos(y) else: tmp = x + z return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -5.4e+73) || !(z <= 8.2e+88)) tmp = Float64(z * cos(y)); else tmp = Float64(x + z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -5.4e+73) || ~((z <= 8.2e+88))) tmp = z * cos(y); else tmp = x + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -5.4e+73], N[Not[LessEqual[z, 8.2e+88]], $MachinePrecision]], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(x + z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.4 \cdot 10^{+73} \lor \neg \left(z \leq 8.2 \cdot 10^{+88}\right):\\
\;\;\;\;z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;x + z\\
\end{array}
\end{array}
if z < -5.3999999999999998e73 or 8.20000000000000055e88 < z Initial program 99.9%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in x around inf 71.4%
associate-+r+71.4%
associate-/l*71.2%
Simplified71.2%
Taylor expanded in z around inf 87.3%
if -5.3999999999999998e73 < z < 8.20000000000000055e88Initial program 99.9%
associate-+l+100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around 0 64.0%
+-commutative64.0%
Simplified64.0%
Final simplification73.5%
(FPCore (x y z) :precision binary64 (if (or (<= y -2550000.0) (not (<= y 42000.0))) (+ x z) (+ x (+ z (* y (+ 1.0 (* y (+ (* z -0.5) (* y -0.16666666666666666)))))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2550000.0) || !(y <= 42000.0)) {
tmp = x + z;
} else {
tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666))))));
}
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 <= (-2550000.0d0)) .or. (.not. (y <= 42000.0d0))) then
tmp = x + z
else
tmp = x + (z + (y * (1.0d0 + (y * ((z * (-0.5d0)) + (y * (-0.16666666666666666d0)))))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -2550000.0) || !(y <= 42000.0)) {
tmp = x + z;
} else {
tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666))))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2550000.0) or not (y <= 42000.0): tmp = x + z else: tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666)))))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2550000.0) || !(y <= 42000.0)) tmp = Float64(x + z); else tmp = Float64(x + Float64(z + Float64(y * Float64(1.0 + Float64(y * Float64(Float64(z * -0.5) + Float64(y * -0.16666666666666666))))))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -2550000.0) || ~((y <= 42000.0))) tmp = x + z; else tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666)))))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2550000.0], N[Not[LessEqual[y, 42000.0]], $MachinePrecision]], N[(x + z), $MachinePrecision], N[(x + N[(z + N[(y * N[(1.0 + N[(y * N[(N[(z * -0.5), $MachinePrecision] + N[(y * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2550000 \lor \neg \left(y \leq 42000\right):\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;x + \left(z + y \cdot \left(1 + y \cdot \left(z \cdot -0.5 + y \cdot -0.16666666666666666\right)\right)\right)\\
\end{array}
\end{array}
if y < -2.55e6 or 42000 < y Initial program 99.9%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 38.9%
+-commutative38.9%
Simplified38.9%
if -2.55e6 < y < 42000Initial program 100.0%
associate-+l+100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around 0 97.4%
Final simplification67.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -600000.0) (not (<= y 9e-74))) (+ x z) (+ (+ x z) (* y (+ 1.0 (* -0.5 (* z y)))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -600000.0) || !(y <= 9e-74)) {
tmp = x + z;
} else {
tmp = (x + z) + (y * (1.0 + (-0.5 * (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) :: tmp
if ((y <= (-600000.0d0)) .or. (.not. (y <= 9d-74))) then
tmp = x + z
else
tmp = (x + z) + (y * (1.0d0 + ((-0.5d0) * (z * y))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -600000.0) || !(y <= 9e-74)) {
tmp = x + z;
} else {
tmp = (x + z) + (y * (1.0 + (-0.5 * (z * y))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -600000.0) or not (y <= 9e-74): tmp = x + z else: tmp = (x + z) + (y * (1.0 + (-0.5 * (z * y)))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -600000.0) || !(y <= 9e-74)) tmp = Float64(x + z); else tmp = Float64(Float64(x + z) + Float64(y * Float64(1.0 + Float64(-0.5 * Float64(z * y))))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -600000.0) || ~((y <= 9e-74))) tmp = x + z; else tmp = (x + z) + (y * (1.0 + (-0.5 * (z * y)))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -600000.0], N[Not[LessEqual[y, 9e-74]], $MachinePrecision]], N[(x + z), $MachinePrecision], N[(N[(x + z), $MachinePrecision] + N[(y * N[(1.0 + N[(-0.5 * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -600000 \lor \neg \left(y \leq 9 \cdot 10^{-74}\right):\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;\left(x + z\right) + y \cdot \left(1 + -0.5 \cdot \left(z \cdot y\right)\right)\\
\end{array}
\end{array}
if y < -6e5 or 8.9999999999999998e-74 < y Initial program 99.9%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 42.6%
+-commutative42.6%
Simplified42.6%
if -6e5 < y < 8.9999999999999998e-74Initial program 100.0%
associate-+l+100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around 0 97.5%
associate-+r+97.5%
+-commutative97.5%
*-commutative97.5%
Simplified97.5%
Final simplification67.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.42e+41) (not (<= y 5e-74))) (+ x z) (+ x (+ z y))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.42e+41) || !(y <= 5e-74)) {
tmp = x + z;
} else {
tmp = 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) :: tmp
if ((y <= (-1.42d+41)) .or. (.not. (y <= 5d-74))) then
tmp = x + z
else
tmp = x + (z + y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1.42e+41) || !(y <= 5e-74)) {
tmp = x + z;
} else {
tmp = x + (z + y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.42e+41) or not (y <= 5e-74): tmp = x + z else: tmp = x + (z + y) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.42e+41) || !(y <= 5e-74)) tmp = Float64(x + z); else tmp = Float64(x + Float64(z + y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.42e+41) || ~((y <= 5e-74))) tmp = x + z; else tmp = x + (z + y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.42e+41], N[Not[LessEqual[y, 5e-74]], $MachinePrecision]], N[(x + z), $MachinePrecision], N[(x + N[(z + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.42 \cdot 10^{+41} \lor \neg \left(y \leq 5 \cdot 10^{-74}\right):\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;x + \left(z + y\right)\\
\end{array}
\end{array}
if y < -1.42000000000000007e41 or 4.99999999999999998e-74 < y Initial program 99.9%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 41.4%
+-commutative41.4%
Simplified41.4%
if -1.42000000000000007e41 < y < 4.99999999999999998e-74Initial program 100.0%
associate-+l+100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around 0 92.6%
+-commutative92.6%
+-commutative92.6%
Simplified92.6%
Final simplification67.4%
(FPCore (x y z) :precision binary64 (if (<= x -2.5e+99) x (if (<= x 4.4e-9) z x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -2.5e+99) {
tmp = x;
} else if (x <= 4.4e-9) {
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.5d+99)) then
tmp = x
else if (x <= 4.4d-9) 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.5e+99) {
tmp = x;
} else if (x <= 4.4e-9) {
tmp = z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -2.5e+99: tmp = x elif x <= 4.4e-9: tmp = z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -2.5e+99) tmp = x; elseif (x <= 4.4e-9) tmp = z; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -2.5e+99) tmp = x; elseif (x <= 4.4e-9) tmp = z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -2.5e+99], x, If[LessEqual[x, 4.4e-9], z, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.5 \cdot 10^{+99}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 4.4 \cdot 10^{-9}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -2.50000000000000004e99 or 4.3999999999999997e-9 < x Initial program 100.0%
associate-+l+100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in x around inf 99.1%
associate-+r+99.1%
associate-/l*99.0%
Simplified99.0%
Taylor expanded in x around inf 72.5%
if -2.50000000000000004e99 < x < 4.3999999999999997e-9Initial program 99.9%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 47.1%
+-commutative47.1%
Simplified47.1%
Taylor expanded in z around inf 38.7%
(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%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 62.6%
+-commutative62.6%
Simplified62.6%
Final simplification62.6%
(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%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in x around inf 87.8%
associate-+r+87.8%
associate-/l*87.6%
Simplified87.6%
Taylor expanded in x around inf 34.0%
herbie shell --seed 2024113
(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))))