
(FPCore (x y z) :precision binary64 (+ (+ x (sin y)) (* z (cos y))))
double code(double x, double y, double z) {
return (x + sin(y)) + (z * cos(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 + sin(y)) + (z * cos(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.sin(y)) + (z * Math.cos(y));
}
def code(x, y, z): return (x + math.sin(y)) + (z * math.cos(y))
function code(x, y, z) return Float64(Float64(x + sin(y)) + Float64(z * cos(y))) end
function tmp = code(x, y, z) tmp = (x + sin(y)) + (z * cos(y)); end
code[x_, y_, z_] := N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \sin y\right) + z \cdot \cos y
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ (+ x (sin y)) (* z (cos y))))
double code(double x, double y, double z) {
return (x + sin(y)) + (z * cos(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 + sin(y)) + (z * cos(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.sin(y)) + (z * Math.cos(y));
}
def code(x, y, z): return (x + math.sin(y)) + (z * math.cos(y))
function code(x, y, z) return Float64(Float64(x + sin(y)) + Float64(z * cos(y))) end
function tmp = code(x, y, z) tmp = (x + sin(y)) + (z * cos(y)); end
code[x_, y_, z_] := N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \sin y\right) + z \cdot \cos y
\end{array}
(FPCore (x y z) :precision binary64 (fma z (cos y) (+ x (sin y))))
double code(double x, double y, double z) {
return fma(z, cos(y), (x + sin(y)));
}
function code(x, y, z) return fma(z, cos(y), Float64(x + sin(y))) end
code[x_, y_, z_] := N[(z * N[Cos[y], $MachinePrecision] + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z, \cos y, x + \sin y\right)
\end{array}
Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
(FPCore (x y z) :precision binary64 (if (<= z -3.6e+32) (fma z (cos y) x) (if (<= z 7.8e-5) (+ z (+ x (sin y))) (+ x (* z (cos y))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -3.6e+32) {
tmp = fma(z, cos(y), x);
} else if (z <= 7.8e-5) {
tmp = z + (x + sin(y));
} else {
tmp = x + (z * cos(y));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= -3.6e+32) tmp = fma(z, cos(y), x); elseif (z <= 7.8e-5) tmp = Float64(z + Float64(x + sin(y))); else tmp = Float64(x + Float64(z * cos(y))); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, -3.6e+32], N[(z * N[Cos[y], $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 7.8e-5], N[(z + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.6 \cdot 10^{+32}:\\
\;\;\;\;\mathsf{fma}\left(z, \cos y, x\right)\\
\mathbf{elif}\;z \leq 7.8 \cdot 10^{-5}:\\
\;\;\;\;z + \left(x + \sin y\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \cos y\\
\end{array}
\end{array}
if z < -3.5999999999999997e32Initial program 99.7%
+-commutative99.7%
fma-define99.7%
Simplified99.7%
Taylor expanded in x around inf 99.7%
if -3.5999999999999997e32 < z < 7.7999999999999999e-5Initial program 100.0%
Taylor expanded in y around 0 99.2%
if 7.7999999999999999e-5 < z Initial program 99.9%
Taylor expanded in x around inf 99.8%
Final simplification99.5%
(FPCore (x y z) :precision binary64 (+ (+ x (sin y)) (* z (cos y))))
double code(double x, double y, double z) {
return (x + sin(y)) + (z * cos(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 + sin(y)) + (z * cos(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.sin(y)) + (z * Math.cos(y));
}
def code(x, y, z): return (x + math.sin(y)) + (z * math.cos(y))
function code(x, y, z) return Float64(Float64(x + sin(y)) + Float64(z * cos(y))) end
function tmp = code(x, y, z) tmp = (x + sin(y)) + (z * cos(y)); end
code[x_, y_, z_] := N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \sin y\right) + z \cdot \cos y
\end{array}
Initial program 99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= z -9.6e+32)
t_0
(if (<= z 6e-294)
(+ z x)
(if (<= z 2.2e-210) (+ z (+ y x)) (if (<= z 7e+127) (+ z x) t_0))))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -9.6e+32) {
tmp = t_0;
} else if (z <= 6e-294) {
tmp = z + x;
} else if (z <= 2.2e-210) {
tmp = z + (y + x);
} else if (z <= 7e+127) {
tmp = z + x;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = z * cos(y)
if (z <= (-9.6d+32)) then
tmp = t_0
else if (z <= 6d-294) then
tmp = z + x
else if (z <= 2.2d-210) then
tmp = z + (y + x)
else if (z <= 7d+127) then
tmp = z + x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * Math.cos(y);
double tmp;
if (z <= -9.6e+32) {
tmp = t_0;
} else if (z <= 6e-294) {
tmp = z + x;
} else if (z <= 2.2e-210) {
tmp = z + (y + x);
} else if (z <= 7e+127) {
tmp = z + x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if z <= -9.6e+32: tmp = t_0 elif z <= 6e-294: tmp = z + x elif z <= 2.2e-210: tmp = z + (y + x) elif z <= 7e+127: tmp = z + x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * cos(y)) tmp = 0.0 if (z <= -9.6e+32) tmp = t_0; elseif (z <= 6e-294) tmp = Float64(z + x); elseif (z <= 2.2e-210) tmp = Float64(z + Float64(y + x)); elseif (z <= 7e+127) tmp = Float64(z + x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * cos(y); tmp = 0.0; if (z <= -9.6e+32) tmp = t_0; elseif (z <= 6e-294) tmp = z + x; elseif (z <= 2.2e-210) tmp = z + (y + x); elseif (z <= 7e+127) tmp = z + x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -9.6e+32], t$95$0, If[LessEqual[z, 6e-294], N[(z + x), $MachinePrecision], If[LessEqual[z, 2.2e-210], N[(z + N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7e+127], N[(z + x), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -9.6 \cdot 10^{+32}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 6 \cdot 10^{-294}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{-210}:\\
\;\;\;\;z + \left(y + x\right)\\
\mathbf{elif}\;z \leq 7 \cdot 10^{+127}:\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -9.59999999999999965e32 or 6.99999999999999956e127 < z Initial program 99.8%
Taylor expanded in z around inf 85.6%
if -9.59999999999999965e32 < z < 5.9999999999999998e-294 or 2.19999999999999989e-210 < z < 6.99999999999999956e127Initial program 100.0%
Taylor expanded in y around 0 69.9%
+-commutative69.9%
Simplified69.9%
if 5.9999999999999998e-294 < z < 2.19999999999999989e-210Initial program 100.0%
Taylor expanded in y around 0 88.3%
+-commutative88.3%
+-commutative88.3%
associate-+l+88.3%
Simplified88.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= z -3.6e+32)
t_0
(if (<= z 2.25e-39) (+ x (sin y)) (if (<= z 1.75e+139) (+ z x) t_0)))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -3.6e+32) {
tmp = t_0;
} else if (z <= 2.25e-39) {
tmp = x + sin(y);
} else if (z <= 1.75e+139) {
tmp = z + x;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = z * cos(y)
if (z <= (-3.6d+32)) then
tmp = t_0
else if (z <= 2.25d-39) then
tmp = x + sin(y)
else if (z <= 1.75d+139) then
tmp = z + x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * Math.cos(y);
double tmp;
if (z <= -3.6e+32) {
tmp = t_0;
} else if (z <= 2.25e-39) {
tmp = x + Math.sin(y);
} else if (z <= 1.75e+139) {
tmp = z + x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if z <= -3.6e+32: tmp = t_0 elif z <= 2.25e-39: tmp = x + math.sin(y) elif z <= 1.75e+139: tmp = z + x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * cos(y)) tmp = 0.0 if (z <= -3.6e+32) tmp = t_0; elseif (z <= 2.25e-39) tmp = Float64(x + sin(y)); elseif (z <= 1.75e+139) tmp = Float64(z + x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * cos(y); tmp = 0.0; if (z <= -3.6e+32) tmp = t_0; elseif (z <= 2.25e-39) tmp = x + sin(y); elseif (z <= 1.75e+139) tmp = z + x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.6e+32], t$95$0, If[LessEqual[z, 2.25e-39], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.75e+139], N[(z + x), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -3.6 \cdot 10^{+32}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 2.25 \cdot 10^{-39}:\\
\;\;\;\;x + \sin y\\
\mathbf{elif}\;z \leq 1.75 \cdot 10^{+139}:\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -3.5999999999999997e32 or 1.74999999999999989e139 < z Initial program 99.8%
Taylor expanded in z around inf 85.6%
if -3.5999999999999997e32 < z < 2.25e-39Initial program 100.0%
Taylor expanded in z around 0 90.6%
+-commutative90.6%
Simplified90.6%
if 2.25e-39 < z < 1.74999999999999989e139Initial program 99.9%
Taylor expanded in y around 0 83.7%
+-commutative83.7%
Simplified83.7%
Final simplification87.8%
(FPCore (x y z) :precision binary64 (if (or (<= z -3.6e+32) (not (<= z 7.8e-5))) (+ x (* z (cos y))) (+ z (+ x (sin y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -3.6e+32) || !(z <= 7.8e-5)) {
tmp = x + (z * cos(y));
} else {
tmp = z + (x + sin(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 <= (-3.6d+32)) .or. (.not. (z <= 7.8d-5))) then
tmp = x + (z * cos(y))
else
tmp = z + (x + sin(y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -3.6e+32) || !(z <= 7.8e-5)) {
tmp = x + (z * Math.cos(y));
} else {
tmp = z + (x + Math.sin(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -3.6e+32) or not (z <= 7.8e-5): tmp = x + (z * math.cos(y)) else: tmp = z + (x + math.sin(y)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -3.6e+32) || !(z <= 7.8e-5)) tmp = Float64(x + Float64(z * cos(y))); else tmp = Float64(z + Float64(x + sin(y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -3.6e+32) || ~((z <= 7.8e-5))) tmp = x + (z * cos(y)); else tmp = z + (x + sin(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -3.6e+32], N[Not[LessEqual[z, 7.8e-5]], $MachinePrecision]], N[(x + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.6 \cdot 10^{+32} \lor \neg \left(z \leq 7.8 \cdot 10^{-5}\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;z + \left(x + \sin y\right)\\
\end{array}
\end{array}
if z < -3.5999999999999997e32 or 7.7999999999999999e-5 < z Initial program 99.8%
Taylor expanded in x around inf 99.8%
if -3.5999999999999997e32 < z < 7.7999999999999999e-5Initial program 100.0%
Taylor expanded in y around 0 99.2%
Final simplification99.5%
(FPCore (x y z) :precision binary64 (if (or (<= z -3.4e-18) (not (<= z 1.25e-39))) (+ x (* z (cos y))) (+ x (sin y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -3.4e-18) || !(z <= 1.25e-39)) {
tmp = x + (z * cos(y));
} else {
tmp = x + sin(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 <= (-3.4d-18)) .or. (.not. (z <= 1.25d-39))) then
tmp = x + (z * cos(y))
else
tmp = x + sin(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -3.4e-18) || !(z <= 1.25e-39)) {
tmp = x + (z * Math.cos(y));
} else {
tmp = x + Math.sin(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -3.4e-18) or not (z <= 1.25e-39): tmp = x + (z * math.cos(y)) else: tmp = x + math.sin(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -3.4e-18) || !(z <= 1.25e-39)) tmp = Float64(x + Float64(z * cos(y))); else tmp = Float64(x + sin(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -3.4e-18) || ~((z <= 1.25e-39))) tmp = x + (z * cos(y)); else tmp = x + sin(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -3.4e-18], N[Not[LessEqual[z, 1.25e-39]], $MachinePrecision]], N[(x + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.4 \cdot 10^{-18} \lor \neg \left(z \leq 1.25 \cdot 10^{-39}\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;x + \sin y\\
\end{array}
\end{array}
if z < -3.40000000000000001e-18 or 1.25e-39 < z Initial program 99.8%
Taylor expanded in x around inf 98.5%
if -3.40000000000000001e-18 < z < 1.25e-39Initial program 100.0%
Taylor expanded in z around 0 93.2%
+-commutative93.2%
Simplified93.2%
Final simplification96.2%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.5e+24) (not (<= y 4.8))) (+ z x) (+ (+ z x) (* y (+ 1.0 (* z (* y -0.5)))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.5e+24) || !(y <= 4.8)) {
tmp = z + x;
} else {
tmp = (z + x) + (y * (1.0 + (z * (y * -0.5))));
}
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.5d+24)) .or. (.not. (y <= 4.8d0))) then
tmp = z + x
else
tmp = (z + x) + (y * (1.0d0 + (z * (y * (-0.5d0)))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1.5e+24) || !(y <= 4.8)) {
tmp = z + x;
} else {
tmp = (z + x) + (y * (1.0 + (z * (y * -0.5))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.5e+24) or not (y <= 4.8): tmp = z + x else: tmp = (z + x) + (y * (1.0 + (z * (y * -0.5)))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.5e+24) || !(y <= 4.8)) tmp = Float64(z + x); else tmp = Float64(Float64(z + x) + Float64(y * Float64(1.0 + Float64(z * Float64(y * -0.5))))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.5e+24) || ~((y <= 4.8))) tmp = z + x; else tmp = (z + x) + (y * (1.0 + (z * (y * -0.5)))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.5e+24], N[Not[LessEqual[y, 4.8]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(N[(z + x), $MachinePrecision] + N[(y * N[(1.0 + N[(z * N[(y * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.5 \cdot 10^{+24} \lor \neg \left(y \leq 4.8\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;\left(z + x\right) + y \cdot \left(1 + z \cdot \left(y \cdot -0.5\right)\right)\\
\end{array}
\end{array}
if y < -1.49999999999999997e24 or 4.79999999999999982 < y Initial program 99.8%
Taylor expanded in y around 0 38.9%
+-commutative38.9%
Simplified38.9%
if -1.49999999999999997e24 < y < 4.79999999999999982Initial program 100.0%
Taylor expanded in y around 0 95.4%
associate-+r+95.4%
+-commutative95.4%
associate-*r*95.4%
Simplified95.4%
Final simplification67.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -7.5e+48) (not (<= y 1.35e+43))) (+ z x) (+ z (+ y x))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -7.5e+48) || !(y <= 1.35e+43)) {
tmp = z + x;
} else {
tmp = z + (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 ((y <= (-7.5d+48)) .or. (.not. (y <= 1.35d+43))) then
tmp = z + x
else
tmp = z + (y + x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -7.5e+48) || !(y <= 1.35e+43)) {
tmp = z + x;
} else {
tmp = z + (y + x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -7.5e+48) or not (y <= 1.35e+43): tmp = z + x else: tmp = z + (y + x) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -7.5e+48) || !(y <= 1.35e+43)) tmp = Float64(z + x); else tmp = Float64(z + Float64(y + x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -7.5e+48) || ~((y <= 1.35e+43))) tmp = z + x; else tmp = z + (y + x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -7.5e+48], N[Not[LessEqual[y, 1.35e+43]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(z + N[(y + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.5 \cdot 10^{+48} \lor \neg \left(y \leq 1.35 \cdot 10^{+43}\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;z + \left(y + x\right)\\
\end{array}
\end{array}
if y < -7.5000000000000006e48 or 1.3500000000000001e43 < y Initial program 99.8%
Taylor expanded in y around 0 38.0%
+-commutative38.0%
Simplified38.0%
if -7.5000000000000006e48 < y < 1.3500000000000001e43Initial program 100.0%
Taylor expanded in y around 0 91.0%
+-commutative91.0%
+-commutative91.0%
associate-+l+91.0%
Simplified91.0%
Final simplification67.8%
(FPCore (x y z) :precision binary64 (if (<= x -1.65e+32) x (if (<= x 2.3e-17) (+ z y) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.65e+32) {
tmp = x;
} else if (x <= 2.3e-17) {
tmp = z + y;
} 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.65d+32)) then
tmp = x
else if (x <= 2.3d-17) then
tmp = z + y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.65e+32) {
tmp = x;
} else if (x <= 2.3e-17) {
tmp = z + y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.65e+32: tmp = x elif x <= 2.3e-17: tmp = z + y else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.65e+32) tmp = x; elseif (x <= 2.3e-17) tmp = Float64(z + y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.65e+32) tmp = x; elseif (x <= 2.3e-17) tmp = z + y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.65e+32], x, If[LessEqual[x, 2.3e-17], N[(z + y), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.65 \cdot 10^{+32}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{-17}:\\
\;\;\;\;z + y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.6500000000000001e32 or 2.30000000000000009e-17 < x Initial program 99.9%
+-commutative99.9%
add-cube-cbrt99.7%
associate-*r*99.7%
fma-define99.7%
pow299.7%
Applied egg-rr99.7%
Taylor expanded in x around inf 78.6%
if -1.6500000000000001e32 < x < 2.30000000000000009e-17Initial program 99.9%
Taylor expanded in x around 0 93.9%
Taylor expanded in y around 0 45.0%
Final simplification60.2%
(FPCore (x y z) :precision binary64 (if (<= x -4.3e+33) x (if (<= x 1.22e-16) z x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -4.3e+33) {
tmp = x;
} else if (x <= 1.22e-16) {
tmp = z;
} 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 <= (-4.3d+33)) then
tmp = x
else if (x <= 1.22d-16) then
tmp = z
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -4.3e+33) {
tmp = x;
} else if (x <= 1.22e-16) {
tmp = z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -4.3e+33: tmp = x elif x <= 1.22e-16: tmp = z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -4.3e+33) tmp = x; elseif (x <= 1.22e-16) tmp = z; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -4.3e+33) tmp = x; elseif (x <= 1.22e-16) tmp = z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -4.3e+33], x, If[LessEqual[x, 1.22e-16], z, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.3 \cdot 10^{+33}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.22 \cdot 10^{-16}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -4.30000000000000028e33 or 1.22e-16 < x Initial program 99.9%
+-commutative99.9%
add-cube-cbrt99.7%
associate-*r*99.7%
fma-define99.7%
pow299.7%
Applied egg-rr99.7%
Taylor expanded in x around inf 79.2%
if -4.30000000000000028e33 < x < 1.22e-16Initial program 99.8%
+-commutative99.8%
add-cube-cbrt99.4%
associate-*r*99.4%
fma-define99.4%
pow299.4%
Applied egg-rr99.4%
Taylor expanded in z around inf 62.1%
*-commutative62.1%
Simplified62.1%
Taylor expanded in y around 0 39.0%
(FPCore (x y z) :precision binary64 (+ z x))
double code(double x, double y, double z) {
return z + x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = z + x
end function
public static double code(double x, double y, double z) {
return z + x;
}
def code(x, y, z): return z + x
function code(x, y, z) return Float64(z + x) end
function tmp = code(x, y, z) tmp = z + x; end
code[x_, y_, z_] := N[(z + x), $MachinePrecision]
\begin{array}{l}
\\
z + x
\end{array}
Initial program 99.9%
Taylor expanded in y around 0 63.5%
+-commutative63.5%
Simplified63.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%
+-commutative99.9%
add-cube-cbrt99.6%
associate-*r*99.5%
fma-define99.5%
pow299.5%
Applied egg-rr99.5%
Taylor expanded in x around inf 40.4%
herbie shell --seed 2024107
(FPCore (x y z)
:name "Graphics.Rasterific.Svg.PathConverter:segmentToBezier from rasterific-svg-0.2.3.1, C"
:precision binary64
(+ (+ x (sin y)) (* z (cos y))))