
(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 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * sin(y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
Initial program 99.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.22) (not (<= z 3.4e-22))) (- (+ x 1.0) (* z (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.22) || !(z <= 3.4e-22)) {
tmp = (x + 1.0) - (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 <= (-0.22d0)) .or. (.not. (z <= 3.4d-22))) then
tmp = (x + 1.0d0) - (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 <= -0.22) || !(z <= 3.4e-22)) {
tmp = (x + 1.0) - (z * Math.sin(y));
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.22) or not (z <= 3.4e-22): tmp = (x + 1.0) - (z * math.sin(y)) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.22) || !(z <= 3.4e-22)) tmp = Float64(Float64(x + 1.0) - Float64(z * sin(y))); else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -0.22) || ~((z <= 3.4e-22))) tmp = (x + 1.0) - (z * sin(y)); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.22], N[Not[LessEqual[z, 3.4e-22]], $MachinePrecision]], N[(N[(x + 1.0), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.22 \lor \neg \left(z \leq 3.4 \cdot 10^{-22}\right):\\
\;\;\;\;\left(x + 1\right) - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -0.220000000000000001 or 3.3999999999999998e-22 < z Initial program 99.8%
Taylor expanded in y around 0 99.8%
if -0.220000000000000001 < z < 3.3999999999999998e-22Initial program 100.0%
Taylor expanded in z around 0 100.0%
+-commutative100.0%
Simplified100.0%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -8.4e+161) (not (<= z 5.7e+85))) (- 1.0 (* z (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -8.4e+161) || !(z <= 5.7e+85)) {
tmp = 1.0 - (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 <= (-8.4d+161)) .or. (.not. (z <= 5.7d+85))) then
tmp = 1.0d0 - (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 <= -8.4e+161) || !(z <= 5.7e+85)) {
tmp = 1.0 - (z * Math.sin(y));
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -8.4e+161) or not (z <= 5.7e+85): tmp = 1.0 - (z * math.sin(y)) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -8.4e+161) || !(z <= 5.7e+85)) tmp = Float64(1.0 - Float64(z * sin(y))); else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -8.4e+161) || ~((z <= 5.7e+85))) tmp = 1.0 - (z * sin(y)); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -8.4e+161], N[Not[LessEqual[z, 5.7e+85]], $MachinePrecision]], N[(1.0 - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.4 \cdot 10^{+161} \lor \neg \left(z \leq 5.7 \cdot 10^{+85}\right):\\
\;\;\;\;1 - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -8.4e161 or 5.7000000000000002e85 < z Initial program 99.8%
Taylor expanded in x around 0 76.4%
Taylor expanded in y around 0 76.4%
if -8.4e161 < z < 5.7000000000000002e85Initial program 100.0%
Taylor expanded in z around 0 93.9%
+-commutative93.9%
Simplified93.9%
Final simplification89.1%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.2e+163) (not (<= z 1.6e+173))) (* z (- (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.2e+163) || !(z <= 1.6e+173)) {
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 <= (-1.2d+163)) .or. (.not. (z <= 1.6d+173))) 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 <= -1.2e+163) || !(z <= 1.6e+173)) {
tmp = z * -Math.sin(y);
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.2e+163) or not (z <= 1.6e+173): tmp = z * -math.sin(y) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.2e+163) || !(z <= 1.6e+173)) 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 <= -1.2e+163) || ~((z <= 1.6e+173))) tmp = z * -sin(y); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.2e+163], N[Not[LessEqual[z, 1.6e+173]], $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 -1.2 \cdot 10^{+163} \lor \neg \left(z \leq 1.6 \cdot 10^{+173}\right):\\
\;\;\;\;z \cdot \left(-\sin y\right)\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -1.1999999999999999e163 or 1.6000000000000001e173 < z Initial program 99.7%
Taylor expanded in z around inf 77.0%
mul-1-neg77.0%
distribute-rgt-neg-out77.0%
Simplified77.0%
if -1.1999999999999999e163 < z < 1.6000000000000001e173Initial program 100.0%
Taylor expanded in z around 0 90.6%
+-commutative90.6%
Simplified90.6%
Final simplification87.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.05e+35) (not (<= y 1.85))) (+ x (cos y)) (+ 1.0 (+ x (* y (- (* y (- (* 0.16666666666666666 (* y z)) 0.5)) z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.05e+35) || !(y <= 1.85)) {
tmp = x + cos(y);
} else {
tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - 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 <= (-1.05d+35)) .or. (.not. (y <= 1.85d0))) then
tmp = x + cos(y)
else
tmp = 1.0d0 + (x + (y * ((y * ((0.16666666666666666d0 * (y * z)) - 0.5d0)) - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1.05e+35) || !(y <= 1.85)) {
tmp = x + Math.cos(y);
} else {
tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.05e+35) or not (y <= 1.85): tmp = x + math.cos(y) else: tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.05e+35) || !(y <= 1.85)) tmp = Float64(x + cos(y)); else tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * Float64(Float64(0.16666666666666666 * Float64(y * z)) - 0.5)) - z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.05e+35) || ~((y <= 1.85))) tmp = x + cos(y); else tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.05e+35], N[Not[LessEqual[y, 1.85]], $MachinePrecision]], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x + N[(y * N[(N[(y * N[(N[(0.16666666666666666 * N[(y * z), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.05 \cdot 10^{+35} \lor \neg \left(y \leq 1.85\right):\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot \left(0.16666666666666666 \cdot \left(y \cdot z\right) - 0.5\right) - z\right)\right)\\
\end{array}
\end{array}
if y < -1.0499999999999999e35 or 1.8500000000000001 < y Initial program 99.9%
Taylor expanded in z around 0 71.8%
+-commutative71.8%
Simplified71.8%
if -1.0499999999999999e35 < y < 1.8500000000000001Initial program 100.0%
Taylor expanded in y around 0 97.2%
Final simplification84.9%
(FPCore (x y z) :precision binary64 (if (<= x -7.8e-10) (+ -1.0 (+ x 2.0)) (if (<= x 2e-6) (cos y) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -7.8e-10) {
tmp = -1.0 + (x + 2.0);
} else if (x <= 2e-6) {
tmp = cos(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 <= (-7.8d-10)) then
tmp = (-1.0d0) + (x + 2.0d0)
else if (x <= 2d-6) then
tmp = cos(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 <= -7.8e-10) {
tmp = -1.0 + (x + 2.0);
} else if (x <= 2e-6) {
tmp = Math.cos(y);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -7.8e-10: tmp = -1.0 + (x + 2.0) elif x <= 2e-6: tmp = math.cos(y) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -7.8e-10) tmp = Float64(-1.0 + Float64(x + 2.0)); elseif (x <= 2e-6) tmp = cos(y); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -7.8e-10) tmp = -1.0 + (x + 2.0); elseif (x <= 2e-6) tmp = cos(y); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -7.8e-10], N[(-1.0 + N[(x + 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2e-6], N[Cos[y], $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.8 \cdot 10^{-10}:\\
\;\;\;\;-1 + \left(x + 2\right)\\
\mathbf{elif}\;x \leq 2 \cdot 10^{-6}:\\
\;\;\;\;\cos y\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if x < -7.7999999999999999e-10Initial program 100.0%
Taylor expanded in y around 0 88.5%
+-commutative88.5%
Simplified88.5%
expm1-log1p-u3.0%
expm1-undefine3.0%
Applied egg-rr3.0%
sub-neg3.0%
metadata-eval3.0%
+-commutative3.0%
log1p-undefine3.0%
rem-exp-log88.5%
+-commutative88.5%
associate-+r+88.5%
metadata-eval88.5%
Simplified88.5%
if -7.7999999999999999e-10 < x < 1.99999999999999991e-6Initial program 99.9%
Taylor expanded in x around 0 99.5%
Taylor expanded in z around 0 66.0%
if 1.99999999999999991e-6 < x Initial program 100.0%
Taylor expanded in y around 0 85.7%
+-commutative85.7%
Simplified85.7%
Final simplification76.4%
(FPCore (x y z)
:precision binary64
(if (<= y -9.6e+36)
(* x (+ 1.0 (/ 1.0 x)))
(if (<= y 236.0)
(+ 1.0 (+ x (* y (- (* y (- (* 0.16666666666666666 (* y z)) 0.5)) z))))
(+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -9.6e+36) {
tmp = x * (1.0 + (1.0 / x));
} else if (y <= 236.0) {
tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - 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 <= (-9.6d+36)) then
tmp = x * (1.0d0 + (1.0d0 / x))
else if (y <= 236.0d0) then
tmp = 1.0d0 + (x + (y * ((y * ((0.16666666666666666d0 * (y * z)) - 0.5d0)) - 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 <= -9.6e+36) {
tmp = x * (1.0 + (1.0 / x));
} else if (y <= 236.0) {
tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z)));
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -9.6e+36: tmp = x * (1.0 + (1.0 / x)) elif y <= 236.0: tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z))) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -9.6e+36) tmp = Float64(x * Float64(1.0 + Float64(1.0 / x))); elseif (y <= 236.0) tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * Float64(Float64(0.16666666666666666 * Float64(y * z)) - 0.5)) - z)))); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -9.6e+36) tmp = x * (1.0 + (1.0 / x)); elseif (y <= 236.0) tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z))); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -9.6e+36], N[(x * N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 236.0], N[(1.0 + N[(x + N[(y * N[(N[(y * N[(N[(0.16666666666666666 * N[(y * z), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.6 \cdot 10^{+36}:\\
\;\;\;\;x \cdot \left(1 + \frac{1}{x}\right)\\
\mathbf{elif}\;y \leq 236:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot \left(0.16666666666666666 \cdot \left(y \cdot z\right) - 0.5\right) - z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if y < -9.5999999999999997e36Initial program 99.9%
Taylor expanded in y around 0 42.4%
+-commutative42.4%
Simplified42.4%
Taylor expanded in x around inf 42.4%
if -9.5999999999999997e36 < y < 236Initial program 100.0%
Taylor expanded in y around 0 96.5%
if 236 < y Initial program 99.9%
Taylor expanded in y around 0 51.6%
+-commutative51.6%
Simplified51.6%
(FPCore (x y z) :precision binary64 (if (<= y -2.9e+45) (* x (+ 1.0 (/ 1.0 x))) (if (<= y 29.0) (+ (+ x 1.0) (* y (- (* y -0.5) z))) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.9e+45) {
tmp = x * (1.0 + (1.0 / x));
} else if (y <= 29.0) {
tmp = (x + 1.0) + (y * ((y * -0.5) - 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 <= (-2.9d+45)) then
tmp = x * (1.0d0 + (1.0d0 / x))
else if (y <= 29.0d0) then
tmp = (x + 1.0d0) + (y * ((y * (-0.5d0)) - 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 <= -2.9e+45) {
tmp = x * (1.0 + (1.0 / x));
} else if (y <= 29.0) {
tmp = (x + 1.0) + (y * ((y * -0.5) - z));
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.9e+45: tmp = x * (1.0 + (1.0 / x)) elif y <= 29.0: tmp = (x + 1.0) + (y * ((y * -0.5) - z)) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.9e+45) tmp = Float64(x * Float64(1.0 + Float64(1.0 / x))); elseif (y <= 29.0) tmp = Float64(Float64(x + 1.0) + Float64(y * Float64(Float64(y * -0.5) - z))); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -2.9e+45) tmp = x * (1.0 + (1.0 / x)); elseif (y <= 29.0) tmp = (x + 1.0) + (y * ((y * -0.5) - z)); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.9e+45], N[(x * N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 29.0], N[(N[(x + 1.0), $MachinePrecision] + N[(y * N[(N[(y * -0.5), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.9 \cdot 10^{+45}:\\
\;\;\;\;x \cdot \left(1 + \frac{1}{x}\right)\\
\mathbf{elif}\;y \leq 29:\\
\;\;\;\;\left(x + 1\right) + y \cdot \left(y \cdot -0.5 - z\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if y < -2.8999999999999997e45Initial program 99.9%
Taylor expanded in y around 0 43.0%
+-commutative43.0%
Simplified43.0%
Taylor expanded in x around inf 43.0%
if -2.8999999999999997e45 < y < 29Initial program 100.0%
Taylor expanded in y around 0 95.7%
associate-+r+95.7%
+-commutative95.7%
*-commutative95.7%
Simplified95.7%
if 29 < y Initial program 99.9%
Taylor expanded in y around 0 51.6%
+-commutative51.6%
Simplified51.6%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.4e+83) (not (<= y 2400000.0))) (+ x 1.0) (+ x (- 1.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.4e+83) || !(y <= 2400000.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 <= (-2.4d+83)) .or. (.not. (y <= 2400000.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 <= -2.4e+83) || !(y <= 2400000.0)) {
tmp = x + 1.0;
} else {
tmp = x + (1.0 - (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.4e+83) or not (y <= 2400000.0): tmp = x + 1.0 else: tmp = x + (1.0 - (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.4e+83) || !(y <= 2400000.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 <= -2.4e+83) || ~((y <= 2400000.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, -2.4e+83], N[Not[LessEqual[y, 2400000.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 -2.4 \cdot 10^{+83} \lor \neg \left(y \leq 2400000\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;x + \left(1 - y \cdot z\right)\\
\end{array}
\end{array}
if y < -2.39999999999999991e83 or 2.4e6 < y Initial program 99.9%
Taylor expanded in y around 0 49.6%
+-commutative49.6%
Simplified49.6%
if -2.39999999999999991e83 < y < 2.4e6Initial program 100.0%
Taylor expanded in y around 0 89.5%
associate-+r+89.5%
+-commutative89.5%
associate-+l+89.5%
mul-1-neg89.5%
unsub-neg89.5%
Simplified89.5%
Final simplification72.4%
(FPCore (x y z) :precision binary64 (if (or (<= x -55.0) (not (<= x 125.0))) (+ x 1.0) (- 1.0 (* y z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -55.0) || !(x <= 125.0)) {
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 <= (-55.0d0)) .or. (.not. (x <= 125.0d0))) 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 <= -55.0) || !(x <= 125.0)) {
tmp = x + 1.0;
} else {
tmp = 1.0 - (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -55.0) or not (x <= 125.0): tmp = x + 1.0 else: tmp = 1.0 - (y * z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -55.0) || !(x <= 125.0)) 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 <= -55.0) || ~((x <= 125.0))) tmp = x + 1.0; else tmp = 1.0 - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -55.0], N[Not[LessEqual[x, 125.0]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -55 \lor \neg \left(x \leq 125\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 - y \cdot z\\
\end{array}
\end{array}
if x < -55 or 125 < x Initial program 100.0%
Taylor expanded in y around 0 89.1%
+-commutative89.1%
Simplified89.1%
if -55 < x < 125Initial program 99.9%
Taylor expanded in x around 0 98.8%
Taylor expanded in y around 0 52.8%
*-commutative52.8%
neg-mul-152.8%
unsub-neg52.8%
Simplified52.8%
Final simplification70.1%
(FPCore (x y z) :precision binary64 (if (<= x -0.00032) x (if (<= x 1e-14) 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -0.00032) {
tmp = x;
} else if (x <= 1e-14) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-0.00032d0)) then
tmp = x
else if (x <= 1d-14) then
tmp = 1.0d0
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -0.00032) {
tmp = x;
} else if (x <= 1e-14) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -0.00032: tmp = x elif x <= 1e-14: tmp = 1.0 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -0.00032) tmp = x; elseif (x <= 1e-14) tmp = 1.0; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -0.00032) tmp = x; elseif (x <= 1e-14) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -0.00032], x, If[LessEqual[x, 1e-14], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.00032:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 10^{-14}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -3.20000000000000026e-4 or 9.99999999999999999e-15 < x Initial program 100.0%
Taylor expanded in x around inf 85.9%
if -3.20000000000000026e-4 < x < 9.99999999999999999e-15Initial program 99.9%
Taylor expanded in x around 0 98.8%
Taylor expanded in y around 0 42.2%
(FPCore (x y z) :precision binary64 (if (<= z 7e+210) (+ x 1.0) (* z (- y))))
double code(double x, double y, double z) {
double tmp;
if (z <= 7e+210) {
tmp = x + 1.0;
} else {
tmp = 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 <= 7d+210) then
tmp = x + 1.0d0
else
tmp = z * -y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 7e+210) {
tmp = x + 1.0;
} else {
tmp = z * -y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 7e+210: tmp = x + 1.0 else: tmp = z * -y return tmp
function code(x, y, z) tmp = 0.0 if (z <= 7e+210) tmp = Float64(x + 1.0); else tmp = Float64(z * Float64(-y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 7e+210) tmp = x + 1.0; else tmp = z * -y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 7e+210], N[(x + 1.0), $MachinePrecision], N[(z * (-y)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 7 \cdot 10^{+210}:\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-y\right)\\
\end{array}
\end{array}
if z < 6.9999999999999999e210Initial program 99.9%
Taylor expanded in y around 0 68.5%
+-commutative68.5%
Simplified68.5%
if 6.9999999999999999e210 < z Initial program 99.8%
add-cube-cbrt98.4%
pow398.4%
Applied egg-rr98.4%
Taylor expanded in z around inf 86.2%
associate-*r*86.2%
neg-mul-186.2%
*-commutative86.2%
Simplified86.2%
Taylor expanded in y around 0 50.6%
mul-1-neg50.6%
distribute-rgt-neg-in50.6%
Simplified50.6%
Final simplification67.1%
(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 64.2%
+-commutative64.2%
Simplified64.2%
(FPCore (x y z) :precision binary64 1.0)
double code(double x, double y, double z) {
return 1.0;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0
end function
public static double code(double x, double y, double z) {
return 1.0;
}
def code(x, y, z): return 1.0
function code(x, y, z) return 1.0 end
function tmp = code(x, y, z) tmp = 1.0; end
code[x_, y_, z_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 99.9%
Taylor expanded in x around 0 57.8%
Taylor expanded in y around 0 22.9%
herbie shell --seed 2024180
(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))))