
(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(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%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (sin y))))
(if (<= x -14.0)
(* x (- 1.0 (* z (/ (sin y) x))))
(if (<= x 0.56) (- (cos y) t_0) (- x t_0)))))
double code(double x, double y, double z) {
double t_0 = z * sin(y);
double tmp;
if (x <= -14.0) {
tmp = x * (1.0 - (z * (sin(y) / x)));
} else if (x <= 0.56) {
tmp = cos(y) - t_0;
} else {
tmp = x - 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 = z * sin(y)
if (x <= (-14.0d0)) then
tmp = x * (1.0d0 - (z * (sin(y) / x)))
else if (x <= 0.56d0) then
tmp = cos(y) - t_0
else
tmp = x - t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * Math.sin(y);
double tmp;
if (x <= -14.0) {
tmp = x * (1.0 - (z * (Math.sin(y) / x)));
} else if (x <= 0.56) {
tmp = Math.cos(y) - t_0;
} else {
tmp = x - t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.sin(y) tmp = 0 if x <= -14.0: tmp = x * (1.0 - (z * (math.sin(y) / x))) elif x <= 0.56: tmp = math.cos(y) - t_0 else: tmp = x - t_0 return tmp
function code(x, y, z) t_0 = Float64(z * sin(y)) tmp = 0.0 if (x <= -14.0) tmp = Float64(x * Float64(1.0 - Float64(z * Float64(sin(y) / x)))); elseif (x <= 0.56) tmp = Float64(cos(y) - t_0); else tmp = Float64(x - t_0); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * sin(y); tmp = 0.0; if (x <= -14.0) tmp = x * (1.0 - (z * (sin(y) / x))); elseif (x <= 0.56) tmp = cos(y) - t_0; else tmp = x - t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -14.0], N[(x * N[(1.0 - N[(z * N[(N[Sin[y], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.56], N[(N[Cos[y], $MachinePrecision] - t$95$0), $MachinePrecision], N[(x - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \sin y\\
\mathbf{if}\;x \leq -14:\\
\;\;\;\;x \cdot \left(1 - z \cdot \frac{\sin y}{x}\right)\\
\mathbf{elif}\;x \leq 0.56:\\
\;\;\;\;\cos y - t\_0\\
\mathbf{else}:\\
\;\;\;\;x - t\_0\\
\end{array}
\end{array}
if x < -14Initial program 100.0%
Taylor expanded in x around inf 99.8%
Taylor expanded in x around inf 99.8%
mul-1-neg99.8%
unsub-neg99.8%
associate-/l*99.8%
Simplified99.8%
if -14 < x < 0.56000000000000005Initial program 99.9%
Taylor expanded in x around 0 99.5%
if 0.56000000000000005 < x Initial program 100.0%
Taylor expanded in x around inf 99.9%
Final simplification99.7%
(FPCore (x y z) :precision binary64 (if (or (<= z -25500000000000.0) (not (<= z 1.5e+62))) (- x (* z (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -25500000000000.0) || !(z <= 1.5e+62)) {
tmp = x - (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 <= (-25500000000000.0d0)) .or. (.not. (z <= 1.5d+62))) then
tmp = x - (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 <= -25500000000000.0) || !(z <= 1.5e+62)) {
tmp = x - (z * Math.sin(y));
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -25500000000000.0) or not (z <= 1.5e+62): tmp = x - (z * math.sin(y)) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -25500000000000.0) || !(z <= 1.5e+62)) tmp = Float64(x - 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 <= -25500000000000.0) || ~((z <= 1.5e+62))) tmp = x - (z * sin(y)); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -25500000000000.0], N[Not[LessEqual[z, 1.5e+62]], $MachinePrecision]], N[(x - 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 -25500000000000 \lor \neg \left(z \leq 1.5 \cdot 10^{+62}\right):\\
\;\;\;\;x - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -2.55e13 or 1.5e62 < z Initial program 99.8%
Taylor expanded in x around inf 93.8%
if -2.55e13 < z < 1.5e62Initial program 100.0%
Taylor expanded in z around 0 99.8%
+-commutative99.8%
Simplified99.8%
Final simplification97.4%
(FPCore (x y z) :precision binary64 (if (or (<= z -2.05e+155) (not (<= z 7.4e+124))) (* z (- (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.05e+155) || !(z <= 7.4e+124)) {
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 <= (-2.05d+155)) .or. (.not. (z <= 7.4d+124))) 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 <= -2.05e+155) || !(z <= 7.4e+124)) {
tmp = z * -Math.sin(y);
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.05e+155) or not (z <= 7.4e+124): tmp = z * -math.sin(y) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2.05e+155) || !(z <= 7.4e+124)) 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 <= -2.05e+155) || ~((z <= 7.4e+124))) tmp = z * -sin(y); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.05e+155], N[Not[LessEqual[z, 7.4e+124]], $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.05 \cdot 10^{+155} \lor \neg \left(z \leq 7.4 \cdot 10^{+124}\right):\\
\;\;\;\;z \cdot \left(-\sin y\right)\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -2.0499999999999999e155 or 7.40000000000000016e124 < z Initial program 99.8%
Taylor expanded in z around inf 74.4%
associate-*r*74.4%
neg-mul-174.4%
*-commutative74.4%
Simplified74.4%
if -2.0499999999999999e155 < z < 7.40000000000000016e124Initial program 100.0%
Taylor expanded in z around 0 90.9%
+-commutative90.9%
Simplified90.9%
Final simplification86.8%
(FPCore (x y z)
:precision binary64
(if (<= z -5.1e+92)
(+ 1.0 (+ x (* y (- (* y -0.5) z))))
(if (<= z 3.5e+126)
(+ 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 (z <= -5.1e+92) {
tmp = 1.0 + (x + (y * ((y * -0.5) - z)));
} else if (z <= 3.5e+126) {
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 (z <= (-5.1d+92)) then
tmp = 1.0d0 + (x + (y * ((y * (-0.5d0)) - z)))
else if (z <= 3.5d+126) 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 (z <= -5.1e+92) {
tmp = 1.0 + (x + (y * ((y * -0.5) - z)));
} else if (z <= 3.5e+126) {
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 z <= -5.1e+92: tmp = 1.0 + (x + (y * ((y * -0.5) - z))) elif z <= 3.5e+126: 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 (z <= -5.1e+92) tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * -0.5) - z)))); elseif (z <= 3.5e+126) 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 (z <= -5.1e+92) tmp = 1.0 + (x + (y * ((y * -0.5) - z))); elseif (z <= 3.5e+126) 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[LessEqual[z, -5.1e+92], N[(1.0 + N[(x + N[(y * N[(N[(y * -0.5), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.5e+126], 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}\;z \leq -5.1 \cdot 10^{+92}:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot -0.5 - z\right)\right)\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{+126}:\\
\;\;\;\;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 z < -5.1000000000000003e92Initial program 99.7%
Taylor expanded in y around 0 53.5%
if -5.1000000000000003e92 < z < 3.5000000000000003e126Initial program 100.0%
Taylor expanded in z around 0 92.0%
+-commutative92.0%
Simplified92.0%
if 3.5000000000000003e126 < z Initial program 99.9%
Taylor expanded in y around 0 56.7%
Final simplification81.6%
(FPCore (x y z) :precision binary64 (if (or (<= x -3.6e-7) (not (<= x 9.8e-9))) (+ x 1.0) (cos y)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -3.6e-7) || !(x <= 9.8e-9)) {
tmp = x + 1.0;
} else {
tmp = cos(y);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= (-3.6d-7)) .or. (.not. (x <= 9.8d-9))) then
tmp = x + 1.0d0
else
tmp = cos(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -3.6e-7) || !(x <= 9.8e-9)) {
tmp = x + 1.0;
} else {
tmp = Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -3.6e-7) or not (x <= 9.8e-9): tmp = x + 1.0 else: tmp = math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -3.6e-7) || !(x <= 9.8e-9)) tmp = Float64(x + 1.0); else tmp = cos(y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -3.6e-7) || ~((x <= 9.8e-9))) tmp = x + 1.0; else tmp = cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -3.6e-7], N[Not[LessEqual[x, 9.8e-9]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[Cos[y], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.6 \cdot 10^{-7} \lor \neg \left(x \leq 9.8 \cdot 10^{-9}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;\cos y\\
\end{array}
\end{array}
if x < -3.59999999999999994e-7 or 9.80000000000000007e-9 < x Initial program 100.0%
Taylor expanded in z around 0 87.0%
+-commutative87.0%
Simplified87.0%
Taylor expanded in y around 0 87.0%
if -3.59999999999999994e-7 < x < 9.80000000000000007e-9Initial program 99.9%
Taylor expanded in x around inf 99.8%
Taylor expanded in z around 0 63.5%
Taylor expanded in x around 0 63.2%
Final simplification74.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -3.5) (not (<= y 0.135))) (+ x 1.0) (+ 1.0 (+ x (* y (- (* y (- (* 0.16666666666666666 (* y z)) 0.5)) z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3.5) || !(y <= 0.135)) {
tmp = x + 1.0;
} 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 <= (-3.5d0)) .or. (.not. (y <= 0.135d0))) then
tmp = x + 1.0d0
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 <= -3.5) || !(y <= 0.135)) {
tmp = x + 1.0;
} 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 <= -3.5) or not (y <= 0.135): tmp = x + 1.0 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 <= -3.5) || !(y <= 0.135)) tmp = Float64(x + 1.0); 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 <= -3.5) || ~((y <= 0.135))) tmp = x + 1.0; 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, -3.5], N[Not[LessEqual[y, 0.135]], $MachinePrecision]], N[(x + 1.0), $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 -3.5 \lor \neg \left(y \leq 0.135\right):\\
\;\;\;\;x + 1\\
\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 < -3.5 or 0.13500000000000001 < y Initial program 99.8%
Taylor expanded in z around 0 60.5%
+-commutative60.5%
Simplified60.5%
Taylor expanded in y around 0 36.1%
if -3.5 < y < 0.13500000000000001Initial program 100.0%
Taylor expanded in y around 0 100.0%
Final simplification71.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -9e+21) (not (<= y 2.7e+43))) (+ x 1.0) (+ 1.0 (- x (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -9e+21) || !(y <= 2.7e+43)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x - (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 <= (-9d+21)) .or. (.not. (y <= 2.7d+43))) then
tmp = x + 1.0d0
else
tmp = 1.0d0 + (x - (y * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -9e+21) || !(y <= 2.7e+43)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x - (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -9e+21) or not (y <= 2.7e+43): tmp = x + 1.0 else: tmp = 1.0 + (x - (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -9e+21) || !(y <= 2.7e+43)) tmp = Float64(x + 1.0); else tmp = Float64(1.0 + Float64(x - Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -9e+21) || ~((y <= 2.7e+43))) tmp = x + 1.0; else tmp = 1.0 + (x - (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -9e+21], N[Not[LessEqual[y, 2.7e+43]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(1.0 + N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9 \cdot 10^{+21} \lor \neg \left(y \leq 2.7 \cdot 10^{+43}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x - y \cdot z\right)\\
\end{array}
\end{array}
if y < -9e21 or 2.7000000000000002e43 < y Initial program 99.9%
Taylor expanded in z around 0 60.5%
+-commutative60.5%
Simplified60.5%
Taylor expanded in y around 0 36.1%
if -9e21 < y < 2.7000000000000002e43Initial program 100.0%
Taylor expanded in y around 0 95.3%
mul-1-neg95.3%
unsub-neg95.3%
Simplified95.3%
Final simplification71.7%
(FPCore (x y z) :precision binary64 (if (or (<= x -420000000.0) (not (<= x 1.65e-13))) (+ x 1.0) (- 1.0 (* y z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -420000000.0) || !(x <= 1.65e-13)) {
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 <= (-420000000.0d0)) .or. (.not. (x <= 1.65d-13))) 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 <= -420000000.0) || !(x <= 1.65e-13)) {
tmp = x + 1.0;
} else {
tmp = 1.0 - (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -420000000.0) or not (x <= 1.65e-13): tmp = x + 1.0 else: tmp = 1.0 - (y * z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -420000000.0) || !(x <= 1.65e-13)) 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 <= -420000000.0) || ~((x <= 1.65e-13))) tmp = x + 1.0; else tmp = 1.0 - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -420000000.0], N[Not[LessEqual[x, 1.65e-13]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -420000000 \lor \neg \left(x \leq 1.65 \cdot 10^{-13}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 - y \cdot z\\
\end{array}
\end{array}
if x < -4.2e8 or 1.65e-13 < x Initial program 100.0%
Taylor expanded in z around 0 88.5%
+-commutative88.5%
Simplified88.5%
Taylor expanded in y around 0 87.3%
if -4.2e8 < x < 1.65e-13Initial program 99.9%
Taylor expanded in x around 0 99.9%
Taylor expanded in y around 0 54.0%
mul-1-neg54.0%
unsub-neg54.0%
Simplified54.0%
Final simplification70.2%
(FPCore (x y z) :precision binary64 (if (<= x -3.5e-7) x (if (<= x 1.0) 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -3.5e-7) {
tmp = x;
} else if (x <= 1.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 <= (-3.5d-7)) then
tmp = x
else if (x <= 1.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 <= -3.5e-7) {
tmp = x;
} else if (x <= 1.0) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -3.5e-7: tmp = x elif x <= 1.0: tmp = 1.0 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -3.5e-7) tmp = x; elseif (x <= 1.0) tmp = 1.0; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -3.5e-7) tmp = x; elseif (x <= 1.0) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -3.5e-7], x, If[LessEqual[x, 1.0], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.5 \cdot 10^{-7}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -3.49999999999999984e-7 or 1 < x Initial program 100.0%
Taylor expanded in x around inf 99.9%
Taylor expanded in z around 0 86.3%
Taylor expanded in x around inf 86.2%
if -3.49999999999999984e-7 < x < 1Initial program 99.9%
Taylor expanded in x around 0 99.5%
Taylor expanded in y around 0 42.9%
Final simplification64.2%
(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 z around 0 75.0%
+-commutative75.0%
Simplified75.0%
Taylor expanded in y around 0 64.3%
Final simplification64.3%
(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 58.0%
Taylor expanded in y around 0 23.2%
Final simplification23.2%
herbie shell --seed 2024066
(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))))