
(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 14 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 (sin y) (- z) (+ (cos y) x)))
double code(double x, double y, double z) {
return fma(sin(y), -z, (cos(y) + x));
}
function code(x, y, z) return fma(sin(y), Float64(-z), Float64(cos(y) + x)) end
code[x_, y_, z_] := N[(N[Sin[y], $MachinePrecision] * (-z) + N[(N[Cos[y], $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\sin y, -z, \cos y + x\right)
\end{array}
Initial program 99.9%
Taylor expanded in z around 0 99.9%
associate-+r+99.9%
associate-*r*99.9%
neg-mul-199.9%
*-commutative99.9%
+-commutative99.9%
fma-define99.9%
+-commutative99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (- (+ (cos y) x) (* (sin y) z)))
double code(double x, double y, double z) {
return (cos(y) + x) - (sin(y) * z);
}
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) - (sin(y) * z)
end function
public static double code(double x, double y, double z) {
return (Math.cos(y) + x) - (Math.sin(y) * z);
}
def code(x, y, z): return (math.cos(y) + x) - (math.sin(y) * z)
function code(x, y, z) return Float64(Float64(cos(y) + x) - Float64(sin(y) * z)) end
function tmp = code(x, y, z) tmp = (cos(y) + x) - (sin(y) * z); end
code[x_, y_, z_] := N[(N[(N[Cos[y], $MachinePrecision] + x), $MachinePrecision] - N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\cos y + x\right) - \sin y \cdot z
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (sin y) z)) (t_1 (- x t_0)))
(if (<= z -2.5e+109)
t_1
(if (<= z -8.5e+40)
(- 1.0 t_0)
(if (or (<= z -1800000.0) (not (<= z 8.8e+104))) t_1 (+ (cos y) x))))))
double code(double x, double y, double z) {
double t_0 = sin(y) * z;
double t_1 = x - t_0;
double tmp;
if (z <= -2.5e+109) {
tmp = t_1;
} else if (z <= -8.5e+40) {
tmp = 1.0 - t_0;
} else if ((z <= -1800000.0) || !(z <= 8.8e+104)) {
tmp = t_1;
} else {
tmp = cos(y) + 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sin(y) * z
t_1 = x - t_0
if (z <= (-2.5d+109)) then
tmp = t_1
else if (z <= (-8.5d+40)) then
tmp = 1.0d0 - t_0
else if ((z <= (-1800000.0d0)) .or. (.not. (z <= 8.8d+104))) then
tmp = t_1
else
tmp = cos(y) + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.sin(y) * z;
double t_1 = x - t_0;
double tmp;
if (z <= -2.5e+109) {
tmp = t_1;
} else if (z <= -8.5e+40) {
tmp = 1.0 - t_0;
} else if ((z <= -1800000.0) || !(z <= 8.8e+104)) {
tmp = t_1;
} else {
tmp = Math.cos(y) + x;
}
return tmp;
}
def code(x, y, z): t_0 = math.sin(y) * z t_1 = x - t_0 tmp = 0 if z <= -2.5e+109: tmp = t_1 elif z <= -8.5e+40: tmp = 1.0 - t_0 elif (z <= -1800000.0) or not (z <= 8.8e+104): tmp = t_1 else: tmp = math.cos(y) + x return tmp
function code(x, y, z) t_0 = Float64(sin(y) * z) t_1 = Float64(x - t_0) tmp = 0.0 if (z <= -2.5e+109) tmp = t_1; elseif (z <= -8.5e+40) tmp = Float64(1.0 - t_0); elseif ((z <= -1800000.0) || !(z <= 8.8e+104)) tmp = t_1; else tmp = Float64(cos(y) + x); end return tmp end
function tmp_2 = code(x, y, z) t_0 = sin(y) * z; t_1 = x - t_0; tmp = 0.0; if (z <= -2.5e+109) tmp = t_1; elseif (z <= -8.5e+40) tmp = 1.0 - t_0; elseif ((z <= -1800000.0) || ~((z <= 8.8e+104))) tmp = t_1; else tmp = cos(y) + x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$1 = N[(x - t$95$0), $MachinePrecision]}, If[LessEqual[z, -2.5e+109], t$95$1, If[LessEqual[z, -8.5e+40], N[(1.0 - t$95$0), $MachinePrecision], If[Or[LessEqual[z, -1800000.0], N[Not[LessEqual[z, 8.8e+104]], $MachinePrecision]], t$95$1, N[(N[Cos[y], $MachinePrecision] + x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin y \cdot z\\
t_1 := x - t\_0\\
\mathbf{if}\;z \leq -2.5 \cdot 10^{+109}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -8.5 \cdot 10^{+40}:\\
\;\;\;\;1 - t\_0\\
\mathbf{elif}\;z \leq -1800000 \lor \neg \left(z \leq 8.8 \cdot 10^{+104}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\cos y + x\\
\end{array}
\end{array}
if z < -2.5000000000000001e109 or -8.49999999999999996e40 < z < -1.8e6 or 8.80000000000000002e104 < z Initial program 99.8%
Taylor expanded in z around -inf 99.8%
mul-1-neg99.8%
distribute-rgt-neg-in99.8%
distribute-lft-out--99.8%
mul-1-neg99.8%
remove-double-neg99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 90.5%
Taylor expanded in z around 0 90.6%
neg-mul-190.6%
distribute-lft-neg-in90.6%
*-commutative90.6%
Simplified90.6%
if -2.5000000000000001e109 < z < -8.49999999999999996e40Initial program 99.9%
Taylor expanded in z around -inf 99.8%
mul-1-neg99.8%
distribute-rgt-neg-in99.8%
distribute-lft-out--99.8%
mul-1-neg99.8%
remove-double-neg99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in y around 0 99.8%
Taylor expanded in x around 0 94.1%
sub-neg94.1%
distribute-lft-in94.1%
rgt-mult-inverse94.2%
Simplified94.2%
if -1.8e6 < z < 8.80000000000000002e104Initial program 100.0%
Taylor expanded in z around 0 97.4%
+-commutative97.4%
Simplified97.4%
Final simplification94.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (sin y) (- z))))
(if (<= z -9.2e+201)
t_0
(if (<= z -6e+68)
(+ x (- 1.0 (* y z)))
(if (<= z 3e+105) (+ (cos y) x) t_0)))))
double code(double x, double y, double z) {
double t_0 = sin(y) * -z;
double tmp;
if (z <= -9.2e+201) {
tmp = t_0;
} else if (z <= -6e+68) {
tmp = x + (1.0 - (y * z));
} else if (z <= 3e+105) {
tmp = cos(y) + x;
} 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 = sin(y) * -z
if (z <= (-9.2d+201)) then
tmp = t_0
else if (z <= (-6d+68)) then
tmp = x + (1.0d0 - (y * z))
else if (z <= 3d+105) then
tmp = cos(y) + x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.sin(y) * -z;
double tmp;
if (z <= -9.2e+201) {
tmp = t_0;
} else if (z <= -6e+68) {
tmp = x + (1.0 - (y * z));
} else if (z <= 3e+105) {
tmp = Math.cos(y) + x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = math.sin(y) * -z tmp = 0 if z <= -9.2e+201: tmp = t_0 elif z <= -6e+68: tmp = x + (1.0 - (y * z)) elif z <= 3e+105: tmp = math.cos(y) + x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(sin(y) * Float64(-z)) tmp = 0.0 if (z <= -9.2e+201) tmp = t_0; elseif (z <= -6e+68) tmp = Float64(x + Float64(1.0 - Float64(y * z))); elseif (z <= 3e+105) tmp = Float64(cos(y) + x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = sin(y) * -z; tmp = 0.0; if (z <= -9.2e+201) tmp = t_0; elseif (z <= -6e+68) tmp = x + (1.0 - (y * z)); elseif (z <= 3e+105) tmp = cos(y) + x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Sin[y], $MachinePrecision] * (-z)), $MachinePrecision]}, If[LessEqual[z, -9.2e+201], t$95$0, If[LessEqual[z, -6e+68], N[(x + N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3e+105], N[(N[Cos[y], $MachinePrecision] + x), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin y \cdot \left(-z\right)\\
\mathbf{if}\;z \leq -9.2 \cdot 10^{+201}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -6 \cdot 10^{+68}:\\
\;\;\;\;x + \left(1 - y \cdot z\right)\\
\mathbf{elif}\;z \leq 3 \cdot 10^{+105}:\\
\;\;\;\;\cos y + x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -9.2000000000000004e201 or 3.0000000000000001e105 < z Initial program 99.8%
Taylor expanded in z around inf 75.4%
associate-*r*75.4%
neg-mul-175.4%
*-commutative75.4%
Simplified75.4%
if -9.2000000000000004e201 < z < -6.0000000000000004e68Initial program 100.0%
Taylor expanded in y around 0 67.0%
associate-+r+67.0%
+-commutative67.0%
associate-+l+67.0%
mul-1-neg67.0%
unsub-neg67.0%
Simplified67.0%
if -6.0000000000000004e68 < z < 3.0000000000000001e105Initial program 99.9%
Taylor expanded in z around 0 94.0%
+-commutative94.0%
Simplified94.0%
Final simplification86.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -1350000.0) (not (<= z 6600000000000.0))) (* z (- (/ (+ x 1.0) z) (sin y))) (+ (cos y) x)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1350000.0) || !(z <= 6600000000000.0)) {
tmp = z * (((x + 1.0) / z) - sin(y));
} else {
tmp = cos(y) + 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 ((z <= (-1350000.0d0)) .or. (.not. (z <= 6600000000000.0d0))) then
tmp = z * (((x + 1.0d0) / z) - sin(y))
else
tmp = cos(y) + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1350000.0) || !(z <= 6600000000000.0)) {
tmp = z * (((x + 1.0) / z) - Math.sin(y));
} else {
tmp = Math.cos(y) + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1350000.0) or not (z <= 6600000000000.0): tmp = z * (((x + 1.0) / z) - math.sin(y)) else: tmp = math.cos(y) + x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1350000.0) || !(z <= 6600000000000.0)) tmp = Float64(z * Float64(Float64(Float64(x + 1.0) / z) - sin(y))); else tmp = Float64(cos(y) + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1350000.0) || ~((z <= 6600000000000.0))) tmp = z * (((x + 1.0) / z) - sin(y)); else tmp = cos(y) + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1350000.0], N[Not[LessEqual[z, 6600000000000.0]], $MachinePrecision]], N[(z * N[(N[(N[(x + 1.0), $MachinePrecision] / z), $MachinePrecision] - N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[y], $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1350000 \lor \neg \left(z \leq 6600000000000\right):\\
\;\;\;\;z \cdot \left(\frac{x + 1}{z} - \sin y\right)\\
\mathbf{else}:\\
\;\;\;\;\cos y + x\\
\end{array}
\end{array}
if z < -1.35e6 or 6.6e12 < z Initial program 99.8%
Taylor expanded in z around -inf 99.8%
mul-1-neg99.8%
distribute-rgt-neg-in99.8%
distribute-lft-out--99.8%
mul-1-neg99.8%
remove-double-neg99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in y around 0 99.6%
if -1.35e6 < z < 6.6e12Initial program 100.0%
Taylor expanded in z around 0 99.2%
+-commutative99.2%
Simplified99.2%
Final simplification99.4%
(FPCore (x y z) :precision binary64 (if (or (<= z -450000000000.0) (not (<= z 7e+69))) (- 1.0 (* (sin y) z)) (+ (cos y) x)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -450000000000.0) || !(z <= 7e+69)) {
tmp = 1.0 - (sin(y) * z);
} else {
tmp = cos(y) + 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 ((z <= (-450000000000.0d0)) .or. (.not. (z <= 7d+69))) then
tmp = 1.0d0 - (sin(y) * z)
else
tmp = cos(y) + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -450000000000.0) || !(z <= 7e+69)) {
tmp = 1.0 - (Math.sin(y) * z);
} else {
tmp = Math.cos(y) + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -450000000000.0) or not (z <= 7e+69): tmp = 1.0 - (math.sin(y) * z) else: tmp = math.cos(y) + x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -450000000000.0) || !(z <= 7e+69)) tmp = Float64(1.0 - Float64(sin(y) * z)); else tmp = Float64(cos(y) + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -450000000000.0) || ~((z <= 7e+69))) tmp = 1.0 - (sin(y) * z); else tmp = cos(y) + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -450000000000.0], N[Not[LessEqual[z, 7e+69]], $MachinePrecision]], N[(1.0 - N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(N[Cos[y], $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -450000000000 \lor \neg \left(z \leq 7 \cdot 10^{+69}\right):\\
\;\;\;\;1 - \sin y \cdot z\\
\mathbf{else}:\\
\;\;\;\;\cos y + x\\
\end{array}
\end{array}
if z < -4.5e11 or 6.99999999999999974e69 < z Initial program 99.8%
Taylor expanded in z around -inf 99.8%
mul-1-neg99.8%
distribute-rgt-neg-in99.8%
distribute-lft-out--99.8%
mul-1-neg99.8%
remove-double-neg99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in y around 0 99.5%
Taylor expanded in x around 0 79.1%
sub-neg79.1%
distribute-lft-in79.1%
rgt-mult-inverse79.2%
Simplified79.2%
if -4.5e11 < z < 6.99999999999999974e69Initial program 100.0%
Taylor expanded in z around 0 98.5%
+-commutative98.5%
Simplified98.5%
Final simplification90.1%
(FPCore (x y z) :precision binary64 (if (or (<= y -0.42) (not (<= y 4600000000.0))) (+ (cos y) x) (+ x (- 1.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -0.42) || !(y <= 4600000000.0)) {
tmp = cos(y) + x;
} 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 <= (-0.42d0)) .or. (.not. (y <= 4600000000.0d0))) then
tmp = cos(y) + x
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 <= -0.42) || !(y <= 4600000000.0)) {
tmp = Math.cos(y) + x;
} else {
tmp = x + (1.0 - (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -0.42) or not (y <= 4600000000.0): tmp = math.cos(y) + x else: tmp = x + (1.0 - (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -0.42) || !(y <= 4600000000.0)) tmp = Float64(cos(y) + x); else tmp = Float64(x + Float64(1.0 - Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -0.42) || ~((y <= 4600000000.0))) tmp = cos(y) + x; else tmp = x + (1.0 - (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -0.42], N[Not[LessEqual[y, 4600000000.0]], $MachinePrecision]], N[(N[Cos[y], $MachinePrecision] + x), $MachinePrecision], N[(x + N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.42 \lor \neg \left(y \leq 4600000000\right):\\
\;\;\;\;\cos y + x\\
\mathbf{else}:\\
\;\;\;\;x + \left(1 - y \cdot z\right)\\
\end{array}
\end{array}
if y < -0.419999999999999984 or 4.6e9 < y Initial program 99.8%
Taylor expanded in z around 0 57.2%
+-commutative57.2%
Simplified57.2%
if -0.419999999999999984 < y < 4.6e9Initial program 100.0%
Taylor expanded in y around 0 99.4%
associate-+r+99.4%
+-commutative99.4%
associate-+l+99.4%
mul-1-neg99.4%
unsub-neg99.4%
Simplified99.4%
Final simplification79.9%
(FPCore (x y z) :precision binary64 (if (<= x -1.48e-12) (+ x 1.0) (if (<= x 155.0) (- 1.0 (* y z)) (* x (+ 1.0 (/ 1.0 x))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.48e-12) {
tmp = x + 1.0;
} else if (x <= 155.0) {
tmp = 1.0 - (y * z);
} else {
tmp = x * (1.0 + (1.0 / 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.48d-12)) then
tmp = x + 1.0d0
else if (x <= 155.0d0) then
tmp = 1.0d0 - (y * z)
else
tmp = x * (1.0d0 + (1.0d0 / x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.48e-12) {
tmp = x + 1.0;
} else if (x <= 155.0) {
tmp = 1.0 - (y * z);
} else {
tmp = x * (1.0 + (1.0 / x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.48e-12: tmp = x + 1.0 elif x <= 155.0: tmp = 1.0 - (y * z) else: tmp = x * (1.0 + (1.0 / x)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.48e-12) tmp = Float64(x + 1.0); elseif (x <= 155.0) tmp = Float64(1.0 - Float64(y * z)); else tmp = Float64(x * Float64(1.0 + Float64(1.0 / x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.48e-12) tmp = x + 1.0; elseif (x <= 155.0) tmp = 1.0 - (y * z); else tmp = x * (1.0 + (1.0 / x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.48e-12], N[(x + 1.0), $MachinePrecision], If[LessEqual[x, 155.0], N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.48 \cdot 10^{-12}:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;x \leq 155:\\
\;\;\;\;1 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 + \frac{1}{x}\right)\\
\end{array}
\end{array}
if x < -1.47999999999999995e-12Initial program 100.0%
Taylor expanded in y around 0 75.4%
+-commutative75.4%
Simplified75.4%
if -1.47999999999999995e-12 < x < 155Initial program 99.8%
Taylor expanded in z around -inf 99.7%
mul-1-neg99.7%
distribute-rgt-neg-in99.7%
distribute-lft-out--99.7%
mul-1-neg99.7%
remove-double-neg99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in y around 0 83.7%
Taylor expanded in y around 0 59.7%
+-commutative59.7%
mul-1-neg59.7%
unsub-neg59.7%
+-commutative59.7%
Simplified59.7%
Taylor expanded in x around 0 59.7%
sub-neg59.7%
distribute-rgt-in59.7%
lft-mult-inverse59.8%
distribute-lft-neg-out59.8%
distribute-rgt-neg-in59.8%
Simplified59.8%
if 155 < x Initial program 100.0%
Taylor expanded in z around 0 100.0%
associate-+r+100.0%
associate-*r*100.0%
neg-mul-1100.0%
*-commutative100.0%
+-commutative100.0%
fma-define100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 99.9%
associate-+r+99.9%
+-commutative99.9%
mul-1-neg99.9%
unsub-neg99.9%
*-commutative99.9%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around 0 79.7%
Final simplification69.1%
(FPCore (x y z) :precision binary64 (if (<= y -3.8e+33) (* x (+ 1.0 (/ 1.0 x))) (if (<= y 5.6e+147) (+ x (- 1.0 (* y z))) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -3.8e+33) {
tmp = x * (1.0 + (1.0 / x));
} else if (y <= 5.6e+147) {
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 <= (-3.8d+33)) then
tmp = x * (1.0d0 + (1.0d0 / x))
else if (y <= 5.6d+147) 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 <= -3.8e+33) {
tmp = x * (1.0 + (1.0 / x));
} else if (y <= 5.6e+147) {
tmp = x + (1.0 - (y * z));
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -3.8e+33: tmp = x * (1.0 + (1.0 / x)) elif y <= 5.6e+147: tmp = x + (1.0 - (y * z)) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -3.8e+33) tmp = Float64(x * Float64(1.0 + Float64(1.0 / x))); elseif (y <= 5.6e+147) tmp = Float64(x + Float64(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 <= -3.8e+33) tmp = x * (1.0 + (1.0 / x)); elseif (y <= 5.6e+147) tmp = x + (1.0 - (y * z)); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -3.8e+33], N[(x * N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.6e+147], N[(x + N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.8 \cdot 10^{+33}:\\
\;\;\;\;x \cdot \left(1 + \frac{1}{x}\right)\\
\mathbf{elif}\;y \leq 5.6 \cdot 10^{+147}:\\
\;\;\;\;x + \left(1 - y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if y < -3.80000000000000002e33Initial program 99.8%
Taylor expanded in z around 0 99.8%
associate-+r+99.8%
associate-*r*99.8%
neg-mul-199.8%
*-commutative99.8%
+-commutative99.8%
fma-define99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in x around inf 82.4%
associate-+r+82.4%
+-commutative82.4%
mul-1-neg82.4%
unsub-neg82.4%
*-commutative82.4%
associate-/l*82.3%
Simplified82.3%
Taylor expanded in y around 0 33.4%
if -3.80000000000000002e33 < y < 5.6000000000000002e147Initial program 100.0%
Taylor expanded in y around 0 87.8%
associate-+r+87.8%
+-commutative87.8%
associate-+l+87.8%
mul-1-neg87.8%
unsub-neg87.8%
Simplified87.8%
if 5.6000000000000002e147 < y Initial program 99.8%
Taylor expanded in y around 0 45.2%
+-commutative45.2%
Simplified45.2%
Final simplification71.9%
(FPCore (x y z) :precision binary64 (if (or (<= x -6e-13) (not (<= x 6.9))) (+ x 1.0) (- 1.0 (* y z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -6e-13) || !(x <= 6.9)) {
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 <= (-6d-13)) .or. (.not. (x <= 6.9d0))) 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 <= -6e-13) || !(x <= 6.9)) {
tmp = x + 1.0;
} else {
tmp = 1.0 - (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -6e-13) or not (x <= 6.9): tmp = x + 1.0 else: tmp = 1.0 - (y * z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -6e-13) || !(x <= 6.9)) 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 <= -6e-13) || ~((x <= 6.9))) tmp = x + 1.0; else tmp = 1.0 - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -6e-13], N[Not[LessEqual[x, 6.9]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6 \cdot 10^{-13} \lor \neg \left(x \leq 6.9\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 - y \cdot z\\
\end{array}
\end{array}
if x < -5.99999999999999968e-13 or 6.9000000000000004 < x Initial program 100.0%
Taylor expanded in y around 0 77.7%
+-commutative77.7%
Simplified77.7%
if -5.99999999999999968e-13 < x < 6.9000000000000004Initial program 99.8%
Taylor expanded in z around -inf 99.7%
mul-1-neg99.7%
distribute-rgt-neg-in99.7%
distribute-lft-out--99.7%
mul-1-neg99.7%
remove-double-neg99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in y around 0 83.7%
Taylor expanded in y around 0 59.7%
+-commutative59.7%
mul-1-neg59.7%
unsub-neg59.7%
+-commutative59.7%
Simplified59.7%
Taylor expanded in x around 0 59.7%
sub-neg59.7%
distribute-rgt-in59.7%
lft-mult-inverse59.8%
distribute-lft-neg-out59.8%
distribute-rgt-neg-in59.8%
Simplified59.8%
Final simplification69.1%
(FPCore (x y z) :precision binary64 (if (<= z -1.65e+90) (- x (* y z)) (+ x 1.0)))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.65e+90) {
tmp = x - (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 (z <= (-1.65d+90)) then
tmp = x - (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 (z <= -1.65e+90) {
tmp = x - (y * z);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.65e+90: tmp = x - (y * z) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.65e+90) tmp = Float64(x - Float64(y * z)); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.65e+90) tmp = x - (y * z); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.65e+90], N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.65 \cdot 10^{+90}:\\
\;\;\;\;x - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if z < -1.65000000000000004e90Initial program 99.9%
Taylor expanded in z around -inf 99.8%
mul-1-neg99.8%
distribute-rgt-neg-in99.8%
distribute-lft-out--99.8%
mul-1-neg99.8%
remove-double-neg99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 90.0%
Taylor expanded in y around 0 50.9%
mul-1-neg50.9%
unsub-neg50.9%
Simplified50.9%
if -1.65000000000000004e90 < z Initial program 99.9%
Taylor expanded in y around 0 70.2%
+-commutative70.2%
Simplified70.2%
Final simplification66.9%
(FPCore (x y z) :precision binary64 (if (<= z -4e+209) (* z (- y)) (+ x 1.0)))
double code(double x, double y, double z) {
double tmp;
if (z <= -4e+209) {
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 <= (-4d+209)) 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 <= -4e+209) {
tmp = z * -y;
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -4e+209: tmp = z * -y else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (z <= -4e+209) 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 <= -4e+209) tmp = z * -y; else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -4e+209], N[(z * (-y)), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4 \cdot 10^{+209}:\\
\;\;\;\;z \cdot \left(-y\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if z < -4.0000000000000003e209Initial program 99.8%
Taylor expanded in z around -inf 99.6%
mul-1-neg99.6%
distribute-rgt-neg-in99.6%
distribute-lft-out--99.6%
mul-1-neg99.6%
remove-double-neg99.6%
+-commutative99.6%
Simplified99.6%
Taylor expanded in y around 0 99.6%
Taylor expanded in y around 0 55.0%
+-commutative55.0%
mul-1-neg55.0%
unsub-neg55.0%
+-commutative55.0%
Simplified55.0%
Taylor expanded in z around inf 42.6%
mul-1-neg42.6%
distribute-lft-neg-out42.6%
*-commutative42.6%
Simplified42.6%
if -4.0000000000000003e209 < z Initial program 99.9%
Taylor expanded in y around 0 67.3%
+-commutative67.3%
Simplified67.3%
Final simplification65.5%
(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 63.3%
+-commutative63.3%
Simplified63.3%
Final simplification63.3%
(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 x around inf 41.4%
Final simplification41.4%
herbie shell --seed 2024095
(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))))