
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * sin(y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * sin(y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
(FPCore (x y z) :precision binary64 (fma (sin y) (- z) (+ (cos y) x)))
double code(double x, double y, double z) {
return fma(sin(y), -z, (cos(y) + x));
}
function code(x, y, z) return fma(sin(y), Float64(-z), Float64(cos(y) + x)) end
code[x_, y_, z_] := N[(N[Sin[y], $MachinePrecision] * (-z) + N[(N[Cos[y], $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\sin y, -z, \cos y + x\right)
\end{array}
Initial program 99.9%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (sin y))))
(if (<= x -1.6e-8)
(fma (sin y) (- z) (+ 1.0 x))
(if (<= x 6.6e-6) (- (cos y) t_0) (- (+ x 1.0) t_0)))))
double code(double x, double y, double z) {
double t_0 = z * sin(y);
double tmp;
if (x <= -1.6e-8) {
tmp = fma(sin(y), -z, (1.0 + x));
} else if (x <= 6.6e-6) {
tmp = cos(y) - t_0;
} else {
tmp = (x + 1.0) - t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(z * sin(y)) tmp = 0.0 if (x <= -1.6e-8) tmp = fma(sin(y), Float64(-z), Float64(1.0 + x)); elseif (x <= 6.6e-6) tmp = Float64(cos(y) - t_0); else tmp = Float64(Float64(x + 1.0) - t_0); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.6e-8], N[(N[Sin[y], $MachinePrecision] * (-z) + N[(1.0 + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 6.6e-6], N[(N[Cos[y], $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(x + 1.0), $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \sin y\\
\mathbf{if}\;x \leq -1.6 \cdot 10^{-8}:\\
\;\;\;\;\mathsf{fma}\left(\sin y, -z, 1 + x\right)\\
\mathbf{elif}\;x \leq 6.6 \cdot 10^{-6}:\\
\;\;\;\;\cos y - t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(x + 1\right) - t\_0\\
\end{array}
\end{array}
if x < -1.6000000000000001e-8Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites99.3%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
lift-neg.f64N/A
*-commutativeN/A
lower-fma.f6499.3
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.3
Applied rewrites99.3%
if -1.6000000000000001e-8 < x < 6.60000000000000034e-6Initial program 99.9%
Taylor expanded in x around 0
lower-cos.f6499.1
Applied rewrites99.1%
if 6.60000000000000034e-6 < x Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites100.0%
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * sin(y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
Initial program 99.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -7.5e-106) (not (<= z 6e-123))) (- (+ x 1.0) (* z (sin y))) (- (+ x (cos y)) (* z y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -7.5e-106) || !(z <= 6e-123)) {
tmp = (x + 1.0) - (z * sin(y));
} else {
tmp = (x + cos(y)) - (z * y);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-7.5d-106)) .or. (.not. (z <= 6d-123))) then
tmp = (x + 1.0d0) - (z * sin(y))
else
tmp = (x + cos(y)) - (z * y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -7.5e-106) || !(z <= 6e-123)) {
tmp = (x + 1.0) - (z * Math.sin(y));
} else {
tmp = (x + Math.cos(y)) - (z * y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -7.5e-106) or not (z <= 6e-123): tmp = (x + 1.0) - (z * math.sin(y)) else: tmp = (x + math.cos(y)) - (z * y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -7.5e-106) || !(z <= 6e-123)) tmp = Float64(Float64(x + 1.0) - Float64(z * sin(y))); else tmp = Float64(Float64(x + cos(y)) - Float64(z * y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -7.5e-106) || ~((z <= 6e-123))) tmp = (x + 1.0) - (z * sin(y)); else tmp = (x + cos(y)) - (z * y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -7.5e-106], N[Not[LessEqual[z, 6e-123]], $MachinePrecision]], N[(N[(x + 1.0), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{-106} \lor \neg \left(z \leq 6 \cdot 10^{-123}\right):\\
\;\;\;\;\left(x + 1\right) - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;\left(x + \cos y\right) - z \cdot y\\
\end{array}
\end{array}
if z < -7.5000000000000002e-106 or 5.99999999999999968e-123 < z Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites95.7%
if -7.5000000000000002e-106 < z < 5.99999999999999968e-123Initial program 100.0%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f6495.3
Applied rewrites95.3%
Final simplification95.6%
(FPCore (x y z) :precision binary64 (if (<= z -7.5e-106) (fma (sin y) (- z) (+ 1.0 x)) (if (<= z 6e-123) (- (+ x (cos y)) (* z y)) (- (+ x 1.0) (* z (sin y))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -7.5e-106) {
tmp = fma(sin(y), -z, (1.0 + x));
} else if (z <= 6e-123) {
tmp = (x + cos(y)) - (z * y);
} else {
tmp = (x + 1.0) - (z * sin(y));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= -7.5e-106) tmp = fma(sin(y), Float64(-z), Float64(1.0 + x)); elseif (z <= 6e-123) tmp = Float64(Float64(x + cos(y)) - Float64(z * y)); else tmp = Float64(Float64(x + 1.0) - Float64(z * sin(y))); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, -7.5e-106], N[(N[Sin[y], $MachinePrecision] * (-z) + N[(1.0 + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6e-123], N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision], N[(N[(x + 1.0), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{-106}:\\
\;\;\;\;\mathsf{fma}\left(\sin y, -z, 1 + x\right)\\
\mathbf{elif}\;z \leq 6 \cdot 10^{-123}:\\
\;\;\;\;\left(x + \cos y\right) - z \cdot y\\
\mathbf{else}:\\
\;\;\;\;\left(x + 1\right) - z \cdot \sin y\\
\end{array}
\end{array}
if z < -7.5000000000000002e-106Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites96.9%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
lift-neg.f64N/A
*-commutativeN/A
lower-fma.f6496.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6496.9
Applied rewrites96.9%
if -7.5000000000000002e-106 < z < 5.99999999999999968e-123Initial program 100.0%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f6495.3
Applied rewrites95.3%
if 5.99999999999999968e-123 < z Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites94.3%
(FPCore (x y z) :precision binary64 (if (or (<= y -3.7e+34) (not (<= y 5.5e+23))) (* (- z) (sin y)) (fma (- z) y (+ 1.0 x))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3.7e+34) || !(y <= 5.5e+23)) {
tmp = -z * sin(y);
} else {
tmp = fma(-z, y, (1.0 + x));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((y <= -3.7e+34) || !(y <= 5.5e+23)) tmp = Float64(Float64(-z) * sin(y)); else tmp = fma(Float64(-z), y, Float64(1.0 + x)); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[y, -3.7e+34], N[Not[LessEqual[y, 5.5e+23]], $MachinePrecision]], N[((-z) * N[Sin[y], $MachinePrecision]), $MachinePrecision], N[((-z) * y + N[(1.0 + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.7 \cdot 10^{+34} \lor \neg \left(y \leq 5.5 \cdot 10^{+23}\right):\\
\;\;\;\;\left(-z\right) \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-z, y, 1 + x\right)\\
\end{array}
\end{array}
if y < -3.70000000000000009e34 or 5.50000000000000004e23 < y Initial program 99.9%
Taylor expanded in z around inf
mul-1-negN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-sin.f6446.7
Applied rewrites46.7%
if -3.70000000000000009e34 < y < 5.50000000000000004e23Initial program 100.0%
Taylor expanded in y around 0
associate-+r+N/A
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower-+.f6494.4
Applied rewrites94.4%
Final simplification74.8%
(FPCore (x y z) :precision binary64 (- (+ x 1.0) (* z (sin y))))
double code(double x, double y, double z) {
return (x + 1.0) - (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 + 1.0d0) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + 1.0) - (z * Math.sin(y));
}
def code(x, y, z): return (x + 1.0) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + 1.0) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + 1.0) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + 1.0), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + 1\right) - z \cdot \sin y
\end{array}
Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites91.2%
(FPCore (x y z) :precision binary64 (if (or (<= y -15000000000000.0) (not (<= y 23.5))) (+ 1.0 x) (fma (fma (- (* 0.16666666666666666 (* z y)) 0.5) y (- z)) y (- x -1.0))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -15000000000000.0) || !(y <= 23.5)) {
tmp = 1.0 + x;
} else {
tmp = fma(fma(((0.16666666666666666 * (z * y)) - 0.5), y, -z), y, (x - -1.0));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((y <= -15000000000000.0) || !(y <= 23.5)) tmp = Float64(1.0 + x); else tmp = fma(fma(Float64(Float64(0.16666666666666666 * Float64(z * y)) - 0.5), y, Float64(-z)), y, Float64(x - -1.0)); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[y, -15000000000000.0], N[Not[LessEqual[y, 23.5]], $MachinePrecision]], N[(1.0 + x), $MachinePrecision], N[(N[(N[(N[(0.16666666666666666 * N[(z * y), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision] * y + (-z)), $MachinePrecision] * y + N[(x - -1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -15000000000000 \lor \neg \left(y \leq 23.5\right):\\
\;\;\;\;1 + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666 \cdot \left(z \cdot y\right) - 0.5, y, -z\right), y, x - -1\right)\\
\end{array}
\end{array}
if y < -1.5e13 or 23.5 < y Initial program 99.9%
Taylor expanded in y around 0
lower-+.f6438.8
Applied rewrites38.8%
if -1.5e13 < y < 23.5Initial program 100.0%
Taylor expanded in y around 0
lower-+.f6477.6
Applied rewrites77.6%
Taylor expanded in y around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
+-commutativeN/A
rgt-mult-inverseN/A
cancel-sign-subN/A
distribute-lft-neg-outN/A
rgt-mult-inverseN/A
metadata-evalN/A
lower--.f6497.3
Applied rewrites97.3%
Final simplification70.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -66.0) (not (<= y 540.0))) (+ 1.0 x) (fma (- (* -0.5 y) z) y (+ 1.0 x))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -66.0) || !(y <= 540.0)) {
tmp = 1.0 + x;
} else {
tmp = fma(((-0.5 * y) - z), y, (1.0 + x));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((y <= -66.0) || !(y <= 540.0)) tmp = Float64(1.0 + x); else tmp = fma(Float64(Float64(-0.5 * y) - z), y, Float64(1.0 + x)); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[y, -66.0], N[Not[LessEqual[y, 540.0]], $MachinePrecision]], N[(1.0 + x), $MachinePrecision], N[(N[(N[(-0.5 * y), $MachinePrecision] - z), $MachinePrecision] * y + N[(1.0 + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -66 \lor \neg \left(y \leq 540\right):\\
\;\;\;\;1 + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.5 \cdot y - z, y, 1 + x\right)\\
\end{array}
\end{array}
if y < -66 or 540 < y Initial program 99.9%
Taylor expanded in y around 0
lower-+.f6438.8
Applied rewrites38.8%
if -66 < y < 540Initial program 100.0%
Taylor expanded in y around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f6498.3
Applied rewrites98.3%
Final simplification70.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -34.0) (not (<= y 2.8e+80))) (+ 1.0 x) (fma (- z) y (+ 1.0 x))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -34.0) || !(y <= 2.8e+80)) {
tmp = 1.0 + x;
} else {
tmp = fma(-z, y, (1.0 + x));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((y <= -34.0) || !(y <= 2.8e+80)) tmp = Float64(1.0 + x); else tmp = fma(Float64(-z), y, Float64(1.0 + x)); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[y, -34.0], N[Not[LessEqual[y, 2.8e+80]], $MachinePrecision]], N[(1.0 + x), $MachinePrecision], N[((-z) * y + N[(1.0 + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -34 \lor \neg \left(y \leq 2.8 \cdot 10^{+80}\right):\\
\;\;\;\;1 + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-z, y, 1 + x\right)\\
\end{array}
\end{array}
if y < -34 or 2.79999999999999984e80 < y Initial program 99.8%
Taylor expanded in y around 0
lower-+.f6439.0
Applied rewrites39.0%
if -34 < y < 2.79999999999999984e80Initial program 100.0%
Taylor expanded in y around 0
associate-+r+N/A
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower-+.f6490.0
Applied rewrites90.0%
Final simplification70.5%
(FPCore (x y z) :precision binary64 (if (or (<= x -2.7e-11) (not (<= x 2.1e+15))) (+ 1.0 x) (- 1.0 (* z y))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -2.7e-11) || !(x <= 2.1e+15)) {
tmp = 1.0 + x;
} else {
tmp = 1.0 - (z * y);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= (-2.7d-11)) .or. (.not. (x <= 2.1d+15))) then
tmp = 1.0d0 + x
else
tmp = 1.0d0 - (z * y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -2.7e-11) || !(x <= 2.1e+15)) {
tmp = 1.0 + x;
} else {
tmp = 1.0 - (z * y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -2.7e-11) or not (x <= 2.1e+15): tmp = 1.0 + x else: tmp = 1.0 - (z * y) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -2.7e-11) || !(x <= 2.1e+15)) tmp = Float64(1.0 + x); else tmp = Float64(1.0 - Float64(z * y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -2.7e-11) || ~((x <= 2.1e+15))) tmp = 1.0 + x; else tmp = 1.0 - (z * y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -2.7e-11], N[Not[LessEqual[x, 2.1e+15]], $MachinePrecision]], N[(1.0 + x), $MachinePrecision], N[(1.0 - N[(z * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.7 \cdot 10^{-11} \lor \neg \left(x \leq 2.1 \cdot 10^{+15}\right):\\
\;\;\;\;1 + x\\
\mathbf{else}:\\
\;\;\;\;1 - z \cdot y\\
\end{array}
\end{array}
if x < -2.70000000000000005e-11 or 2.1e15 < x Initial program 100.0%
Taylor expanded in y around 0
lower-+.f6478.8
Applied rewrites78.8%
if -2.70000000000000005e-11 < x < 2.1e15Initial program 99.9%
Taylor expanded in y around 0
associate-+r+N/A
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower-+.f6455.9
Applied rewrites55.9%
Taylor expanded in x around 0
Applied rewrites55.3%
Final simplification67.1%
(FPCore (x y z) :precision binary64 (if (<= z -4.8e+214) (* (- y) z) (+ 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -4.8e+214) {
tmp = -y * z;
} else {
tmp = 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 (z <= (-4.8d+214)) then
tmp = -y * z
else
tmp = 1.0d0 + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -4.8e+214) {
tmp = -y * z;
} else {
tmp = 1.0 + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -4.8e+214: tmp = -y * z else: tmp = 1.0 + x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -4.8e+214) tmp = Float64(Float64(-y) * z); else tmp = Float64(1.0 + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -4.8e+214) tmp = -y * z; else tmp = 1.0 + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -4.8e+214], N[((-y) * z), $MachinePrecision], N[(1.0 + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.8 \cdot 10^{+214}:\\
\;\;\;\;\left(-y\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;1 + x\\
\end{array}
\end{array}
if z < -4.8000000000000002e214Initial program 99.9%
Taylor expanded in z around inf
mul-1-negN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-sin.f6486.2
Applied rewrites86.2%
Taylor expanded in y around 0
Applied rewrites43.5%
if -4.8000000000000002e214 < z Initial program 99.9%
Taylor expanded in y around 0
lower-+.f6465.8
Applied rewrites65.8%
(FPCore (x y z) :precision binary64 (+ 1.0 x))
double code(double x, double y, double z) {
return 1.0 + x;
}
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 + x
end function
public static double code(double x, double y, double z) {
return 1.0 + x;
}
def code(x, y, z): return 1.0 + x
function code(x, y, z) return Float64(1.0 + x) end
function tmp = code(x, y, z) tmp = 1.0 + x; end
code[x_, y_, z_] := N[(1.0 + x), $MachinePrecision]
\begin{array}{l}
\\
1 + x
\end{array}
Initial program 99.9%
Taylor expanded in y around 0
lower-+.f6460.0
Applied rewrites60.0%
(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
lower-+.f6460.0
Applied rewrites60.0%
Taylor expanded in x around 0
Applied rewrites22.0%
herbie shell --seed 2024338
(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))))