
(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 (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%
(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 (if (or (<= z -3.8e+69) (not (<= z 5.5e+54))) (* z (* x (- (+ (/ 1.0 z) (/ (/ 1.0 z) x)) (/ (sin y) x)))) (+ (cos y) x)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -3.8e+69) || !(z <= 5.5e+54)) {
tmp = z * (x * (((1.0 / z) + ((1.0 / z) / x)) - (sin(y) / x)));
} 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 <= (-3.8d+69)) .or. (.not. (z <= 5.5d+54))) then
tmp = z * (x * (((1.0d0 / z) + ((1.0d0 / z) / x)) - (sin(y) / x)))
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 <= -3.8e+69) || !(z <= 5.5e+54)) {
tmp = z * (x * (((1.0 / z) + ((1.0 / z) / x)) - (Math.sin(y) / x)));
} else {
tmp = Math.cos(y) + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -3.8e+69) or not (z <= 5.5e+54): tmp = z * (x * (((1.0 / z) + ((1.0 / z) / x)) - (math.sin(y) / x))) else: tmp = math.cos(y) + x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -3.8e+69) || !(z <= 5.5e+54)) tmp = Float64(z * Float64(x * Float64(Float64(Float64(1.0 / z) + Float64(Float64(1.0 / z) / x)) - Float64(sin(y) / x)))); else tmp = Float64(cos(y) + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -3.8e+69) || ~((z <= 5.5e+54))) tmp = z * (x * (((1.0 / z) + ((1.0 / z) / x)) - (sin(y) / x))); else tmp = cos(y) + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -3.8e+69], N[Not[LessEqual[z, 5.5e+54]], $MachinePrecision]], N[(z * N[(x * N[(N[(N[(1.0 / z), $MachinePrecision] + N[(N[(1.0 / z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] - N[(N[Sin[y], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[y], $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{+69} \lor \neg \left(z \leq 5.5 \cdot 10^{+54}\right):\\
\;\;\;\;z \cdot \left(x \cdot \left(\left(\frac{1}{z} + \frac{\frac{1}{z}}{x}\right) - \frac{\sin y}{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\cos y + x\\
\end{array}
\end{array}
if z < -3.80000000000000028e69 or 5.50000000000000026e54 < z Initial program 99.7%
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 x around inf 99.4%
Taylor expanded in y around 0 99.4%
associate-/l/99.5%
Simplified99.5%
if -3.80000000000000028e69 < z < 5.50000000000000026e54Initial program 100.0%
Taylor expanded in z around 0 99.7%
+-commutative99.7%
Simplified99.7%
Final simplification99.6%
(FPCore (x y z) :precision binary64 (if (or (<= z -3.7e+71) (not (<= z 8.5e+54))) (* z (- (/ x z) (sin y))) (+ (cos y) x)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -3.7e+71) || !(z <= 8.5e+54)) {
tmp = z * ((x / 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 <= (-3.7d+71)) .or. (.not. (z <= 8.5d+54))) then
tmp = z * ((x / 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 <= -3.7e+71) || !(z <= 8.5e+54)) {
tmp = z * ((x / z) - Math.sin(y));
} else {
tmp = Math.cos(y) + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -3.7e+71) or not (z <= 8.5e+54): tmp = z * ((x / z) - math.sin(y)) else: tmp = math.cos(y) + x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -3.7e+71) || !(z <= 8.5e+54)) tmp = Float64(z * Float64(Float64(x / 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 <= -3.7e+71) || ~((z <= 8.5e+54))) tmp = z * ((x / z) - sin(y)); else tmp = cos(y) + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -3.7e+71], N[Not[LessEqual[z, 8.5e+54]], $MachinePrecision]], N[(z * N[(N[(x / 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 -3.7 \cdot 10^{+71} \lor \neg \left(z \leq 8.5 \cdot 10^{+54}\right):\\
\;\;\;\;z \cdot \left(\frac{x}{z} - \sin y\right)\\
\mathbf{else}:\\
\;\;\;\;\cos y + x\\
\end{array}
\end{array}
if z < -3.7e71 or 8.4999999999999995e54 < z Initial program 99.7%
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 x around inf 89.5%
if -3.7e71 < z < 8.4999999999999995e54Initial program 100.0%
Taylor expanded in z around 0 99.7%
+-commutative99.7%
Simplified99.7%
Final simplification94.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -2.1e+98) (not (<= z 3.8e+148))) (* (sin y) (- z)) (+ (cos y) x)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.1e+98) || !(z <= 3.8e+148)) {
tmp = 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 <= (-2.1d+98)) .or. (.not. (z <= 3.8d+148))) then
tmp = 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 <= -2.1e+98) || !(z <= 3.8e+148)) {
tmp = Math.sin(y) * -z;
} else {
tmp = Math.cos(y) + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.1e+98) or not (z <= 3.8e+148): tmp = math.sin(y) * -z else: tmp = math.cos(y) + x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2.1e+98) || !(z <= 3.8e+148)) tmp = Float64(sin(y) * Float64(-z)); else tmp = Float64(cos(y) + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -2.1e+98) || ~((z <= 3.8e+148))) tmp = sin(y) * -z; else tmp = cos(y) + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.1e+98], N[Not[LessEqual[z, 3.8e+148]], $MachinePrecision]], N[(N[Sin[y], $MachinePrecision] * (-z)), $MachinePrecision], N[(N[Cos[y], $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.1 \cdot 10^{+98} \lor \neg \left(z \leq 3.8 \cdot 10^{+148}\right):\\
\;\;\;\;\sin y \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;\cos y + x\\
\end{array}
\end{array}
if z < -2.10000000000000004e98 or 3.7999999999999998e148 < z Initial program 99.7%
Taylor expanded in z around inf 72.0%
associate-*r*72.0%
neg-mul-172.0%
*-commutative72.0%
Simplified72.0%
if -2.10000000000000004e98 < z < 3.7999999999999998e148Initial program 99.9%
Taylor expanded in z around 0 92.2%
+-commutative92.2%
Simplified92.2%
Final simplification85.3%
(FPCore (x y z)
:precision binary64
(if (<= z -8.5e+102)
(+ x (- 1.0 (* y z)))
(if (<= z 3.7e+174)
(+ (cos y) x)
(+ 1.0 (+ x (* y (- (* y (* y (* z 0.16666666666666666))) z)))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -8.5e+102) {
tmp = x + (1.0 - (y * z));
} else if (z <= 3.7e+174) {
tmp = cos(y) + x;
} else {
tmp = 1.0 + (x + (y * ((y * (y * (z * 0.16666666666666666))) - 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 <= (-8.5d+102)) then
tmp = x + (1.0d0 - (y * z))
else if (z <= 3.7d+174) then
tmp = cos(y) + x
else
tmp = 1.0d0 + (x + (y * ((y * (y * (z * 0.16666666666666666d0))) - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -8.5e+102) {
tmp = x + (1.0 - (y * z));
} else if (z <= 3.7e+174) {
tmp = Math.cos(y) + x;
} else {
tmp = 1.0 + (x + (y * ((y * (y * (z * 0.16666666666666666))) - z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -8.5e+102: tmp = x + (1.0 - (y * z)) elif z <= 3.7e+174: tmp = math.cos(y) + x else: tmp = 1.0 + (x + (y * ((y * (y * (z * 0.16666666666666666))) - z))) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -8.5e+102) tmp = Float64(x + Float64(1.0 - Float64(y * z))); elseif (z <= 3.7e+174) tmp = Float64(cos(y) + x); else tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * Float64(y * Float64(z * 0.16666666666666666))) - z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -8.5e+102) tmp = x + (1.0 - (y * z)); elseif (z <= 3.7e+174) tmp = cos(y) + x; else tmp = 1.0 + (x + (y * ((y * (y * (z * 0.16666666666666666))) - z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -8.5e+102], N[(x + N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.7e+174], N[(N[Cos[y], $MachinePrecision] + x), $MachinePrecision], N[(1.0 + N[(x + N[(y * N[(N[(y * N[(y * N[(z * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.5 \cdot 10^{+102}:\\
\;\;\;\;x + \left(1 - y \cdot z\right)\\
\mathbf{elif}\;z \leq 3.7 \cdot 10^{+174}:\\
\;\;\;\;\cos y + x\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot \left(y \cdot \left(z \cdot 0.16666666666666666\right)\right) - z\right)\right)\\
\end{array}
\end{array}
if z < -8.4999999999999996e102Initial program 99.7%
Taylor expanded in y around 0 54.6%
associate-+r+54.6%
+-commutative54.6%
associate-+l+54.6%
mul-1-neg54.6%
unsub-neg54.6%
Simplified54.6%
if -8.4999999999999996e102 < z < 3.7000000000000002e174Initial program 99.9%
Taylor expanded in z around 0 88.8%
+-commutative88.8%
Simplified88.8%
if 3.7000000000000002e174 < z Initial program 99.7%
Taylor expanded in y around 0 59.2%
Taylor expanded in y around inf 59.2%
*-commutative59.2%
associate-*r*59.2%
Simplified59.2%
(FPCore (x y z) :precision binary64 (if (or (<= y -7200.0) (not (<= y 19000000000000.0))) (+ x 1.0) (+ 1.0 (+ x (* y (- (* y (* y (* z 0.16666666666666666))) z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -7200.0) || !(y <= 19000000000000.0)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x + (y * ((y * (y * (z * 0.16666666666666666))) - 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 <= (-7200.0d0)) .or. (.not. (y <= 19000000000000.0d0))) then
tmp = x + 1.0d0
else
tmp = 1.0d0 + (x + (y * ((y * (y * (z * 0.16666666666666666d0))) - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -7200.0) || !(y <= 19000000000000.0)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x + (y * ((y * (y * (z * 0.16666666666666666))) - z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -7200.0) or not (y <= 19000000000000.0): tmp = x + 1.0 else: tmp = 1.0 + (x + (y * ((y * (y * (z * 0.16666666666666666))) - z))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -7200.0) || !(y <= 19000000000000.0)) tmp = Float64(x + 1.0); else tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * Float64(y * Float64(z * 0.16666666666666666))) - z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -7200.0) || ~((y <= 19000000000000.0))) tmp = x + 1.0; else tmp = 1.0 + (x + (y * ((y * (y * (z * 0.16666666666666666))) - z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -7200.0], N[Not[LessEqual[y, 19000000000000.0]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(1.0 + N[(x + N[(y * N[(N[(y * N[(y * N[(z * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7200 \lor \neg \left(y \leq 19000000000000\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot \left(y \cdot \left(z \cdot 0.16666666666666666\right)\right) - z\right)\right)\\
\end{array}
\end{array}
if y < -7200 or 1.9e13 < y Initial program 99.8%
Taylor expanded in y around 0 45.3%
+-commutative45.3%
Simplified45.3%
if -7200 < y < 1.9e13Initial program 100.0%
Taylor expanded in y around 0 96.4%
Taylor expanded in y around inf 96.7%
*-commutative96.7%
associate-*r*96.7%
Simplified96.7%
Final simplification72.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -3.2e+22) (not (<= y 550000000000.0))) (+ x 1.0) (+ x (- 1.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3.2e+22) || !(y <= 550000000000.0)) {
tmp = x + 1.0;
} 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 <= (-3.2d+22)) .or. (.not. (y <= 550000000000.0d0))) then
tmp = x + 1.0d0
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 <= -3.2e+22) || !(y <= 550000000000.0)) {
tmp = x + 1.0;
} else {
tmp = x + (1.0 - (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -3.2e+22) or not (y <= 550000000000.0): tmp = x + 1.0 else: tmp = x + (1.0 - (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -3.2e+22) || !(y <= 550000000000.0)) tmp = Float64(x + 1.0); 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 <= -3.2e+22) || ~((y <= 550000000000.0))) tmp = x + 1.0; else tmp = x + (1.0 - (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -3.2e+22], N[Not[LessEqual[y, 550000000000.0]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(x + N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.2 \cdot 10^{+22} \lor \neg \left(y \leq 550000000000\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;x + \left(1 - y \cdot z\right)\\
\end{array}
\end{array}
if y < -3.2e22 or 5.5e11 < y Initial program 99.7%
Taylor expanded in y around 0 43.6%
+-commutative43.6%
Simplified43.6%
if -3.2e22 < y < 5.5e11Initial program 100.0%
Taylor expanded in y around 0 97.5%
associate-+r+97.5%
+-commutative97.5%
associate-+l+97.5%
mul-1-neg97.5%
unsub-neg97.5%
Simplified97.5%
Final simplification72.0%
(FPCore (x y z) :precision binary64 (if (or (<= x -2.3e-8) (not (<= x 9e-6))) (+ x 1.0) (- 1.0 (* y z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -2.3e-8) || !(x <= 9e-6)) {
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 <= (-2.3d-8)) .or. (.not. (x <= 9d-6))) 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 <= -2.3e-8) || !(x <= 9e-6)) {
tmp = x + 1.0;
} else {
tmp = 1.0 - (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -2.3e-8) or not (x <= 9e-6): tmp = x + 1.0 else: tmp = 1.0 - (y * z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -2.3e-8) || !(x <= 9e-6)) 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 <= -2.3e-8) || ~((x <= 9e-6))) tmp = x + 1.0; else tmp = 1.0 - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -2.3e-8], N[Not[LessEqual[x, 9e-6]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.3 \cdot 10^{-8} \lor \neg \left(x \leq 9 \cdot 10^{-6}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 - y \cdot z\\
\end{array}
\end{array}
if x < -2.3000000000000001e-8 or 9.00000000000000023e-6 < x Initial program 99.9%
Taylor expanded in y around 0 83.4%
+-commutative83.4%
Simplified83.4%
if -2.3000000000000001e-8 < x < 9.00000000000000023e-6Initial program 99.8%
Taylor expanded in x around inf 77.8%
associate--l+77.8%
div-sub77.8%
Simplified77.8%
Taylor expanded in y around 0 49.0%
Taylor expanded in x around 0 55.2%
*-commutative55.2%
associate-*r*55.2%
mul-1-neg55.2%
Simplified55.2%
Final simplification69.6%
(FPCore (x y z) :precision binary64 (if (<= z -9.2e+207) (* z (- y)) (+ x 1.0)))
double code(double x, double y, double z) {
double tmp;
if (z <= -9.2e+207) {
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 <= (-9.2d+207)) 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 <= -9.2e+207) {
tmp = z * -y;
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -9.2e+207: tmp = z * -y else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (z <= -9.2e+207) 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 <= -9.2e+207) tmp = z * -y; else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -9.2e+207], N[(z * (-y)), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.2 \cdot 10^{+207}:\\
\;\;\;\;z \cdot \left(-y\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if z < -9.19999999999999979e207Initial program 99.8%
Taylor expanded in x around inf 71.8%
associate--l+71.8%
div-sub71.8%
Simplified71.8%
Taylor expanded in y around 0 44.9%
Taylor expanded in y around inf 42.0%
*-commutative42.0%
associate-*r*42.0%
mul-1-neg42.0%
Simplified42.0%
if -9.19999999999999979e207 < z Initial program 99.9%
Taylor expanded in y around 0 67.8%
+-commutative67.8%
Simplified67.8%
Final simplification64.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 62.5%
+-commutative62.5%
Simplified62.5%
(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 42.4%
herbie shell --seed 2024087
(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))))