
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * 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 = (x + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * 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 = (x + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * 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 = (x + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (sin y))))
(if (or (<= x -6.6e-8) (not (<= x 4.2e-7)))
(- (+ x 1.0) t_0)
(- (cos y) t_0))))
double code(double x, double y, double z) {
double t_0 = z * sin(y);
double tmp;
if ((x <= -6.6e-8) || !(x <= 4.2e-7)) {
tmp = (x + 1.0) - t_0;
} else {
tmp = cos(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 = z * sin(y)
if ((x <= (-6.6d-8)) .or. (.not. (x <= 4.2d-7))) then
tmp = (x + 1.0d0) - t_0
else
tmp = cos(y) - t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * Math.sin(y);
double tmp;
if ((x <= -6.6e-8) || !(x <= 4.2e-7)) {
tmp = (x + 1.0) - t_0;
} else {
tmp = Math.cos(y) - t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.sin(y) tmp = 0 if (x <= -6.6e-8) or not (x <= 4.2e-7): tmp = (x + 1.0) - t_0 else: tmp = math.cos(y) - t_0 return tmp
function code(x, y, z) t_0 = Float64(z * sin(y)) tmp = 0.0 if ((x <= -6.6e-8) || !(x <= 4.2e-7)) tmp = Float64(Float64(x + 1.0) - t_0); else tmp = Float64(cos(y) - t_0); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * sin(y); tmp = 0.0; if ((x <= -6.6e-8) || ~((x <= 4.2e-7))) tmp = (x + 1.0) - t_0; else tmp = cos(y) - t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[x, -6.6e-8], N[Not[LessEqual[x, 4.2e-7]], $MachinePrecision]], N[(N[(x + 1.0), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[Cos[y], $MachinePrecision] - t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \sin y\\
\mathbf{if}\;x \leq -6.6 \cdot 10^{-8} \lor \neg \left(x \leq 4.2 \cdot 10^{-7}\right):\\
\;\;\;\;\left(x + 1\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\cos y - t\_0\\
\end{array}
\end{array}
if x < -6.59999999999999954e-8 or 4.2e-7 < x Initial program 99.9%
Taylor expanded in y around 0 99.1%
+-commutative99.1%
Simplified99.1%
if -6.59999999999999954e-8 < x < 4.2e-7Initial program 99.9%
Taylor expanded in x around 0 98.8%
Final simplification99.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.95e-22) (not (<= z 2.3e-39))) (- (+ x 1.0) (* z (sin y))) (- (+ x (cos y)) (* y z))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.95e-22) || !(z <= 2.3e-39)) {
tmp = (x + 1.0) - (z * sin(y));
} else {
tmp = (x + cos(y)) - (y * z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-1.95d-22)) .or. (.not. (z <= 2.3d-39))) then
tmp = (x + 1.0d0) - (z * sin(y))
else
tmp = (x + cos(y)) - (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.95e-22) || !(z <= 2.3e-39)) {
tmp = (x + 1.0) - (z * Math.sin(y));
} else {
tmp = (x + Math.cos(y)) - (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.95e-22) or not (z <= 2.3e-39): tmp = (x + 1.0) - (z * math.sin(y)) else: tmp = (x + math.cos(y)) - (y * z) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.95e-22) || !(z <= 2.3e-39)) tmp = Float64(Float64(x + 1.0) - Float64(z * sin(y))); else tmp = Float64(Float64(x + cos(y)) - Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.95e-22) || ~((z <= 2.3e-39))) tmp = (x + 1.0) - (z * sin(y)); else tmp = (x + cos(y)) - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.95e-22], N[Not[LessEqual[z, 2.3e-39]], $MachinePrecision]], N[(N[(x + 1.0), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.95 \cdot 10^{-22} \lor \neg \left(z \leq 2.3 \cdot 10^{-39}\right):\\
\;\;\;\;\left(x + 1\right) - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;\left(x + \cos y\right) - y \cdot z\\
\end{array}
\end{array}
if z < -1.94999999999999999e-22 or 2.30000000000000008e-39 < z Initial program 99.9%
Taylor expanded in y around 0 97.6%
+-commutative97.6%
Simplified97.6%
if -1.94999999999999999e-22 < z < 2.30000000000000008e-39Initial program 100.0%
Taylor expanded in y around 0 91.3%
Final simplification94.6%
(FPCore (x y z) :precision binary64 (if (or (<= x -50.0) (not (<= x 0.95))) (+ x 1.0) (- 1.0 (* z (sin y)))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -50.0) || !(x <= 0.95)) {
tmp = x + 1.0;
} else {
tmp = 1.0 - (z * 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 ((x <= (-50.0d0)) .or. (.not. (x <= 0.95d0))) then
tmp = x + 1.0d0
else
tmp = 1.0d0 - (z * sin(y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -50.0) || !(x <= 0.95)) {
tmp = x + 1.0;
} else {
tmp = 1.0 - (z * Math.sin(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -50.0) or not (x <= 0.95): tmp = x + 1.0 else: tmp = 1.0 - (z * math.sin(y)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -50.0) || !(x <= 0.95)) tmp = Float64(x + 1.0); else tmp = Float64(1.0 - Float64(z * sin(y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -50.0) || ~((x <= 0.95))) tmp = x + 1.0; else tmp = 1.0 - (z * sin(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -50.0], N[Not[LessEqual[x, 0.95]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(1.0 - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -50 \lor \neg \left(x \leq 0.95\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 - z \cdot \sin y\\
\end{array}
\end{array}
if x < -50 or 0.94999999999999996 < x Initial program 99.9%
Taylor expanded in y around 0 78.3%
Taylor expanded in y around 0 60.8%
*-commutative60.8%
Simplified60.8%
Taylor expanded in y around 0 81.9%
if -50 < x < 0.94999999999999996Initial program 99.9%
Taylor expanded in x around 0 97.8%
Taylor expanded in y around 0 77.7%
Final simplification79.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -4000000000000.0) (not (<= y 0.00082))) (- x (* z (sin y))) (- (+ x 1.0) (* y z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -4000000000000.0) || !(y <= 0.00082)) {
tmp = x - (z * sin(y));
} else {
tmp = (x + 1.0) - (y * z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-4000000000000.0d0)) .or. (.not. (y <= 0.00082d0))) then
tmp = x - (z * sin(y))
else
tmp = (x + 1.0d0) - (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -4000000000000.0) || !(y <= 0.00082)) {
tmp = x - (z * Math.sin(y));
} else {
tmp = (x + 1.0) - (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -4000000000000.0) or not (y <= 0.00082): tmp = x - (z * math.sin(y)) else: tmp = (x + 1.0) - (y * z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -4000000000000.0) || !(y <= 0.00082)) tmp = Float64(x - Float64(z * sin(y))); else tmp = Float64(Float64(x + 1.0) - Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -4000000000000.0) || ~((y <= 0.00082))) tmp = x - (z * sin(y)); else tmp = (x + 1.0) - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -4000000000000.0], N[Not[LessEqual[y, 0.00082]], $MachinePrecision]], N[(x - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + 1.0), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4000000000000 \lor \neg \left(y \leq 0.00082\right):\\
\;\;\;\;x - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;\left(x + 1\right) - y \cdot z\\
\end{array}
\end{array}
if y < -4e12 or 8.1999999999999998e-4 < y Initial program 99.9%
Taylor expanded in x around inf 78.4%
if -4e12 < y < 8.1999999999999998e-4Initial program 100.0%
Taylor expanded in y around 0 98.0%
+-commutative98.0%
Simplified98.0%
Taylor expanded in y around 0 98.0%
Final simplification88.7%
(FPCore (x y z) :precision binary64 (if (or (<= x -5.8e-11) (not (<= x 8.8e-7))) (+ x 1.0) (cos y)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -5.8e-11) || !(x <= 8.8e-7)) {
tmp = x + 1.0;
} else {
tmp = cos(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 ((x <= (-5.8d-11)) .or. (.not. (x <= 8.8d-7))) then
tmp = x + 1.0d0
else
tmp = cos(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -5.8e-11) || !(x <= 8.8e-7)) {
tmp = x + 1.0;
} else {
tmp = Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -5.8e-11) or not (x <= 8.8e-7): tmp = x + 1.0 else: tmp = math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -5.8e-11) || !(x <= 8.8e-7)) tmp = Float64(x + 1.0); else tmp = cos(y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -5.8e-11) || ~((x <= 8.8e-7))) tmp = x + 1.0; else tmp = cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -5.8e-11], N[Not[LessEqual[x, 8.8e-7]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[Cos[y], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.8 \cdot 10^{-11} \lor \neg \left(x \leq 8.8 \cdot 10^{-7}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;\cos y\\
\end{array}
\end{array}
if x < -5.8e-11 or 8.8000000000000004e-7 < x Initial program 99.9%
Taylor expanded in y around 0 77.1%
Taylor expanded in y around 0 60.2%
*-commutative60.2%
Simplified60.2%
Taylor expanded in y around 0 80.5%
if -5.8e-11 < x < 8.8000000000000004e-7Initial program 99.9%
Taylor expanded in x around 0 98.8%
Taylor expanded in y around 0 66.7%
Taylor expanded in z around 0 63.6%
Final simplification72.8%
(FPCore (x y z) :precision binary64 (- (+ x 1.0) (* z (sin y))))
double code(double x, double y, double z) {
return (x + 1.0) - (z * 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 = (x + 1.0d0) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + 1.0) - (z * Math.sin(y));
}
def code(x, y, z): return (x + 1.0) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + 1.0) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + 1.0) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + 1.0), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + 1\right) - z \cdot \sin y
\end{array}
Initial program 99.9%
Taylor expanded in y around 0 89.5%
+-commutative89.5%
Simplified89.5%
Final simplification89.5%
(FPCore (x y z) :precision binary64 (if (or (<= x -4.4e-90) (not (<= x 1.45e-48))) (+ x 1.0) (- 1.0 (* y z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -4.4e-90) || !(x <= 1.45e-48)) {
tmp = x + 1.0;
} else {
tmp = 1.0 - (y * z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= (-4.4d-90)) .or. (.not. (x <= 1.45d-48))) then
tmp = x + 1.0d0
else
tmp = 1.0d0 - (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -4.4e-90) || !(x <= 1.45e-48)) {
tmp = x + 1.0;
} else {
tmp = 1.0 - (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -4.4e-90) or not (x <= 1.45e-48): tmp = x + 1.0 else: tmp = 1.0 - (y * z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -4.4e-90) || !(x <= 1.45e-48)) tmp = Float64(x + 1.0); else tmp = Float64(1.0 - Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -4.4e-90) || ~((x <= 1.45e-48))) tmp = x + 1.0; else tmp = 1.0 - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -4.4e-90], N[Not[LessEqual[x, 1.45e-48]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.4 \cdot 10^{-90} \lor \neg \left(x \leq 1.45 \cdot 10^{-48}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 - y \cdot z\\
\end{array}
\end{array}
if x < -4.39999999999999972e-90 or 1.4500000000000001e-48 < x Initial program 100.0%
Taylor expanded in y around 0 76.3%
Taylor expanded in y around 0 59.2%
*-commutative59.2%
Simplified59.2%
Taylor expanded in y around 0 76.2%
if -4.39999999999999972e-90 < x < 1.4500000000000001e-48Initial program 99.9%
Taylor expanded in x around 0 99.9%
Taylor expanded in y around 0 80.1%
Taylor expanded in y around 0 56.2%
Final simplification69.2%
(FPCore (x y z) :precision binary64 (if (<= y 1050000000.0) (- (+ x 1.0) (* y z)) (+ x 1.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= 1050000000.0) {
tmp = (x + 1.0) - (y * z);
} else {
tmp = x + 1.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) :: tmp
if (y <= 1050000000.0d0) then
tmp = (x + 1.0d0) - (y * z)
else
tmp = x + 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 1050000000.0) {
tmp = (x + 1.0) - (y * z);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 1050000000.0: tmp = (x + 1.0) - (y * z) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= 1050000000.0) tmp = Float64(Float64(x + 1.0) - Float64(y * z)); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 1050000000.0) tmp = (x + 1.0) - (y * z); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 1050000000.0], N[(N[(x + 1.0), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1050000000:\\
\;\;\;\;\left(x + 1\right) - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if y < 1.05e9Initial program 100.0%
Taylor expanded in y around 0 92.0%
+-commutative92.0%
Simplified92.0%
Taylor expanded in y around 0 78.4%
if 1.05e9 < y Initial program 99.9%
Taylor expanded in y around 0 47.7%
Taylor expanded in y around 0 12.6%
*-commutative12.6%
Simplified12.6%
Taylor expanded in y around 0 49.9%
Final simplification70.3%
(FPCore (x y z) :precision binary64 (if (<= x -0.0074) x (if (<= x 0.46) 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -0.0074) {
tmp = x;
} else if (x <= 0.46) {
tmp = 1.0;
} 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 <= (-0.0074d0)) then
tmp = x
else if (x <= 0.46d0) then
tmp = 1.0d0
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -0.0074) {
tmp = x;
} else if (x <= 0.46) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -0.0074: tmp = x elif x <= 0.46: tmp = 1.0 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -0.0074) tmp = x; elseif (x <= 0.46) tmp = 1.0; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -0.0074) tmp = x; elseif (x <= 0.46) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -0.0074], x, If[LessEqual[x, 0.46], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.0074:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 0.46:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -0.0074000000000000003 or 0.46000000000000002 < x Initial program 99.9%
Taylor expanded in y around 0 77.3%
Taylor expanded in y around 0 60.0%
*-commutative60.0%
Simplified60.0%
Taylor expanded in x around inf 78.7%
if -0.0074000000000000003 < x < 0.46000000000000002Initial program 99.9%
Taylor expanded in x around 0 97.8%
Taylor expanded in y around 0 65.7%
Taylor expanded in y around 0 43.1%
Final simplification62.0%
(FPCore (x y z) :precision binary64 (+ x 1.0))
double code(double x, double y, double z) {
return x + 1.0;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + 1.0d0
end function
public static double code(double x, double y, double z) {
return x + 1.0;
}
def code(x, y, z): return x + 1.0
function code(x, y, z) return Float64(x + 1.0) end
function tmp = code(x, y, z) tmp = x + 1.0; end
code[x_, y_, z_] := N[(x + 1.0), $MachinePrecision]
\begin{array}{l}
\\
x + 1
\end{array}
Initial program 99.9%
Taylor expanded in y around 0 72.8%
Taylor expanded in y around 0 57.8%
*-commutative57.8%
Simplified57.8%
Taylor expanded in y around 0 63.7%
Final simplification63.7%
(FPCore (x y z) :precision binary64 1.0)
double code(double x, double y, double z) {
return 1.0;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0
end function
public static double code(double x, double y, double z) {
return 1.0;
}
def code(x, y, z): return 1.0
function code(x, y, z) return 1.0 end
function tmp = code(x, y, z) tmp = 1.0; end
code[x_, y_, z_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 99.9%
Taylor expanded in x around 0 56.6%
Taylor expanded in y around 0 34.7%
Taylor expanded in y around 0 21.8%
Final simplification21.8%
herbie shell --seed 2024115
(FPCore (x y z)
:name "Graphics.Rasterific.Svg.PathConverter:segmentToBezier from rasterific-svg-0.2.3.1, B"
:precision binary64
(- (+ x (cos y)) (* z (sin y))))