
(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(x + Float64(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[(x + N[(N[Cos[y], $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\cos y - z \cdot \sin y\right)
\end{array}
Initial program 99.9%
associate--l+99.9%
Simplified99.9%
(FPCore (x y z)
:precision binary64
(if (<= x -1.0)
(* x (- 1.0 (/ 1.0 (/ (/ x z) (sin y)))))
(if (<= x 0.0065)
(- (cos y) (* z (sin y)))
(* x (- 1.0 (* z (/ (sin y) x)))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.0) {
tmp = x * (1.0 - (1.0 / ((x / z) / sin(y))));
} else if (x <= 0.0065) {
tmp = cos(y) - (z * sin(y));
} else {
tmp = x * (1.0 - (z * (sin(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 (x <= (-1.0d0)) then
tmp = x * (1.0d0 - (1.0d0 / ((x / z) / sin(y))))
else if (x <= 0.0065d0) then
tmp = cos(y) - (z * sin(y))
else
tmp = x * (1.0d0 - (z * (sin(y) / x)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.0) {
tmp = x * (1.0 - (1.0 / ((x / z) / Math.sin(y))));
} else if (x <= 0.0065) {
tmp = Math.cos(y) - (z * Math.sin(y));
} else {
tmp = x * (1.0 - (z * (Math.sin(y) / x)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.0: tmp = x * (1.0 - (1.0 / ((x / z) / math.sin(y)))) elif x <= 0.0065: tmp = math.cos(y) - (z * math.sin(y)) else: tmp = x * (1.0 - (z * (math.sin(y) / x))) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.0) tmp = Float64(x * Float64(1.0 - Float64(1.0 / Float64(Float64(x / z) / sin(y))))); elseif (x <= 0.0065) tmp = Float64(cos(y) - Float64(z * sin(y))); else tmp = Float64(x * Float64(1.0 - Float64(z * Float64(sin(y) / x)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.0) tmp = x * (1.0 - (1.0 / ((x / z) / sin(y)))); elseif (x <= 0.0065) tmp = cos(y) - (z * sin(y)); else tmp = x * (1.0 - (z * (sin(y) / x))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.0], N[(x * N[(1.0 - N[(1.0 / N[(N[(x / z), $MachinePrecision] / N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.0065], N[(N[Cos[y], $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(z * N[(N[Sin[y], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;x \cdot \left(1 - \frac{1}{\frac{\frac{x}{z}}{\sin y}}\right)\\
\mathbf{elif}\;x \leq 0.0065:\\
\;\;\;\;\cos y - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - z \cdot \frac{\sin y}{x}\right)\\
\end{array}
\end{array}
if x < -1Initial program 99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in x around inf 99.8%
associate--l+99.8%
div-sub99.8%
Simplified99.8%
clear-num99.8%
inv-pow99.8%
Applied egg-rr99.8%
unpow-199.8%
Simplified99.8%
Taylor expanded in z around inf 99.1%
mul-1-neg99.1%
associate-/r*99.2%
distribute-neg-frac299.2%
Simplified99.2%
if -1 < x < 0.0064999999999999997Initial program 99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in x around 0 99.9%
if 0.0064999999999999997 < x Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in x around inf 99.9%
associate--l+99.9%
div-sub99.9%
Simplified99.9%
Taylor expanded in z around inf 99.3%
mul-1-neg99.3%
associate-*r/99.3%
*-commutative99.3%
distribute-rgt-neg-in99.3%
Simplified99.3%
Final simplification99.5%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.7e+77) (not (<= z 2.3e+66))) (* x (- 1.0 (* z (/ (sin y) x)))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.7e+77) || !(z <= 2.3e+66)) {
tmp = x * (1.0 - (z * (sin(y) / x)));
} else {
tmp = x + 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 ((z <= (-1.7d+77)) .or. (.not. (z <= 2.3d+66))) then
tmp = x * (1.0d0 - (z * (sin(y) / x)))
else
tmp = x + cos(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.7e+77) || !(z <= 2.3e+66)) {
tmp = x * (1.0 - (z * (Math.sin(y) / x)));
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.7e+77) or not (z <= 2.3e+66): tmp = x * (1.0 - (z * (math.sin(y) / x))) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.7e+77) || !(z <= 2.3e+66)) tmp = Float64(x * Float64(1.0 - Float64(z * Float64(sin(y) / x)))); else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.7e+77) || ~((z <= 2.3e+66))) tmp = x * (1.0 - (z * (sin(y) / x))); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.7e+77], N[Not[LessEqual[z, 2.3e+66]], $MachinePrecision]], N[(x * N[(1.0 - N[(z * N[(N[Sin[y], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.7 \cdot 10^{+77} \lor \neg \left(z \leq 2.3 \cdot 10^{+66}\right):\\
\;\;\;\;x \cdot \left(1 - z \cdot \frac{\sin y}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -1.69999999999999998e77 or 2.3e66 < z Initial program 99.8%
associate--l+99.8%
Simplified99.8%
Taylor expanded in x around inf 81.6%
associate--l+81.6%
div-sub81.6%
Simplified81.6%
Taylor expanded in z around inf 71.5%
mul-1-neg71.5%
associate-*r/71.4%
*-commutative71.4%
distribute-rgt-neg-in71.4%
Simplified71.4%
if -1.69999999999999998e77 < z < 2.3e66Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in z around 0 96.6%
+-commutative96.6%
Simplified96.6%
Final simplification85.8%
(FPCore (x y z) :precision binary64 (if (or (<= z -2e+115) (not (<= z 1.6e+80))) (* z (- (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2e+115) || !(z <= 1.6e+80)) {
tmp = z * -sin(y);
} else {
tmp = x + 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 ((z <= (-2d+115)) .or. (.not. (z <= 1.6d+80))) then
tmp = z * -sin(y)
else
tmp = x + cos(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -2e+115) || !(z <= 1.6e+80)) {
tmp = z * -Math.sin(y);
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2e+115) or not (z <= 1.6e+80): tmp = z * -math.sin(y) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2e+115) || !(z <= 1.6e+80)) tmp = Float64(z * Float64(-sin(y))); else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -2e+115) || ~((z <= 1.6e+80))) tmp = z * -sin(y); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2e+115], N[Not[LessEqual[z, 1.6e+80]], $MachinePrecision]], N[(z * (-N[Sin[y], $MachinePrecision])), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2 \cdot 10^{+115} \lor \neg \left(z \leq 1.6 \cdot 10^{+80}\right):\\
\;\;\;\;z \cdot \left(-\sin y\right)\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -2e115 or 1.59999999999999995e80 < z Initial program 99.8%
associate--l+99.8%
Simplified99.8%
Taylor expanded in z around inf 66.5%
associate-*r*66.5%
neg-mul-166.5%
*-commutative66.5%
Simplified66.5%
if -2e115 < z < 1.59999999999999995e80Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in z around 0 93.8%
+-commutative93.8%
Simplified93.8%
Final simplification83.4%
(FPCore (x y z) :precision binary64 (if (or (<= y -0.00053) (not (<= y 2.1e-17))) (+ x (cos y)) (+ x (- 1.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -0.00053) || !(y <= 2.1e-17)) {
tmp = x + cos(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 <= (-0.00053d0)) .or. (.not. (y <= 2.1d-17))) then
tmp = x + cos(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 <= -0.00053) || !(y <= 2.1e-17)) {
tmp = x + Math.cos(y);
} else {
tmp = x + (1.0 - (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -0.00053) or not (y <= 2.1e-17): tmp = x + math.cos(y) else: tmp = x + (1.0 - (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -0.00053) || !(y <= 2.1e-17)) tmp = Float64(x + cos(y)); 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.00053) || ~((y <= 2.1e-17))) tmp = x + cos(y); else tmp = x + (1.0 - (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -0.00053], N[Not[LessEqual[y, 2.1e-17]], $MachinePrecision]], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(x + N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.00053 \lor \neg \left(y \leq 2.1 \cdot 10^{-17}\right):\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;x + \left(1 - y \cdot z\right)\\
\end{array}
\end{array}
if y < -5.29999999999999981e-4 or 2.09999999999999992e-17 < y Initial program 99.8%
associate--l+99.8%
Simplified99.8%
Taylor expanded in z around 0 62.1%
+-commutative62.1%
Simplified62.1%
if -5.29999999999999981e-4 < y < 2.09999999999999992e-17Initial program 100.0%
associate--l+100.0%
Simplified100.0%
expm1-log1p-u100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 100.0%
associate-+r+100.0%
+-commutative100.0%
associate-+l+100.0%
mul-1-neg100.0%
unsub-neg100.0%
Simplified100.0%
Final simplification80.4%
(FPCore (x y z)
:precision binary64
(if (<= x -1.0)
x
(if (<= x 4.1e-100)
(cos y)
(if (<= x 2e+115) (+ x (- 1.0 (* y z))) (+ x 1.0)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.0) {
tmp = x;
} else if (x <= 4.1e-100) {
tmp = cos(y);
} else if (x <= 2e+115) {
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 (x <= (-1.0d0)) then
tmp = x
else if (x <= 4.1d-100) then
tmp = cos(y)
else if (x <= 2d+115) 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 (x <= -1.0) {
tmp = x;
} else if (x <= 4.1e-100) {
tmp = Math.cos(y);
} else if (x <= 2e+115) {
tmp = x + (1.0 - (y * z));
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.0: tmp = x elif x <= 4.1e-100: tmp = math.cos(y) elif x <= 2e+115: tmp = x + (1.0 - (y * z)) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.0) tmp = x; elseif (x <= 4.1e-100) tmp = cos(y); elseif (x <= 2e+115) 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 (x <= -1.0) tmp = x; elseif (x <= 4.1e-100) tmp = cos(y); elseif (x <= 2e+115) tmp = x + (1.0 - (y * z)); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.0], x, If[LessEqual[x, 4.1e-100], N[Cos[y], $MachinePrecision], If[LessEqual[x, 2e+115], N[(x + N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 4.1 \cdot 10^{-100}:\\
\;\;\;\;\cos y\\
\mathbf{elif}\;x \leq 2 \cdot 10^{+115}:\\
\;\;\;\;x + \left(1 - y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if x < -1Initial program 99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in x around inf 78.7%
if -1 < x < 4.0999999999999999e-100Initial program 99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in x around 0 99.9%
Taylor expanded in z around 0 64.9%
if 4.0999999999999999e-100 < x < 2e115Initial program 99.9%
associate--l+100.0%
Simplified100.0%
expm1-log1p-u99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 68.9%
associate-+r+68.9%
+-commutative68.9%
associate-+l+68.9%
mul-1-neg68.9%
unsub-neg68.9%
Simplified68.9%
if 2e115 < x Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in y around 0 90.8%
+-commutative90.8%
Simplified90.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -4.6e+149) (not (<= y 8.5e+167))) (+ x 1.0) (+ x (- 1.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -4.6e+149) || !(y <= 8.5e+167)) {
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 <= (-4.6d+149)) .or. (.not. (y <= 8.5d+167))) 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 <= -4.6e+149) || !(y <= 8.5e+167)) {
tmp = x + 1.0;
} else {
tmp = x + (1.0 - (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -4.6e+149) or not (y <= 8.5e+167): tmp = x + 1.0 else: tmp = x + (1.0 - (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -4.6e+149) || !(y <= 8.5e+167)) 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 <= -4.6e+149) || ~((y <= 8.5e+167))) tmp = x + 1.0; else tmp = x + (1.0 - (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -4.6e+149], N[Not[LessEqual[y, 8.5e+167]], $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 -4.6 \cdot 10^{+149} \lor \neg \left(y \leq 8.5 \cdot 10^{+167}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;x + \left(1 - y \cdot z\right)\\
\end{array}
\end{array}
if y < -4.5999999999999997e149 or 8.50000000000000007e167 < y Initial program 99.8%
associate--l+99.8%
Simplified99.8%
Taylor expanded in y around 0 46.1%
+-commutative46.1%
Simplified46.1%
if -4.5999999999999997e149 < y < 8.50000000000000007e167Initial program 99.9%
associate--l+99.9%
Simplified99.9%
expm1-log1p-u99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 79.1%
associate-+r+79.1%
+-commutative79.1%
associate-+l+79.1%
mul-1-neg79.1%
unsub-neg79.1%
Simplified79.1%
Final simplification71.3%
(FPCore (x y z) :precision binary64 (if (<= x -1.0) x (if (<= x 7600.0) 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.0) {
tmp = x;
} else if (x <= 7600.0) {
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 <= (-1.0d0)) then
tmp = x
else if (x <= 7600.0d0) 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 <= -1.0) {
tmp = x;
} else if (x <= 7600.0) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.0: tmp = x elif x <= 7600.0: tmp = 1.0 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.0) tmp = x; elseif (x <= 7600.0) tmp = 1.0; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.0) tmp = x; elseif (x <= 7600.0) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.0], x, If[LessEqual[x, 7600.0], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 7600:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1 or 7600 < x Initial program 99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in x around inf 78.2%
if -1 < x < 7600Initial program 99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in x around 0 99.9%
Taylor expanded in y around 0 41.3%
(FPCore (x y z) :precision binary64 (if (<= z -2.15e+241) (- 1.0 (* y z)) (+ x 1.0)))
double code(double x, double y, double z) {
double tmp;
if (z <= -2.15e+241) {
tmp = 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 (z <= (-2.15d+241)) then
tmp = 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 (z <= -2.15e+241) {
tmp = 1.0 - (y * z);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -2.15e+241: tmp = 1.0 - (y * z) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (z <= -2.15e+241) tmp = 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 (z <= -2.15e+241) tmp = 1.0 - (y * z); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -2.15e+241], N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.15 \cdot 10^{+241}:\\
\;\;\;\;1 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if z < -2.15000000000000002e241Initial program 100.0%
associate--l+100.0%
Simplified100.0%
add-sqr-sqrt54.0%
pow254.0%
Applied egg-rr54.0%
Taylor expanded in x around 0 45.7%
Taylor expanded in y around 0 61.1%
mul-1-neg61.1%
unsub-neg61.1%
Simplified61.1%
if -2.15000000000000002e241 < z Initial program 99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in y around 0 66.1%
+-commutative66.1%
Simplified66.1%
(FPCore (x y z) :precision binary64 (if (<= z -5.3e+241) (* y (- z)) (+ x 1.0)))
double code(double x, double y, double z) {
double tmp;
if (z <= -5.3e+241) {
tmp = 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 <= (-5.3d+241)) then
tmp = 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 <= -5.3e+241) {
tmp = y * -z;
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -5.3e+241: tmp = y * -z else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (z <= -5.3e+241) tmp = Float64(y * Float64(-z)); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -5.3e+241) tmp = y * -z; else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -5.3e+241], N[(y * (-z)), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.3 \cdot 10^{+241}:\\
\;\;\;\;y \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if z < -5.3000000000000001e241Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in z around inf 86.8%
associate-*r*86.8%
neg-mul-186.8%
*-commutative86.8%
Simplified86.8%
Taylor expanded in y around 0 60.9%
associate-*r*60.9%
neg-mul-160.9%
Simplified60.9%
if -5.3000000000000001e241 < z Initial program 99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in y around 0 66.1%
+-commutative66.1%
Simplified66.1%
Final simplification65.6%
(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%
associate--l+99.9%
Simplified99.9%
Taylor expanded in y around 0 61.8%
+-commutative61.8%
Simplified61.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 99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in x around 0 58.0%
Taylor expanded in y around 0 20.2%
herbie shell --seed 2024170
(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))))