
(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 (+ (* z (cos y)) (+ x (sin y))))
double code(double x, double y, double z) {
return (z * cos(y)) + (x + sin(y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (z * cos(y)) + (x + sin(y))
end function
public static double code(double x, double y, double z) {
return (z * Math.cos(y)) + (x + Math.sin(y));
}
def code(x, y, z): return (z * math.cos(y)) + (x + math.sin(y))
function code(x, y, z) return Float64(Float64(z * cos(y)) + Float64(x + sin(y))) end
function tmp = code(x, y, z) tmp = (z * cos(y)) + (x + sin(y)); end
code[x_, y_, z_] := N[(N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision] + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
z \cdot \cos y + \left(x + \sin y\right)
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.0032) (not (<= z 6.6e-6))) (+ x (* z (cos y))) (+ z (+ x (sin y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.0032) || !(z <= 6.6e-6)) {
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 <= (-0.0032d0)) .or. (.not. (z <= 6.6d-6))) 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 <= -0.0032) || !(z <= 6.6e-6)) {
tmp = x + (z * Math.cos(y));
} else {
tmp = z + (x + Math.sin(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.0032) or not (z <= 6.6e-6): 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 <= -0.0032) || !(z <= 6.6e-6)) 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 <= -0.0032) || ~((z <= 6.6e-6))) tmp = x + (z * cos(y)); else tmp = z + (x + sin(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.0032], N[Not[LessEqual[z, 6.6e-6]], $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 -0.0032 \lor \neg \left(z \leq 6.6 \cdot 10^{-6}\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;z + \left(x + \sin y\right)\\
\end{array}
\end{array}
if z < -0.00320000000000000015 or 6.60000000000000034e-6 < z Initial program 99.9%
Taylor expanded in x around inf 99.2%
if -0.00320000000000000015 < z < 6.60000000000000034e-6Initial program 100.0%
Taylor expanded in y around 0 99.3%
Final simplification99.3%
(FPCore (x y z) :precision binary64 (if (or (<= z -2.4e-110) (not (<= z 2.05e-38))) (+ x (* z (cos y))) (+ x (sin y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.4e-110) || !(z <= 2.05e-38)) {
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.4d-110)) .or. (.not. (z <= 2.05d-38))) 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.4e-110) || !(z <= 2.05e-38)) {
tmp = x + (z * Math.cos(y));
} else {
tmp = x + Math.sin(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.4e-110) or not (z <= 2.05e-38): 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.4e-110) || !(z <= 2.05e-38)) 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.4e-110) || ~((z <= 2.05e-38))) tmp = x + (z * cos(y)); else tmp = x + sin(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.4e-110], N[Not[LessEqual[z, 2.05e-38]], $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.4 \cdot 10^{-110} \lor \neg \left(z \leq 2.05 \cdot 10^{-38}\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;x + \sin y\\
\end{array}
\end{array}
if z < -2.40000000000000006e-110 or 2.0499999999999999e-38 < z Initial program 99.9%
Taylor expanded in x around inf 95.7%
if -2.40000000000000006e-110 < z < 2.0499999999999999e-38Initial program 100.0%
Taylor expanded in z around 0 97.6%
+-commutative97.6%
Simplified97.6%
Final simplification96.5%
(FPCore (x y z) :precision binary64 (if (or (<= z -2.15e+48) (not (<= z 1.7e+15))) (* z (cos y)) (+ x (sin y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.15e+48) || !(z <= 1.7e+15)) {
tmp = 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.15d+48)) .or. (.not. (z <= 1.7d+15))) then
tmp = 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.15e+48) || !(z <= 1.7e+15)) {
tmp = z * Math.cos(y);
} else {
tmp = x + Math.sin(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.15e+48) or not (z <= 1.7e+15): tmp = z * math.cos(y) else: tmp = x + math.sin(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2.15e+48) || !(z <= 1.7e+15)) tmp = 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.15e+48) || ~((z <= 1.7e+15))) tmp = z * cos(y); else tmp = x + sin(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.15e+48], N[Not[LessEqual[z, 1.7e+15]], $MachinePrecision]], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.15 \cdot 10^{+48} \lor \neg \left(z \leq 1.7 \cdot 10^{+15}\right):\\
\;\;\;\;z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;x + \sin y\\
\end{array}
\end{array}
if z < -2.14999999999999989e48 or 1.7e15 < z Initial program 99.9%
Taylor expanded in z around inf 80.7%
if -2.14999999999999989e48 < z < 1.7e15Initial program 100.0%
Taylor expanded in z around 0 91.5%
+-commutative91.5%
Simplified91.5%
Final simplification86.6%
(FPCore (x y z) :precision binary64 (if (<= y -1.05e+128) (* z (cos y)) (if (<= y 1e-24) (+ y (+ x z)) (+ x z))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.05e+128) {
tmp = z * cos(y);
} else if (y <= 1e-24) {
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 <= (-1.05d+128)) then
tmp = z * cos(y)
else if (y <= 1d-24) 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 <= -1.05e+128) {
tmp = z * Math.cos(y);
} else if (y <= 1e-24) {
tmp = y + (x + z);
} else {
tmp = x + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.05e+128: tmp = z * math.cos(y) elif y <= 1e-24: tmp = y + (x + z) else: tmp = x + z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.05e+128) tmp = Float64(z * cos(y)); elseif (y <= 1e-24) 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 <= -1.05e+128) tmp = z * cos(y); elseif (y <= 1e-24) tmp = y + (x + z); else tmp = x + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.05e+128], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1e-24], N[(y + N[(x + z), $MachinePrecision]), $MachinePrecision], N[(x + z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.05 \cdot 10^{+128}:\\
\;\;\;\;z \cdot \cos y\\
\mathbf{elif}\;y \leq 10^{-24}:\\
\;\;\;\;y + \left(x + z\right)\\
\mathbf{else}:\\
\;\;\;\;x + z\\
\end{array}
\end{array}
if y < -1.05e128Initial program 99.8%
Taylor expanded in z around inf 51.9%
if -1.05e128 < y < 9.99999999999999924e-25Initial program 100.0%
Taylor expanded in y around 0 93.4%
+-commutative93.4%
associate-+l+93.4%
Simplified93.4%
if 9.99999999999999924e-25 < y Initial program 99.9%
Taylor expanded in y around 0 49.5%
+-commutative49.5%
Simplified49.5%
Final simplification73.5%
(FPCore (x y z) :precision binary64 (if (or (<= y -4e+37) (not (<= y 5e+17))) (+ 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 <= -4e+37) || !(y <= 5e+17)) {
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 <= (-4d+37)) .or. (.not. (y <= 5d+17))) 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 <= -4e+37) || !(y <= 5e+17)) {
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 <= -4e+37) or not (y <= 5e+17): 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 <= -4e+37) || !(y <= 5e+17)) 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 <= -4e+37) || ~((y <= 5e+17))) 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, -4e+37], N[Not[LessEqual[y, 5e+17]], $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 -4 \cdot 10^{+37} \lor \neg \left(y \leq 5 \cdot 10^{+17}\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 < -3.99999999999999982e37 or 5e17 < y Initial program 99.9%
Taylor expanded in y around 0 40.9%
+-commutative40.9%
Simplified40.9%
if -3.99999999999999982e37 < y < 5e17Initial program 100.0%
Taylor expanded in y around 0 97.2%
Final simplification69.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -4.4e+26) (not (<= y 1.5e+21))) (+ x z) (+ x (+ z (* y (+ 1.0 (* y (* y -0.16666666666666666))))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -4.4e+26) || !(y <= 1.5e+21)) {
tmp = x + z;
} else {
tmp = x + (z + (y * (1.0 + (y * (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 <= (-4.4d+26)) .or. (.not. (y <= 1.5d+21))) then
tmp = x + z
else
tmp = x + (z + (y * (1.0d0 + (y * (y * (-0.16666666666666666d0))))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -4.4e+26) || !(y <= 1.5e+21)) {
tmp = x + z;
} else {
tmp = x + (z + (y * (1.0 + (y * (y * -0.16666666666666666)))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -4.4e+26) or not (y <= 1.5e+21): tmp = x + z else: tmp = x + (z + (y * (1.0 + (y * (y * -0.16666666666666666))))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -4.4e+26) || !(y <= 1.5e+21)) tmp = Float64(x + z); else tmp = Float64(x + Float64(z + Float64(y * Float64(1.0 + Float64(y * Float64(y * -0.16666666666666666)))))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -4.4e+26) || ~((y <= 1.5e+21))) tmp = x + z; else tmp = x + (z + (y * (1.0 + (y * (y * -0.16666666666666666))))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -4.4e+26], N[Not[LessEqual[y, 1.5e+21]], $MachinePrecision]], N[(x + z), $MachinePrecision], N[(x + N[(z + N[(y * N[(1.0 + N[(y * N[(y * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.4 \cdot 10^{+26} \lor \neg \left(y \leq 1.5 \cdot 10^{+21}\right):\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;x + \left(z + y \cdot \left(1 + y \cdot \left(y \cdot -0.16666666666666666\right)\right)\right)\\
\end{array}
\end{array}
if y < -4.40000000000000014e26 or 1.5e21 < y Initial program 99.9%
Taylor expanded in y around 0 40.5%
+-commutative40.5%
Simplified40.5%
if -4.40000000000000014e26 < y < 1.5e21Initial program 100.0%
Taylor expanded in y around 0 97.9%
Taylor expanded in z around 0 97.9%
*-commutative97.9%
Simplified97.9%
Final simplification69.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -3.2e+26) (not (<= y 1e-24))) (+ x z) (+ y (+ x z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3.2e+26) || !(y <= 1e-24)) {
tmp = x + z;
} else {
tmp = y + (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 <= (-3.2d+26)) .or. (.not. (y <= 1d-24))) then
tmp = x + z
else
tmp = y + (x + z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -3.2e+26) || !(y <= 1e-24)) {
tmp = x + z;
} else {
tmp = y + (x + z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -3.2e+26) or not (y <= 1e-24): tmp = x + z else: tmp = y + (x + z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -3.2e+26) || !(y <= 1e-24)) tmp = Float64(x + z); else tmp = Float64(y + Float64(x + z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -3.2e+26) || ~((y <= 1e-24))) tmp = x + z; else tmp = y + (x + z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -3.2e+26], N[Not[LessEqual[y, 1e-24]], $MachinePrecision]], N[(x + z), $MachinePrecision], N[(y + N[(x + z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.2 \cdot 10^{+26} \lor \neg \left(y \leq 10^{-24}\right):\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;y + \left(x + z\right)\\
\end{array}
\end{array}
if y < -3.20000000000000029e26 or 9.99999999999999924e-25 < y Initial program 99.9%
Taylor expanded in y around 0 41.9%
+-commutative41.9%
Simplified41.9%
if -3.20000000000000029e26 < y < 9.99999999999999924e-25Initial program 100.0%
Taylor expanded in y around 0 99.9%
+-commutative99.9%
associate-+l+99.9%
Simplified99.9%
Final simplification69.8%
(FPCore (x y z) :precision binary64 (if (<= x -1.2e-9) x (if (<= x 0.029) z x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.2e-9) {
tmp = x;
} else if (x <= 0.029) {
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 <= (-1.2d-9)) then
tmp = x
else if (x <= 0.029d0) 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 <= -1.2e-9) {
tmp = x;
} else if (x <= 0.029) {
tmp = z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.2e-9: tmp = x elif x <= 0.029: tmp = z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.2e-9) tmp = x; elseif (x <= 0.029) tmp = z; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.2e-9) tmp = x; elseif (x <= 0.029) tmp = z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.2e-9], x, If[LessEqual[x, 0.029], z, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.2 \cdot 10^{-9}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 0.029:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.2e-9 or 0.0290000000000000015 < x Initial program 100.0%
Taylor expanded in y around 0 83.7%
+-commutative83.7%
Simplified83.7%
Taylor expanded in z around 0 73.3%
if -1.2e-9 < x < 0.0290000000000000015Initial program 99.9%
Taylor expanded in y around 0 80.6%
Taylor expanded in z around inf 40.5%
(FPCore (x y z) :precision binary64 (if (<= x -1.32e-79) x (if (<= x 5.2e-116) y x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.32e-79) {
tmp = x;
} else if (x <= 5.2e-116) {
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.32d-79)) then
tmp = x
else if (x <= 5.2d-116) 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.32e-79) {
tmp = x;
} else if (x <= 5.2e-116) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.32e-79: tmp = x elif x <= 5.2e-116: tmp = y else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.32e-79) tmp = x; elseif (x <= 5.2e-116) tmp = y; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.32e-79) tmp = x; elseif (x <= 5.2e-116) tmp = y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.32e-79], x, If[LessEqual[x, 5.2e-116], y, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.32 \cdot 10^{-79}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{-116}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.32e-79 or 5.2000000000000001e-116 < x Initial program 99.9%
Taylor expanded in y around 0 74.3%
+-commutative74.3%
Simplified74.3%
Taylor expanded in z around 0 57.4%
if -1.32e-79 < x < 5.2000000000000001e-116Initial program 100.0%
Taylor expanded in z around inf 99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
Simplified99.8%
Taylor expanded in y around 0 57.6%
Taylor expanded in y around inf 16.9%
(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 64.6%
+-commutative64.6%
Simplified64.6%
Final simplification64.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%
Taylor expanded in y around 0 64.6%
+-commutative64.6%
Simplified64.6%
Taylor expanded in z around 0 40.3%
herbie shell --seed 2024135
(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))))