
(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 (fma z (- (sin y)) (+ (cos y) x)))
double code(double x, double y, double z) {
return fma(z, -sin(y), (cos(y) + x));
}
function code(x, y, z) return fma(z, Float64(-sin(y)), Float64(cos(y) + x)) end
code[x_, y_, z_] := N[(z * (-N[Sin[y], $MachinePrecision]) + N[(N[Cos[y], $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z, -\sin y, \cos y + x\right)
\end{array}
Initial program 100.0%
Taylor expanded in z around 0 100.0%
associate-+r+100.0%
mul-1-neg100.0%
distribute-rgt-neg-out100.0%
+-commutative100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z) :precision binary64 (if (<= x -118.0) (+ (cos y) x) (if (<= x 16200000.0) (- (cos y) (* z (sin y))) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -118.0) {
tmp = cos(y) + x;
} else if (x <= 16200000.0) {
tmp = cos(y) - (z * sin(y));
} 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 (x <= (-118.0d0)) then
tmp = cos(y) + x
else if (x <= 16200000.0d0) then
tmp = cos(y) - (z * sin(y))
else
tmp = x + 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -118.0) {
tmp = Math.cos(y) + x;
} else if (x <= 16200000.0) {
tmp = Math.cos(y) - (z * Math.sin(y));
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -118.0: tmp = math.cos(y) + x elif x <= 16200000.0: tmp = math.cos(y) - (z * math.sin(y)) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -118.0) tmp = Float64(cos(y) + x); elseif (x <= 16200000.0) tmp = Float64(cos(y) - Float64(z * sin(y))); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -118.0) tmp = cos(y) + x; elseif (x <= 16200000.0) tmp = cos(y) - (z * sin(y)); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -118.0], N[(N[Cos[y], $MachinePrecision] + x), $MachinePrecision], If[LessEqual[x, 16200000.0], N[(N[Cos[y], $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -118:\\
\;\;\;\;\cos y + x\\
\mathbf{elif}\;x \leq 16200000:\\
\;\;\;\;\cos y - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if x < -118Initial program 100.0%
Taylor expanded in z around 0 89.0%
+-commutative89.0%
Simplified89.0%
if -118 < x < 1.62e7Initial program 100.0%
Taylor expanded in x around 0 99.0%
if 1.62e7 < x Initial program 100.0%
Taylor expanded in y around 0 85.8%
+-commutative85.8%
Simplified85.8%
Final simplification93.3%
(FPCore (x y z) :precision binary64 (- (+ (cos y) x) (* z (sin y))))
double code(double x, double y, double z) {
return (cos(y) + x) - (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 = (cos(y) + x) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (Math.cos(y) + x) - (z * Math.sin(y));
}
def code(x, y, z): return (math.cos(y) + x) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(cos(y) + x) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (cos(y) + x) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(N[Cos[y], $MachinePrecision] + x), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\cos y + x\right) - z \cdot \sin y
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -5e-5) (not (<= y 0.32))) (+ (cos y) x) (+ x (- 1.0 (* z y)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -5e-5) || !(y <= 0.32)) {
tmp = cos(y) + x;
} else {
tmp = x + (1.0 - (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 <= (-5d-5)) .or. (.not. (y <= 0.32d0))) then
tmp = cos(y) + x
else
tmp = x + (1.0d0 - (z * y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -5e-5) || !(y <= 0.32)) {
tmp = Math.cos(y) + x;
} else {
tmp = x + (1.0 - (z * y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -5e-5) or not (y <= 0.32): tmp = math.cos(y) + x else: tmp = x + (1.0 - (z * y)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -5e-5) || !(y <= 0.32)) tmp = Float64(cos(y) + x); else tmp = Float64(x + Float64(1.0 - Float64(z * y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -5e-5) || ~((y <= 0.32))) tmp = cos(y) + x; else tmp = x + (1.0 - (z * y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -5e-5], N[Not[LessEqual[y, 0.32]], $MachinePrecision]], N[(N[Cos[y], $MachinePrecision] + x), $MachinePrecision], N[(x + N[(1.0 - N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{-5} \lor \neg \left(y \leq 0.32\right):\\
\;\;\;\;\cos y + x\\
\mathbf{else}:\\
\;\;\;\;x + \left(1 - z \cdot y\right)\\
\end{array}
\end{array}
if y < -5.00000000000000024e-5 or 0.320000000000000007 < y Initial program 99.9%
Taylor expanded in z around 0 65.4%
+-commutative65.4%
Simplified65.4%
if -5.00000000000000024e-5 < y < 0.320000000000000007Initial program 100.0%
Taylor expanded in y around 0 99.2%
+-commutative99.2%
associate-+l+99.2%
+-commutative99.2%
mul-1-neg99.2%
neg-sub099.2%
associate-+r-99.2%
metadata-eval99.2%
Simplified99.2%
Final simplification84.0%
(FPCore (x y z) :precision binary64 (if (<= z -4.5e+69) (* z (- (sin y))) (if (<= z 2.15e+91) (+ (cos y) x) (+ x (- 1.0 (* z y))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -4.5e+69) {
tmp = z * -sin(y);
} else if (z <= 2.15e+91) {
tmp = cos(y) + x;
} else {
tmp = x + (1.0 - (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 (z <= (-4.5d+69)) then
tmp = z * -sin(y)
else if (z <= 2.15d+91) then
tmp = cos(y) + x
else
tmp = x + (1.0d0 - (z * y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -4.5e+69) {
tmp = z * -Math.sin(y);
} else if (z <= 2.15e+91) {
tmp = Math.cos(y) + x;
} else {
tmp = x + (1.0 - (z * y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -4.5e+69: tmp = z * -math.sin(y) elif z <= 2.15e+91: tmp = math.cos(y) + x else: tmp = x + (1.0 - (z * y)) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -4.5e+69) tmp = Float64(z * Float64(-sin(y))); elseif (z <= 2.15e+91) tmp = Float64(cos(y) + x); else tmp = Float64(x + Float64(1.0 - Float64(z * y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -4.5e+69) tmp = z * -sin(y); elseif (z <= 2.15e+91) tmp = cos(y) + x; else tmp = x + (1.0 - (z * y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -4.5e+69], N[(z * (-N[Sin[y], $MachinePrecision])), $MachinePrecision], If[LessEqual[z, 2.15e+91], N[(N[Cos[y], $MachinePrecision] + x), $MachinePrecision], N[(x + N[(1.0 - N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.5 \cdot 10^{+69}:\\
\;\;\;\;z \cdot \left(-\sin y\right)\\
\mathbf{elif}\;z \leq 2.15 \cdot 10^{+91}:\\
\;\;\;\;\cos y + x\\
\mathbf{else}:\\
\;\;\;\;x + \left(1 - z \cdot y\right)\\
\end{array}
\end{array}
if z < -4.4999999999999999e69Initial program 99.9%
Taylor expanded in z around inf 74.0%
mul-1-neg74.0%
distribute-rgt-neg-out74.0%
Simplified74.0%
if -4.4999999999999999e69 < z < 2.15e91Initial program 100.0%
Taylor expanded in z around 0 94.6%
+-commutative94.6%
Simplified94.6%
if 2.15e91 < z Initial program 100.0%
Taylor expanded in y around 0 68.4%
+-commutative68.4%
associate-+l+68.4%
+-commutative68.4%
mul-1-neg68.4%
neg-sub068.4%
associate-+r-68.4%
metadata-eval68.4%
Simplified68.4%
Final simplification86.8%
(FPCore (x y z) :precision binary64 (if (or (<= x -3.7e-138) (not (<= x 3e-212))) (+ x (- 1.0 (* z y))) (cos y)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -3.7e-138) || !(x <= 3e-212)) {
tmp = x + (1.0 - (z * y));
} 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 <= (-3.7d-138)) .or. (.not. (x <= 3d-212))) then
tmp = x + (1.0d0 - (z * y))
else
tmp = cos(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -3.7e-138) || !(x <= 3e-212)) {
tmp = x + (1.0 - (z * y));
} else {
tmp = Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -3.7e-138) or not (x <= 3e-212): tmp = x + (1.0 - (z * y)) else: tmp = math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -3.7e-138) || !(x <= 3e-212)) tmp = Float64(x + Float64(1.0 - Float64(z * y))); else tmp = cos(y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -3.7e-138) || ~((x <= 3e-212))) tmp = x + (1.0 - (z * y)); else tmp = cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -3.7e-138], N[Not[LessEqual[x, 3e-212]], $MachinePrecision]], N[(x + N[(1.0 - N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Cos[y], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.7 \cdot 10^{-138} \lor \neg \left(x \leq 3 \cdot 10^{-212}\right):\\
\;\;\;\;x + \left(1 - z \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;\cos y\\
\end{array}
\end{array}
if x < -3.69999999999999991e-138 or 3.0000000000000003e-212 < x Initial program 100.0%
Taylor expanded in y around 0 78.0%
+-commutative78.0%
associate-+l+78.0%
+-commutative78.0%
mul-1-neg78.0%
neg-sub078.0%
associate-+r-78.0%
metadata-eval78.0%
Simplified78.0%
if -3.69999999999999991e-138 < x < 3.0000000000000003e-212Initial program 99.9%
Taylor expanded in x around 0 99.9%
Taylor expanded in z around 0 67.4%
Final simplification75.8%
(FPCore (x y z) :precision binary64 (if (or (<= x -19.0) (not (<= x 15000000.0))) (+ x 1.0) (- 1.0 (* z y))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -19.0) || !(x <= 15000000.0)) {
tmp = x + 1.0;
} else {
tmp = 1.0 - (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 ((x <= (-19.0d0)) .or. (.not. (x <= 15000000.0d0))) then
tmp = x + 1.0d0
else
tmp = 1.0d0 - (z * y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -19.0) || !(x <= 15000000.0)) {
tmp = x + 1.0;
} else {
tmp = 1.0 - (z * y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -19.0) or not (x <= 15000000.0): tmp = x + 1.0 else: tmp = 1.0 - (z * y) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -19.0) || !(x <= 15000000.0)) tmp = Float64(x + 1.0); else tmp = Float64(1.0 - Float64(z * y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -19.0) || ~((x <= 15000000.0))) tmp = x + 1.0; else tmp = 1.0 - (z * y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -19.0], N[Not[LessEqual[x, 15000000.0]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(1.0 - N[(z * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -19 \lor \neg \left(x \leq 15000000\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 - z \cdot y\\
\end{array}
\end{array}
if x < -19 or 1.5e7 < x Initial program 100.0%
Taylor expanded in y around 0 86.2%
+-commutative86.2%
Simplified86.2%
if -19 < x < 1.5e7Initial program 100.0%
Taylor expanded in x around 0 99.0%
Taylor expanded in y around 0 59.1%
mul-1-neg59.1%
unsub-neg59.1%
Simplified59.1%
Final simplification72.6%
(FPCore (x y z) :precision binary64 (if (<= y 1.46e+113) (+ x (- 1.0 (* z y))) (+ x 1.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= 1.46e+113) {
tmp = x + (1.0 - (z * y));
} 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 <= 1.46d+113) then
tmp = x + (1.0d0 - (z * y))
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 <= 1.46e+113) {
tmp = x + (1.0 - (z * y));
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 1.46e+113: tmp = x + (1.0 - (z * y)) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= 1.46e+113) tmp = Float64(x + Float64(1.0 - Float64(z * y))); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 1.46e+113) tmp = x + (1.0 - (z * y)); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 1.46e+113], N[(x + N[(1.0 - N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.46 \cdot 10^{+113}:\\
\;\;\;\;x + \left(1 - z \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if y < 1.46e113Initial program 100.0%
Taylor expanded in y around 0 76.8%
+-commutative76.8%
associate-+l+76.8%
+-commutative76.8%
mul-1-neg76.8%
neg-sub076.8%
associate-+r-76.8%
metadata-eval76.8%
Simplified76.8%
if 1.46e113 < y Initial program 99.9%
Taylor expanded in y around 0 56.5%
+-commutative56.5%
Simplified56.5%
Final simplification73.7%
(FPCore (x y z) :precision binary64 (if (<= z -7.8e+229) (* z (- y)) (+ x 1.0)))
double code(double x, double y, double z) {
double tmp;
if (z <= -7.8e+229) {
tmp = z * -y;
} 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 (z <= (-7.8d+229)) then
tmp = z * -y
else
tmp = x + 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -7.8e+229) {
tmp = z * -y;
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -7.8e+229: tmp = z * -y else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (z <= -7.8e+229) tmp = Float64(z * Float64(-y)); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -7.8e+229) tmp = z * -y; else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -7.8e+229], N[(z * (-y)), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.8 \cdot 10^{+229}:\\
\;\;\;\;z \cdot \left(-y\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if z < -7.7999999999999996e229Initial program 99.9%
Taylor expanded in y around 0 59.1%
+-commutative59.1%
associate-+l+59.1%
+-commutative59.1%
mul-1-neg59.1%
neg-sub059.1%
associate-+r-59.1%
metadata-eval59.1%
Simplified59.1%
Taylor expanded in y around inf 45.8%
mul-1-neg45.8%
Simplified45.8%
if -7.7999999999999996e229 < z Initial program 100.0%
Taylor expanded in y around 0 70.6%
+-commutative70.6%
Simplified70.6%
Final simplification68.6%
(FPCore (x y z) :precision binary64 (if (<= x -19.0) x (if (<= x 1.25) 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -19.0) {
tmp = x;
} else if (x <= 1.25) {
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 <= (-19.0d0)) then
tmp = x
else if (x <= 1.25d0) 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 <= -19.0) {
tmp = x;
} else if (x <= 1.25) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -19.0: tmp = x elif x <= 1.25: tmp = 1.0 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -19.0) tmp = x; elseif (x <= 1.25) tmp = 1.0; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -19.0) tmp = x; elseif (x <= 1.25) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -19.0], x, If[LessEqual[x, 1.25], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -19:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.25:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -19 or 1.25 < x Initial program 100.0%
Taylor expanded in x around inf 83.9%
if -19 < x < 1.25Initial program 100.0%
Taylor expanded in x around 0 99.6%
Taylor expanded in y around 0 46.1%
Final simplification65.3%
(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 100.0%
Taylor expanded in y around 0 65.8%
+-commutative65.8%
Simplified65.8%
Final simplification65.8%
(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 100.0%
Taylor expanded in x around 0 57.7%
Taylor expanded in y around 0 24.2%
Final simplification24.2%
herbie shell --seed 2023301
(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))))