
(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 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * sin(y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
(FPCore (x y z) :precision binary64 (fma (sin y) (- z) (+ x (cos y))))
double code(double x, double y, double z) {
return fma(sin(y), -z, (x + cos(y)));
}
function code(x, y, z) return fma(sin(y), Float64(-z), Float64(x + cos(y))) end
code[x_, y_, z_] := N[(N[Sin[y], $MachinePrecision] * (-z) + N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\sin y, -z, x + \cos y\right)
\end{array}
Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-define99.9%
Applied egg-rr99.9%
(FPCore (x y z) :precision binary64 (if (or (<= x -2.7e-9) (not (<= x 0.0088))) (fma (sin y) (- z) (+ x 1.0)) (- (cos y) (* (sin y) z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -2.7e-9) || !(x <= 0.0088)) {
tmp = fma(sin(y), -z, (x + 1.0));
} else {
tmp = cos(y) - (sin(y) * z);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((x <= -2.7e-9) || !(x <= 0.0088)) tmp = fma(sin(y), Float64(-z), Float64(x + 1.0)); else tmp = Float64(cos(y) - Float64(sin(y) * z)); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[x, -2.7e-9], N[Not[LessEqual[x, 0.0088]], $MachinePrecision]], N[(N[Sin[y], $MachinePrecision] * (-z) + N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[Cos[y], $MachinePrecision] - N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.7 \cdot 10^{-9} \lor \neg \left(x \leq 0.0088\right):\\
\;\;\;\;\mathsf{fma}\left(\sin y, -z, x + 1\right)\\
\mathbf{else}:\\
\;\;\;\;\cos y - \sin y \cdot z\\
\end{array}
\end{array}
if x < -2.7000000000000002e-9 or 0.00880000000000000053 < x Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-define100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 99.0%
if -2.7000000000000002e-9 < x < 0.00880000000000000053Initial program 99.9%
Taylor expanded in x around 0 99.1%
Final simplification99.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (sin y) z)))
(if (or (<= x -1e-8) (not (<= x 0.0088)))
(- (+ x 1.0) t_0)
(- (cos y) t_0))))
double code(double x, double y, double z) {
double t_0 = sin(y) * z;
double tmp;
if ((x <= -1e-8) || !(x <= 0.0088)) {
tmp = (x + 1.0) - t_0;
} else {
tmp = cos(y) - 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 = sin(y) * z
if ((x <= (-1d-8)) .or. (.not. (x <= 0.0088d0))) then
tmp = (x + 1.0d0) - t_0
else
tmp = cos(y) - t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.sin(y) * z;
double tmp;
if ((x <= -1e-8) || !(x <= 0.0088)) {
tmp = (x + 1.0) - t_0;
} else {
tmp = Math.cos(y) - t_0;
}
return tmp;
}
def code(x, y, z): t_0 = math.sin(y) * z tmp = 0 if (x <= -1e-8) or not (x <= 0.0088): tmp = (x + 1.0) - t_0 else: tmp = math.cos(y) - t_0 return tmp
function code(x, y, z) t_0 = Float64(sin(y) * z) tmp = 0.0 if ((x <= -1e-8) || !(x <= 0.0088)) tmp = Float64(Float64(x + 1.0) - t_0); else tmp = Float64(cos(y) - t_0); end return tmp end
function tmp_2 = code(x, y, z) t_0 = sin(y) * z; tmp = 0.0; if ((x <= -1e-8) || ~((x <= 0.0088))) tmp = (x + 1.0) - t_0; else tmp = cos(y) - t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision]}, If[Or[LessEqual[x, -1e-8], N[Not[LessEqual[x, 0.0088]], $MachinePrecision]], N[(N[(x + 1.0), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[Cos[y], $MachinePrecision] - t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin y \cdot z\\
\mathbf{if}\;x \leq -1 \cdot 10^{-8} \lor \neg \left(x \leq 0.0088\right):\\
\;\;\;\;\left(x + 1\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\cos y - t\_0\\
\end{array}
\end{array}
if x < -1e-8 or 0.00880000000000000053 < x Initial program 99.9%
Taylor expanded in y around 0 99.0%
if -1e-8 < x < 0.00880000000000000053Initial program 99.9%
Taylor expanded in x around 0 99.1%
Final simplification99.0%
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* (sin y) z)))
double code(double x, double y, double z) {
return (x + cos(y)) - (sin(y) * z);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + cos(y)) - (sin(y) * z)
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (Math.sin(y) * z);
}
def code(x, y, z): return (x + math.cos(y)) - (math.sin(y) * z)
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(sin(y) * z)) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (sin(y) * z); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - \sin y \cdot z
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (sin y) (- z))))
(if (<= z -5.5e+200)
t_0
(if (<= z -2.6e+21)
(+ 1.0 (- x (* y z)))
(if (<= z 9.5e+110) (+ x (cos y)) t_0)))))
double code(double x, double y, double z) {
double t_0 = sin(y) * -z;
double tmp;
if (z <= -5.5e+200) {
tmp = t_0;
} else if (z <= -2.6e+21) {
tmp = 1.0 + (x - (y * z));
} else if (z <= 9.5e+110) {
tmp = x + cos(y);
} 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 = sin(y) * -z
if (z <= (-5.5d+200)) then
tmp = t_0
else if (z <= (-2.6d+21)) then
tmp = 1.0d0 + (x - (y * z))
else if (z <= 9.5d+110) then
tmp = x + cos(y)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.sin(y) * -z;
double tmp;
if (z <= -5.5e+200) {
tmp = t_0;
} else if (z <= -2.6e+21) {
tmp = 1.0 + (x - (y * z));
} else if (z <= 9.5e+110) {
tmp = x + Math.cos(y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = math.sin(y) * -z tmp = 0 if z <= -5.5e+200: tmp = t_0 elif z <= -2.6e+21: tmp = 1.0 + (x - (y * z)) elif z <= 9.5e+110: tmp = x + math.cos(y) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(sin(y) * Float64(-z)) tmp = 0.0 if (z <= -5.5e+200) tmp = t_0; elseif (z <= -2.6e+21) tmp = Float64(1.0 + Float64(x - Float64(y * z))); elseif (z <= 9.5e+110) tmp = Float64(x + cos(y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = sin(y) * -z; tmp = 0.0; if (z <= -5.5e+200) tmp = t_0; elseif (z <= -2.6e+21) tmp = 1.0 + (x - (y * z)); elseif (z <= 9.5e+110) tmp = x + cos(y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Sin[y], $MachinePrecision] * (-z)), $MachinePrecision]}, If[LessEqual[z, -5.5e+200], t$95$0, If[LessEqual[z, -2.6e+21], N[(1.0 + N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9.5e+110], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin y \cdot \left(-z\right)\\
\mathbf{if}\;z \leq -5.5 \cdot 10^{+200}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -2.6 \cdot 10^{+21}:\\
\;\;\;\;1 + \left(x - y \cdot z\right)\\
\mathbf{elif}\;z \leq 9.5 \cdot 10^{+110}:\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -5.5e200 or 9.49999999999999939e110 < z Initial program 99.8%
Taylor expanded in z around inf 71.9%
mul-1-neg71.9%
distribute-rgt-neg-out71.9%
Simplified71.9%
if -5.5e200 < z < -2.6e21Initial program 100.0%
Taylor expanded in y around 0 68.5%
mul-1-neg68.5%
unsub-neg68.5%
Simplified68.5%
if -2.6e21 < z < 9.49999999999999939e110Initial program 100.0%
Taylor expanded in z around 0 93.2%
+-commutative93.2%
Simplified93.2%
Final simplification83.3%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.92e+21) (not (<= z 0.78))) (- (+ x 1.0) (* (sin y) z)) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.92e+21) || !(z <= 0.78)) {
tmp = (x + 1.0) - (sin(y) * z);
} 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.92d+21)) .or. (.not. (z <= 0.78d0))) then
tmp = (x + 1.0d0) - (sin(y) * z)
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.92e+21) || !(z <= 0.78)) {
tmp = (x + 1.0) - (Math.sin(y) * z);
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.92e+21) or not (z <= 0.78): tmp = (x + 1.0) - (math.sin(y) * z) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.92e+21) || !(z <= 0.78)) tmp = Float64(Float64(x + 1.0) - Float64(sin(y) * z)); else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.92e+21) || ~((z <= 0.78))) tmp = (x + 1.0) - (sin(y) * z); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.92e+21], N[Not[LessEqual[z, 0.78]], $MachinePrecision]], N[(N[(x + 1.0), $MachinePrecision] - N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.92 \cdot 10^{+21} \lor \neg \left(z \leq 0.78\right):\\
\;\;\;\;\left(x + 1\right) - \sin y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -1.92e21 or 0.78000000000000003 < z Initial program 99.9%
Taylor expanded in y around 0 98.5%
if -1.92e21 < z < 0.78000000000000003Initial program 100.0%
Taylor expanded in z around 0 99.1%
+-commutative99.1%
Simplified99.1%
Final simplification98.8%
(FPCore (x y z) :precision binary64 (if (or (<= z -7.2e+44) (not (<= z 2e+108))) (- 1.0 (* (sin y) z)) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -7.2e+44) || !(z <= 2e+108)) {
tmp = 1.0 - (sin(y) * z);
} 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 <= (-7.2d+44)) .or. (.not. (z <= 2d+108))) then
tmp = 1.0d0 - (sin(y) * z)
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 <= -7.2e+44) || !(z <= 2e+108)) {
tmp = 1.0 - (Math.sin(y) * z);
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -7.2e+44) or not (z <= 2e+108): tmp = 1.0 - (math.sin(y) * z) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -7.2e+44) || !(z <= 2e+108)) tmp = Float64(1.0 - Float64(sin(y) * z)); else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -7.2e+44) || ~((z <= 2e+108))) tmp = 1.0 - (sin(y) * z); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -7.2e+44], N[Not[LessEqual[z, 2e+108]], $MachinePrecision]], N[(1.0 - N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.2 \cdot 10^{+44} \lor \neg \left(z \leq 2 \cdot 10^{+108}\right):\\
\;\;\;\;1 - \sin y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -7.2e44 or 2.0000000000000001e108 < z Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-define99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 99.9%
Taylor expanded in x around 0 76.9%
neg-mul-176.9%
sub-neg76.9%
Simplified76.9%
if -7.2e44 < z < 2.0000000000000001e108Initial program 100.0%
Taylor expanded in z around 0 92.7%
+-commutative92.7%
Simplified92.7%
Final simplification86.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -4.8e+42) (not (<= y 5e-9))) (+ x (cos y)) (+ 1.0 (- x (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -4.8e+42) || !(y <= 5e-9)) {
tmp = x + cos(y);
} 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 <= (-4.8d+42)) .or. (.not. (y <= 5d-9))) then
tmp = x + cos(y)
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 <= -4.8e+42) || !(y <= 5e-9)) {
tmp = x + Math.cos(y);
} else {
tmp = 1.0 + (x - (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -4.8e+42) or not (y <= 5e-9): tmp = x + math.cos(y) else: tmp = 1.0 + (x - (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -4.8e+42) || !(y <= 5e-9)) tmp = Float64(x + cos(y)); 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 <= -4.8e+42) || ~((y <= 5e-9))) tmp = x + cos(y); else tmp = 1.0 + (x - (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -4.8e+42], N[Not[LessEqual[y, 5e-9]], $MachinePrecision]], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.8 \cdot 10^{+42} \lor \neg \left(y \leq 5 \cdot 10^{-9}\right):\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x - y \cdot z\right)\\
\end{array}
\end{array}
if y < -4.7999999999999997e42 or 5.0000000000000001e-9 < y Initial program 99.9%
Taylor expanded in z around 0 52.3%
+-commutative52.3%
Simplified52.3%
if -4.7999999999999997e42 < y < 5.0000000000000001e-9Initial program 100.0%
Taylor expanded in y around 0 96.8%
mul-1-neg96.8%
unsub-neg96.8%
Simplified96.8%
Final simplification76.5%
(FPCore (x y z) :precision binary64 (if (<= y -2.5e+28) (+ x 1.0) (if (<= y 5.8e+100) (+ 1.0 (- x (* y z))) (cos y))))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.5e+28) {
tmp = x + 1.0;
} else if (y <= 5.8e+100) {
tmp = 1.0 + (x - (y * z));
} 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 (y <= (-2.5d+28)) then
tmp = x + 1.0d0
else if (y <= 5.8d+100) then
tmp = 1.0d0 + (x - (y * z))
else
tmp = cos(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -2.5e+28) {
tmp = x + 1.0;
} else if (y <= 5.8e+100) {
tmp = 1.0 + (x - (y * z));
} else {
tmp = Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.5e+28: tmp = x + 1.0 elif y <= 5.8e+100: tmp = 1.0 + (x - (y * z)) else: tmp = math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.5e+28) tmp = Float64(x + 1.0); elseif (y <= 5.8e+100) tmp = Float64(1.0 + Float64(x - Float64(y * z))); else tmp = cos(y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -2.5e+28) tmp = x + 1.0; elseif (y <= 5.8e+100) tmp = 1.0 + (x - (y * z)); else tmp = cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.5e+28], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 5.8e+100], N[(1.0 + N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Cos[y], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.5 \cdot 10^{+28}:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;y \leq 5.8 \cdot 10^{+100}:\\
\;\;\;\;1 + \left(x - y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\cos y\\
\end{array}
\end{array}
if y < -2.49999999999999979e28Initial program 99.9%
Taylor expanded in y around 0 36.5%
+-commutative36.5%
Simplified36.5%
if -2.49999999999999979e28 < y < 5.8000000000000001e100Initial program 99.9%
Taylor expanded in y around 0 90.2%
mul-1-neg90.2%
unsub-neg90.2%
Simplified90.2%
if 5.8000000000000001e100 < y Initial program 99.9%
Taylor expanded in z around 0 60.4%
+-commutative60.4%
Simplified60.4%
Taylor expanded in x around 0 42.0%
(FPCore (x y z) :precision binary64 (if (<= y -7.5e+29) (+ x 1.0) (if (<= y 1.25e+77) (+ 1.0 (- x (* y z))) (* x (+ 1.0 (/ 1.0 x))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -7.5e+29) {
tmp = x + 1.0;
} else if (y <= 1.25e+77) {
tmp = 1.0 + (x - (y * z));
} else {
tmp = x * (1.0 + (1.0 / 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+29)) then
tmp = x + 1.0d0
else if (y <= 1.25d+77) then
tmp = 1.0d0 + (x - (y * z))
else
tmp = x * (1.0d0 + (1.0d0 / x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -7.5e+29) {
tmp = x + 1.0;
} else if (y <= 1.25e+77) {
tmp = 1.0 + (x - (y * z));
} else {
tmp = x * (1.0 + (1.0 / x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -7.5e+29: tmp = x + 1.0 elif y <= 1.25e+77: tmp = 1.0 + (x - (y * z)) else: tmp = x * (1.0 + (1.0 / x)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -7.5e+29) tmp = Float64(x + 1.0); elseif (y <= 1.25e+77) tmp = Float64(1.0 + Float64(x - Float64(y * z))); else tmp = Float64(x * Float64(1.0 + Float64(1.0 / x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -7.5e+29) tmp = x + 1.0; elseif (y <= 1.25e+77) tmp = 1.0 + (x - (y * z)); else tmp = x * (1.0 + (1.0 / x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -7.5e+29], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 1.25e+77], N[(1.0 + N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.5 \cdot 10^{+29}:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;y \leq 1.25 \cdot 10^{+77}:\\
\;\;\;\;1 + \left(x - y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 + \frac{1}{x}\right)\\
\end{array}
\end{array}
if y < -7.49999999999999945e29Initial program 99.9%
Taylor expanded in y around 0 36.5%
+-commutative36.5%
Simplified36.5%
if -7.49999999999999945e29 < y < 1.25000000000000001e77Initial program 99.9%
Taylor expanded in y around 0 90.7%
mul-1-neg90.7%
unsub-neg90.7%
Simplified90.7%
if 1.25000000000000001e77 < y Initial program 99.9%
Taylor expanded in x around inf 83.1%
Taylor expanded in y around 0 25.7%
(FPCore (x y z) :precision binary64 (if (<= x -3.6e-19) x (if (<= x 1.0) 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -3.6e-19) {
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.6d-19)) 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.6e-19) {
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.6e-19: 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.6e-19) 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.6e-19) 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.6e-19], x, If[LessEqual[x, 1.0], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.6 \cdot 10^{-19}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -3.6000000000000001e-19 or 1 < x Initial program 100.0%
Taylor expanded in x around inf 74.5%
if -3.6000000000000001e-19 < x < 1Initial program 99.9%
Taylor expanded in y around 0 41.0%
+-commutative41.0%
Simplified41.0%
Taylor expanded in x around 0 41.0%
(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 57.9%
+-commutative57.9%
Simplified57.9%
(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 y around 0 57.9%
+-commutative57.9%
Simplified57.9%
Taylor expanded in x around 0 22.5%
herbie shell --seed 2024132
(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))))