
(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 12 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 (+ (+ (sin y) x) (* (cos y) z)))
double code(double x, double y, double z) {
return (sin(y) + x) + (cos(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 = (sin(y) + x) + (cos(y) * z)
end function
public static double code(double x, double y, double z) {
return (Math.sin(y) + x) + (Math.cos(y) * z);
}
def code(x, y, z): return (math.sin(y) + x) + (math.cos(y) * z)
function code(x, y, z) return Float64(Float64(sin(y) + x) + Float64(cos(y) * z)) end
function tmp = code(x, y, z) tmp = (sin(y) + x) + (cos(y) * z); end
code[x_, y_, z_] := N[(N[(N[Sin[y], $MachinePrecision] + x), $MachinePrecision] + N[(N[Cos[y], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\sin y + x\right) + \cos y \cdot z
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ (+ (sin y) x) (* (cos y) z))))
(if (<= t_0 -50.0)
(+ z x)
(if (<= t_0 -0.1)
(sin y)
(if (<= t_0 1e-20)
(fma (fma (* -0.16666666666666666 y) y 1.0) y (+ z x))
(if (<= t_0 1.0) (sin y) (+ z x)))))))
double code(double x, double y, double z) {
double t_0 = (sin(y) + x) + (cos(y) * z);
double tmp;
if (t_0 <= -50.0) {
tmp = z + x;
} else if (t_0 <= -0.1) {
tmp = sin(y);
} else if (t_0 <= 1e-20) {
tmp = fma(fma((-0.16666666666666666 * y), y, 1.0), y, (z + x));
} else if (t_0 <= 1.0) {
tmp = sin(y);
} else {
tmp = z + x;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(sin(y) + x) + Float64(cos(y) * z)) tmp = 0.0 if (t_0 <= -50.0) tmp = Float64(z + x); elseif (t_0 <= -0.1) tmp = sin(y); elseif (t_0 <= 1e-20) tmp = fma(fma(Float64(-0.16666666666666666 * y), y, 1.0), y, Float64(z + x)); elseif (t_0 <= 1.0) tmp = sin(y); else tmp = Float64(z + x); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[Sin[y], $MachinePrecision] + x), $MachinePrecision] + N[(N[Cos[y], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -50.0], N[(z + x), $MachinePrecision], If[LessEqual[t$95$0, -0.1], N[Sin[y], $MachinePrecision], If[LessEqual[t$95$0, 1e-20], N[(N[(N[(-0.16666666666666666 * y), $MachinePrecision] * y + 1.0), $MachinePrecision] * y + N[(z + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1.0], N[Sin[y], $MachinePrecision], N[(z + x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\sin y + x\right) + \cos y \cdot z\\
\mathbf{if}\;t\_0 \leq -50:\\
\;\;\;\;z + x\\
\mathbf{elif}\;t\_0 \leq -0.1:\\
\;\;\;\;\sin y\\
\mathbf{elif}\;t\_0 \leq 10^{-20}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666 \cdot y, y, 1\right), y, z + x\right)\\
\mathbf{elif}\;t\_0 \leq 1:\\
\;\;\;\;\sin y\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < -50 or 1 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6479.6
Applied rewrites79.6%
if -50 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < -0.10000000000000001 or 9.99999999999999945e-21 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 1Initial program 100.0%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-sin.f6497.0
Applied rewrites97.0%
Taylor expanded in z around 0
Applied rewrites95.7%
if -0.10000000000000001 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 9.99999999999999945e-21Initial program 100.0%
lift-+.f64N/A
flip3-+N/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
flip3-+N/A
lift-+.f64N/A
inv-powN/A
lower-pow.f6499.7
Applied rewrites99.7%
Taylor expanded in y around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in z around 0
Applied rewrites100.0%
Final simplification84.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ (+ (sin y) x) (* (cos y) z))))
(if (<= t_0 -0.1)
(+ z x)
(if (<= t_0 0.0005)
(fma (fma (* -0.16666666666666666 y) y 1.0) y (+ z x))
(+ z x)))))
double code(double x, double y, double z) {
double t_0 = (sin(y) + x) + (cos(y) * z);
double tmp;
if (t_0 <= -0.1) {
tmp = z + x;
} else if (t_0 <= 0.0005) {
tmp = fma(fma((-0.16666666666666666 * y), y, 1.0), y, (z + x));
} else {
tmp = z + x;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(sin(y) + x) + Float64(cos(y) * z)) tmp = 0.0 if (t_0 <= -0.1) tmp = Float64(z + x); elseif (t_0 <= 0.0005) tmp = fma(fma(Float64(-0.16666666666666666 * y), y, 1.0), y, Float64(z + x)); else tmp = Float64(z + x); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[Sin[y], $MachinePrecision] + x), $MachinePrecision] + N[(N[Cos[y], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -0.1], N[(z + x), $MachinePrecision], If[LessEqual[t$95$0, 0.0005], N[(N[(N[(-0.16666666666666666 * y), $MachinePrecision] * y + 1.0), $MachinePrecision] * y + N[(z + x), $MachinePrecision]), $MachinePrecision], N[(z + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\sin y + x\right) + \cos y \cdot z\\
\mathbf{if}\;t\_0 \leq -0.1:\\
\;\;\;\;z + x\\
\mathbf{elif}\;t\_0 \leq 0.0005:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666 \cdot y, y, 1\right), y, z + x\right)\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < -0.10000000000000001 or 5.0000000000000001e-4 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6468.5
Applied rewrites68.5%
if -0.10000000000000001 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 5.0000000000000001e-4Initial program 100.0%
lift-+.f64N/A
flip3-+N/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
flip3-+N/A
lift-+.f64N/A
inv-powN/A
lower-pow.f6499.7
Applied rewrites99.7%
Taylor expanded in y around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in z around 0
Applied rewrites100.0%
Final simplification73.3%
(FPCore (x y z) :precision binary64 (if (<= x -6e-18) (+ z x) (if (<= x 2050000000.0) (fma (cos y) z (sin y)) (+ z x))))
double code(double x, double y, double z) {
double tmp;
if (x <= -6e-18) {
tmp = z + x;
} else if (x <= 2050000000.0) {
tmp = fma(cos(y), z, sin(y));
} else {
tmp = z + x;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= -6e-18) tmp = Float64(z + x); elseif (x <= 2050000000.0) tmp = fma(cos(y), z, sin(y)); else tmp = Float64(z + x); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, -6e-18], N[(z + x), $MachinePrecision], If[LessEqual[x, 2050000000.0], N[(N[Cos[y], $MachinePrecision] * z + N[Sin[y], $MachinePrecision]), $MachinePrecision], N[(z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6 \cdot 10^{-18}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;x \leq 2050000000:\\
\;\;\;\;\mathsf{fma}\left(\cos y, z, \sin y\right)\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if x < -5.99999999999999966e-18 or 2.05e9 < x Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6492.7
Applied rewrites92.7%
if -5.99999999999999966e-18 < x < 2.05e9Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-sin.f6488.9
Applied rewrites88.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (cos y) z)))
(if (<= z -1e+134)
t_0
(if (<= z -3.8e-7) (+ z x) (if (<= z 3.8e+31) (+ (sin y) x) t_0)))))
double code(double x, double y, double z) {
double t_0 = cos(y) * z;
double tmp;
if (z <= -1e+134) {
tmp = t_0;
} else if (z <= -3.8e-7) {
tmp = z + x;
} else if (z <= 3.8e+31) {
tmp = sin(y) + 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 = cos(y) * z
if (z <= (-1d+134)) then
tmp = t_0
else if (z <= (-3.8d-7)) then
tmp = z + x
else if (z <= 3.8d+31) then
tmp = sin(y) + x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.cos(y) * z;
double tmp;
if (z <= -1e+134) {
tmp = t_0;
} else if (z <= -3.8e-7) {
tmp = z + x;
} else if (z <= 3.8e+31) {
tmp = Math.sin(y) + x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = math.cos(y) * z tmp = 0 if z <= -1e+134: tmp = t_0 elif z <= -3.8e-7: tmp = z + x elif z <= 3.8e+31: tmp = math.sin(y) + x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(cos(y) * z) tmp = 0.0 if (z <= -1e+134) tmp = t_0; elseif (z <= -3.8e-7) tmp = Float64(z + x); elseif (z <= 3.8e+31) tmp = Float64(sin(y) + x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = cos(y) * z; tmp = 0.0; if (z <= -1e+134) tmp = t_0; elseif (z <= -3.8e-7) tmp = z + x; elseif (z <= 3.8e+31) tmp = sin(y) + x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Cos[y], $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -1e+134], t$95$0, If[LessEqual[z, -3.8e-7], N[(z + x), $MachinePrecision], If[LessEqual[z, 3.8e+31], N[(N[Sin[y], $MachinePrecision] + x), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos y \cdot z\\
\mathbf{if}\;z \leq -1 \cdot 10^{+134}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -3.8 \cdot 10^{-7}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;z \leq 3.8 \cdot 10^{+31}:\\
\;\;\;\;\sin y + x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -9.99999999999999921e133 or 3.8000000000000001e31 < z Initial program 99.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower-cos.f6482.8
Applied rewrites82.8%
if -9.99999999999999921e133 < z < -3.80000000000000015e-7Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6488.0
Applied rewrites88.0%
if -3.80000000000000015e-7 < z < 3.8000000000000001e31Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lower-sin.f6491.8
Applied rewrites91.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ (sin y) x)))
(if (<= y -1.65e+43)
t_0
(if (<= y 1.1e+28)
(fma (fma (fma -0.16666666666666666 y (* -0.5 z)) y 1.0) y (+ z x))
t_0))))
double code(double x, double y, double z) {
double t_0 = sin(y) + x;
double tmp;
if (y <= -1.65e+43) {
tmp = t_0;
} else if (y <= 1.1e+28) {
tmp = fma(fma(fma(-0.16666666666666666, y, (-0.5 * z)), y, 1.0), y, (z + x));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(sin(y) + x) tmp = 0.0 if (y <= -1.65e+43) tmp = t_0; elseif (y <= 1.1e+28) tmp = fma(fma(fma(-0.16666666666666666, y, Float64(-0.5 * z)), y, 1.0), y, Float64(z + x)); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Sin[y], $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[y, -1.65e+43], t$95$0, If[LessEqual[y, 1.1e+28], N[(N[(N[(-0.16666666666666666 * y + N[(-0.5 * z), $MachinePrecision]), $MachinePrecision] * y + 1.0), $MachinePrecision] * y + N[(z + x), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin y + x\\
\mathbf{if}\;y \leq -1.65 \cdot 10^{+43}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.1 \cdot 10^{+28}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, y, -0.5 \cdot z\right), y, 1\right), y, z + x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -1.6500000000000001e43 or 1.09999999999999993e28 < y Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lower-sin.f6471.1
Applied rewrites71.1%
if -1.6500000000000001e43 < y < 1.09999999999999993e28Initial program 100.0%
Taylor expanded in y around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f6496.1
Applied rewrites96.1%
(FPCore (x y z)
:precision binary64
(if (<= y -1.65e+43)
(+ z x)
(if (<= y 17.5)
(fma (fma (fma -0.16666666666666666 y (* -0.5 z)) y 1.0) y (+ z x))
(+ z x))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.65e+43) {
tmp = z + x;
} else if (y <= 17.5) {
tmp = fma(fma(fma(-0.16666666666666666, y, (-0.5 * z)), y, 1.0), y, (z + x));
} else {
tmp = z + x;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -1.65e+43) tmp = Float64(z + x); elseif (y <= 17.5) tmp = fma(fma(fma(-0.16666666666666666, y, Float64(-0.5 * z)), y, 1.0), y, Float64(z + x)); else tmp = Float64(z + x); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -1.65e+43], N[(z + x), $MachinePrecision], If[LessEqual[y, 17.5], N[(N[(N[(-0.16666666666666666 * y + N[(-0.5 * z), $MachinePrecision]), $MachinePrecision] * y + 1.0), $MachinePrecision] * y + N[(z + x), $MachinePrecision]), $MachinePrecision], N[(z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.65 \cdot 10^{+43}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;y \leq 17.5:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, y, -0.5 \cdot z\right), y, 1\right), y, z + x\right)\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if y < -1.6500000000000001e43 or 17.5 < y Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6444.3
Applied rewrites44.3%
if -1.6500000000000001e43 < y < 17.5Initial program 100.0%
Taylor expanded in y around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f6497.4
Applied rewrites97.4%
(FPCore (x y z) :precision binary64 (if (<= y -1.75e+43) (+ z x) (if (<= y 3.6e+46) (fma (fma (* -0.5 y) z 1.0) y (+ z x)) (+ z x))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.75e+43) {
tmp = z + x;
} else if (y <= 3.6e+46) {
tmp = fma(fma((-0.5 * y), z, 1.0), y, (z + x));
} else {
tmp = z + x;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -1.75e+43) tmp = Float64(z + x); elseif (y <= 3.6e+46) tmp = fma(fma(Float64(-0.5 * y), z, 1.0), y, Float64(z + x)); else tmp = Float64(z + x); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -1.75e+43], N[(z + x), $MachinePrecision], If[LessEqual[y, 3.6e+46], N[(N[(N[(-0.5 * y), $MachinePrecision] * z + 1.0), $MachinePrecision] * y + N[(z + x), $MachinePrecision]), $MachinePrecision], N[(z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.75 \cdot 10^{+43}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;y \leq 3.6 \cdot 10^{+46}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.5 \cdot y, z, 1\right), y, z + x\right)\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if y < -1.7500000000000001e43 or 3.5999999999999999e46 < y Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6445.2
Applied rewrites45.2%
if -1.7500000000000001e43 < y < 3.5999999999999999e46Initial program 100.0%
Taylor expanded in y around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
+-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f6493.8
Applied rewrites93.8%
(FPCore (x y z) :precision binary64 (if (<= y -2.8e+113) (+ z x) (if (<= y 1.35e+67) (+ (+ y x) z) (+ z x))))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.8e+113) {
tmp = z + x;
} else if (y <= 1.35e+67) {
tmp = (y + x) + z;
} else {
tmp = z + 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 <= (-2.8d+113)) then
tmp = z + x
else if (y <= 1.35d+67) then
tmp = (y + x) + z
else
tmp = z + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -2.8e+113) {
tmp = z + x;
} else if (y <= 1.35e+67) {
tmp = (y + x) + z;
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.8e+113: tmp = z + x elif y <= 1.35e+67: tmp = (y + x) + z else: tmp = z + x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.8e+113) tmp = Float64(z + x); elseif (y <= 1.35e+67) tmp = Float64(Float64(y + x) + z); else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -2.8e+113) tmp = z + x; elseif (y <= 1.35e+67) tmp = (y + x) + z; else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.8e+113], N[(z + x), $MachinePrecision], If[LessEqual[y, 1.35e+67], N[(N[(y + x), $MachinePrecision] + z), $MachinePrecision], N[(z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.8 \cdot 10^{+113}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+67}:\\
\;\;\;\;\left(y + x\right) + z\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if y < -2.79999999999999998e113 or 1.35e67 < y Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6442.1
Applied rewrites42.1%
if -2.79999999999999998e113 < y < 1.35e67Initial program 100.0%
Taylor expanded in y around 0
associate-+r+N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6490.2
Applied rewrites90.2%
(FPCore (x y z) :precision binary64 (if (<= x -2.15e-129) (+ z x) (if (<= x 3.7e-144) (+ z y) (+ z x))))
double code(double x, double y, double z) {
double tmp;
if (x <= -2.15e-129) {
tmp = z + x;
} else if (x <= 3.7e-144) {
tmp = z + y;
} else {
tmp = z + 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 <= (-2.15d-129)) then
tmp = z + x
else if (x <= 3.7d-144) then
tmp = z + y
else
tmp = z + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -2.15e-129) {
tmp = z + x;
} else if (x <= 3.7e-144) {
tmp = z + y;
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -2.15e-129: tmp = z + x elif x <= 3.7e-144: tmp = z + y else: tmp = z + x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -2.15e-129) tmp = Float64(z + x); elseif (x <= 3.7e-144) tmp = Float64(z + y); else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -2.15e-129) tmp = z + x; elseif (x <= 3.7e-144) tmp = z + y; else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -2.15e-129], N[(z + x), $MachinePrecision], If[LessEqual[x, 3.7e-144], N[(z + y), $MachinePrecision], N[(z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.15 \cdot 10^{-129}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;x \leq 3.7 \cdot 10^{-144}:\\
\;\;\;\;z + y\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if x < -2.1499999999999999e-129 or 3.7000000000000003e-144 < x Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6477.3
Applied rewrites77.3%
if -2.1499999999999999e-129 < x < 3.7000000000000003e-144Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-sin.f6498.1
Applied rewrites98.1%
Taylor expanded in y around 0
Applied rewrites53.2%
(FPCore (x y z) :precision binary64 (if (<= x -3e-11) (+ y x) (if (<= x 1e+73) (+ z y) (+ y x))))
double code(double x, double y, double z) {
double tmp;
if (x <= -3e-11) {
tmp = y + x;
} else if (x <= 1e+73) {
tmp = z + y;
} else {
tmp = y + x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-3d-11)) then
tmp = y + x
else if (x <= 1d+73) then
tmp = z + y
else
tmp = y + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -3e-11) {
tmp = y + x;
} else if (x <= 1e+73) {
tmp = z + y;
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -3e-11: tmp = y + x elif x <= 1e+73: tmp = z + y else: tmp = y + x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -3e-11) tmp = Float64(y + x); elseif (x <= 1e+73) tmp = Float64(z + y); else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -3e-11) tmp = y + x; elseif (x <= 1e+73) tmp = z + y; else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -3e-11], N[(y + x), $MachinePrecision], If[LessEqual[x, 1e+73], N[(z + y), $MachinePrecision], N[(y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3 \cdot 10^{-11}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;x \leq 10^{+73}:\\
\;\;\;\;z + y\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if x < -3e-11 or 9.99999999999999983e72 < x Initial program 100.0%
Taylor expanded in y around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
+-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f6464.8
Applied rewrites64.8%
Taylor expanded in z around 0
Applied rewrites65.0%
if -3e-11 < x < 9.99999999999999983e72Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-sin.f6484.2
Applied rewrites84.2%
Taylor expanded in y around 0
Applied rewrites42.3%
(FPCore (x y z) :precision binary64 (+ z y))
double code(double x, double y, double z) {
return z + y;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = z + y
end function
public static double code(double x, double y, double z) {
return z + y;
}
def code(x, y, z): return z + y
function code(x, y, z) return Float64(z + y) end
function tmp = code(x, y, z) tmp = z + y; end
code[x_, y_, z_] := N[(z + y), $MachinePrecision]
\begin{array}{l}
\\
z + y
\end{array}
Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-sin.f6455.6
Applied rewrites55.6%
Taylor expanded in y around 0
Applied rewrites29.2%
herbie shell --seed 2024278
(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))))