
(FPCore (x y z) :precision binary64 (* x (- 1.0 (* y z))))
double code(double x, double y, double z) {
return x * (1.0 - (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 * (1.0d0 - (y * z))
end function
public static double code(double x, double y, double z) {
return x * (1.0 - (y * z));
}
def code(x, y, z): return x * (1.0 - (y * z))
function code(x, y, z) return Float64(x * Float64(1.0 - Float64(y * z))) end
function tmp = code(x, y, z) tmp = x * (1.0 - (y * z)); end
code[x_, y_, z_] := N[(x * N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(1 - y \cdot z\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 7 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (* x (- 1.0 (* y z))))
double code(double x, double y, double z) {
return x * (1.0 - (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 * (1.0d0 - (y * z))
end function
public static double code(double x, double y, double z) {
return x * (1.0 - (y * z));
}
def code(x, y, z): return x * (1.0 - (y * z))
function code(x, y, z) return Float64(x * Float64(1.0 - Float64(y * z))) end
function tmp = code(x, y, z) tmp = x * (1.0 - (y * z)); end
code[x_, y_, z_] := N[(x * N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(1 - y \cdot z\right)
\end{array}
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= (* y z) -5e+61) (* (* (- x) z) y) (if (<= (* y z) 5e+154) (* x (fma (- z) y 1.0)) (fma (* (- x) y) z x))))
assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if ((y * z) <= -5e+61) {
tmp = (-x * z) * y;
} else if ((y * z) <= 5e+154) {
tmp = x * fma(-z, y, 1.0);
} else {
tmp = fma((-x * y), z, x);
}
return tmp;
}
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if (Float64(y * z) <= -5e+61) tmp = Float64(Float64(Float64(-x) * z) * y); elseif (Float64(y * z) <= 5e+154) tmp = Float64(x * fma(Float64(-z), y, 1.0)); else tmp = fma(Float64(Float64(-x) * y), z, x); end return tmp end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[LessEqual[N[(y * z), $MachinePrecision], -5e+61], N[(N[((-x) * z), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[N[(y * z), $MachinePrecision], 5e+154], N[(x * N[((-z) * y + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[((-x) * y), $MachinePrecision] * z + x), $MachinePrecision]]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;y \cdot z \leq -5 \cdot 10^{+61}:\\
\;\;\;\;\left(\left(-x\right) \cdot z\right) \cdot y\\
\mathbf{elif}\;y \cdot z \leq 5 \cdot 10^{+154}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(-z, y, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(-x\right) \cdot y, z, x\right)\\
\end{array}
\end{array}
if (*.f64 y z) < -5.00000000000000018e61Initial program 89.5%
Applied rewrites28.2%
Taylor expanded in y around inf
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f640.7
Applied rewrites0.7%
Taylor expanded in z around -inf
mul-1-negN/A
associate-*r*N/A
distribute-rgt-neg-inN/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
remove-double-negN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f640.6
Applied rewrites0.6%
Taylor expanded in y around -inf
mul-1-negN/A
distribute-lft-neg-inN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-neg.f6496.3
Applied rewrites96.3%
if -5.00000000000000018e61 < (*.f64 y z) < 5.00000000000000004e154Initial program 99.9%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f6499.9
Applied rewrites99.9%
if 5.00000000000000004e154 < (*.f64 y z) Initial program 76.3%
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-inN/A
associate-*r*N/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-neg.f6499.9
Applied rewrites99.9%
Final simplification99.2%
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (* (- x) z) y)))
(if (<= (* y z) -2.0)
t_0
(if (<= (* y z) 1.0)
(* x 1.0)
(if (<= (* y z) 2e+200) (* x (* (- y) z)) t_0)))))assert(x < y && y < z);
double code(double x, double y, double z) {
double t_0 = (-x * z) * y;
double tmp;
if ((y * z) <= -2.0) {
tmp = t_0;
} else if ((y * z) <= 1.0) {
tmp = x * 1.0;
} else if ((y * z) <= 2e+200) {
tmp = x * (-y * z);
} else {
tmp = t_0;
}
return tmp;
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
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 = (-x * z) * y
if ((y * z) <= (-2.0d0)) then
tmp = t_0
else if ((y * z) <= 1.0d0) then
tmp = x * 1.0d0
else if ((y * z) <= 2d+200) then
tmp = x * (-y * z)
else
tmp = t_0
end if
code = tmp
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
double t_0 = (-x * z) * y;
double tmp;
if ((y * z) <= -2.0) {
tmp = t_0;
} else if ((y * z) <= 1.0) {
tmp = x * 1.0;
} else if ((y * z) <= 2e+200) {
tmp = x * (-y * z);
} else {
tmp = t_0;
}
return tmp;
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): t_0 = (-x * z) * y tmp = 0 if (y * z) <= -2.0: tmp = t_0 elif (y * z) <= 1.0: tmp = x * 1.0 elif (y * z) <= 2e+200: tmp = x * (-y * z) else: tmp = t_0 return tmp
x, y, z = sort([x, y, z]) function code(x, y, z) t_0 = Float64(Float64(Float64(-x) * z) * y) tmp = 0.0 if (Float64(y * z) <= -2.0) tmp = t_0; elseif (Float64(y * z) <= 1.0) tmp = Float64(x * 1.0); elseif (Float64(y * z) <= 2e+200) tmp = Float64(x * Float64(Float64(-y) * z)); else tmp = t_0; end return tmp end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp_2 = code(x, y, z)
t_0 = (-x * z) * y;
tmp = 0.0;
if ((y * z) <= -2.0)
tmp = t_0;
elseif ((y * z) <= 1.0)
tmp = x * 1.0;
elseif ((y * z) <= 2e+200)
tmp = x * (-y * z);
else
tmp = t_0;
end
tmp_2 = tmp;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := Block[{t$95$0 = N[(N[((-x) * z), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[N[(y * z), $MachinePrecision], -2.0], t$95$0, If[LessEqual[N[(y * z), $MachinePrecision], 1.0], N[(x * 1.0), $MachinePrecision], If[LessEqual[N[(y * z), $MachinePrecision], 2e+200], N[(x * N[((-y) * z), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
t_0 := \left(\left(-x\right) \cdot z\right) \cdot y\\
\mathbf{if}\;y \cdot z \leq -2:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \cdot z \leq 1:\\
\;\;\;\;x \cdot 1\\
\mathbf{elif}\;y \cdot z \leq 2 \cdot 10^{+200}:\\
\;\;\;\;x \cdot \left(\left(-y\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (*.f64 y z) < -2 or 1.9999999999999999e200 < (*.f64 y z) Initial program 87.3%
Applied rewrites24.0%
Taylor expanded in y around inf
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f640.8
Applied rewrites0.8%
Taylor expanded in z around -inf
mul-1-negN/A
associate-*r*N/A
distribute-rgt-neg-inN/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
remove-double-negN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f640.8
Applied rewrites0.8%
Taylor expanded in y around -inf
mul-1-negN/A
distribute-lft-neg-inN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-neg.f6494.0
Applied rewrites94.0%
if -2 < (*.f64 y z) < 1Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites97.4%
if 1 < (*.f64 y z) < 1.9999999999999999e200Initial program 99.8%
Taylor expanded in y around inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6498.9
Applied rewrites98.9%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (or (<= (* y z) -5e+61) (not (<= (* y z) 2e+200))) (* (* (- x) z) y) (* x (fma (- z) y 1.0))))
assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if (((y * z) <= -5e+61) || !((y * z) <= 2e+200)) {
tmp = (-x * z) * y;
} else {
tmp = x * fma(-z, y, 1.0);
}
return tmp;
}
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if ((Float64(y * z) <= -5e+61) || !(Float64(y * z) <= 2e+200)) tmp = Float64(Float64(Float64(-x) * z) * y); else tmp = Float64(x * fma(Float64(-z), y, 1.0)); end return tmp end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[Or[LessEqual[N[(y * z), $MachinePrecision], -5e+61], N[Not[LessEqual[N[(y * z), $MachinePrecision], 2e+200]], $MachinePrecision]], N[(N[((-x) * z), $MachinePrecision] * y), $MachinePrecision], N[(x * N[((-z) * y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;y \cdot z \leq -5 \cdot 10^{+61} \lor \neg \left(y \cdot z \leq 2 \cdot 10^{+200}\right):\\
\;\;\;\;\left(\left(-x\right) \cdot z\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(-z, y, 1\right)\\
\end{array}
\end{array}
if (*.f64 y z) < -5.00000000000000018e61 or 1.9999999999999999e200 < (*.f64 y z) Initial program 84.3%
Applied rewrites19.6%
Taylor expanded in y around inf
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f640.5
Applied rewrites0.5%
Taylor expanded in z around -inf
mul-1-negN/A
associate-*r*N/A
distribute-rgt-neg-inN/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
remove-double-negN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f640.5
Applied rewrites0.5%
Taylor expanded in y around -inf
mul-1-negN/A
distribute-lft-neg-inN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-neg.f6497.4
Applied rewrites97.4%
if -5.00000000000000018e61 < (*.f64 y z) < 1.9999999999999999e200Initial program 99.9%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f6499.9
Applied rewrites99.9%
Final simplification99.2%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (or (<= (* y z) -5e+61) (not (<= (* y z) 2e+200))) (* (* (- x) z) y) (* x (- 1.0 (* y z)))))
assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if (((y * z) <= -5e+61) || !((y * z) <= 2e+200)) {
tmp = (-x * z) * y;
} else {
tmp = x * (1.0 - (y * z));
}
return tmp;
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
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 * z) <= (-5d+61)) .or. (.not. ((y * z) <= 2d+200))) then
tmp = (-x * z) * y
else
tmp = x * (1.0d0 - (y * z))
end if
code = tmp
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
double tmp;
if (((y * z) <= -5e+61) || !((y * z) <= 2e+200)) {
tmp = (-x * z) * y;
} else {
tmp = x * (1.0 - (y * z));
}
return tmp;
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): tmp = 0 if ((y * z) <= -5e+61) or not ((y * z) <= 2e+200): tmp = (-x * z) * y else: tmp = x * (1.0 - (y * z)) return tmp
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if ((Float64(y * z) <= -5e+61) || !(Float64(y * z) <= 2e+200)) tmp = Float64(Float64(Float64(-x) * z) * y); else tmp = Float64(x * Float64(1.0 - Float64(y * z))); end return tmp end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if (((y * z) <= -5e+61) || ~(((y * z) <= 2e+200)))
tmp = (-x * z) * y;
else
tmp = x * (1.0 - (y * z));
end
tmp_2 = tmp;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[Or[LessEqual[N[(y * z), $MachinePrecision], -5e+61], N[Not[LessEqual[N[(y * z), $MachinePrecision], 2e+200]], $MachinePrecision]], N[(N[((-x) * z), $MachinePrecision] * y), $MachinePrecision], N[(x * N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;y \cdot z \leq -5 \cdot 10^{+61} \lor \neg \left(y \cdot z \leq 2 \cdot 10^{+200}\right):\\
\;\;\;\;\left(\left(-x\right) \cdot z\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - y \cdot z\right)\\
\end{array}
\end{array}
if (*.f64 y z) < -5.00000000000000018e61 or 1.9999999999999999e200 < (*.f64 y z) Initial program 84.3%
Applied rewrites19.6%
Taylor expanded in y around inf
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f640.5
Applied rewrites0.5%
Taylor expanded in z around -inf
mul-1-negN/A
associate-*r*N/A
distribute-rgt-neg-inN/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
remove-double-negN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f640.5
Applied rewrites0.5%
Taylor expanded in y around -inf
mul-1-negN/A
distribute-lft-neg-inN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-neg.f6497.4
Applied rewrites97.4%
if -5.00000000000000018e61 < (*.f64 y z) < 1.9999999999999999e200Initial program 99.9%
Final simplification99.2%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (or (<= (* y z) -2.0) (not (<= (* y z) 1.0))) (* (* (- x) z) y) (* x 1.0)))
assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if (((y * z) <= -2.0) || !((y * z) <= 1.0)) {
tmp = (-x * z) * y;
} else {
tmp = x * 1.0;
}
return tmp;
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
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 * z) <= (-2.0d0)) .or. (.not. ((y * z) <= 1.0d0))) then
tmp = (-x * z) * y
else
tmp = x * 1.0d0
end if
code = tmp
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
double tmp;
if (((y * z) <= -2.0) || !((y * z) <= 1.0)) {
tmp = (-x * z) * y;
} else {
tmp = x * 1.0;
}
return tmp;
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): tmp = 0 if ((y * z) <= -2.0) or not ((y * z) <= 1.0): tmp = (-x * z) * y else: tmp = x * 1.0 return tmp
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if ((Float64(y * z) <= -2.0) || !(Float64(y * z) <= 1.0)) tmp = Float64(Float64(Float64(-x) * z) * y); else tmp = Float64(x * 1.0); end return tmp end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if (((y * z) <= -2.0) || ~(((y * z) <= 1.0)))
tmp = (-x * z) * y;
else
tmp = x * 1.0;
end
tmp_2 = tmp;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[Or[LessEqual[N[(y * z), $MachinePrecision], -2.0], N[Not[LessEqual[N[(y * z), $MachinePrecision], 1.0]], $MachinePrecision]], N[(N[((-x) * z), $MachinePrecision] * y), $MachinePrecision], N[(x * 1.0), $MachinePrecision]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;y \cdot z \leq -2 \lor \neg \left(y \cdot z \leq 1\right):\\
\;\;\;\;\left(\left(-x\right) \cdot z\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;x \cdot 1\\
\end{array}
\end{array}
if (*.f64 y z) < -2 or 1 < (*.f64 y z) Initial program 90.1%
Applied rewrites18.8%
Taylor expanded in y around inf
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f641.0
Applied rewrites1.0%
Taylor expanded in z around -inf
mul-1-negN/A
associate-*r*N/A
distribute-rgt-neg-inN/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
remove-double-negN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f641.1
Applied rewrites1.1%
Taylor expanded in y around -inf
mul-1-negN/A
distribute-lft-neg-inN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-neg.f6492.7
Applied rewrites92.7%
if -2 < (*.f64 y z) < 1Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites97.4%
Final simplification95.1%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= x 3e-26) (fma (* x z) (- y) x) (* x (fma (- z) y 1.0))))
assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if (x <= 3e-26) {
tmp = fma((x * z), -y, x);
} else {
tmp = x * fma(-z, y, 1.0);
}
return tmp;
}
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if (x <= 3e-26) tmp = fma(Float64(x * z), Float64(-y), x); else tmp = Float64(x * fma(Float64(-z), y, 1.0)); end return tmp end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[LessEqual[x, 3e-26], N[(N[(x * z), $MachinePrecision] * (-y) + x), $MachinePrecision], N[(x * N[((-z) * y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3 \cdot 10^{-26}:\\
\;\;\;\;\mathsf{fma}\left(x \cdot z, -y, x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(-z, y, 1\right)\\
\end{array}
\end{array}
if x < 3.00000000000000012e-26Initial program 93.3%
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-neg.f6494.5
Applied rewrites94.5%
if 3.00000000000000012e-26 < x Initial program 99.9%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64100.0
Applied rewrites100.0%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (* x 1.0))
assert(x < y && y < z);
double code(double x, double y, double z) {
return x * 1.0;
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
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
assert x < y && y < z;
public static double code(double x, double y, double z) {
return x * 1.0;
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): return x * 1.0
x, y, z = sort([x, y, z]) function code(x, y, z) return Float64(x * 1.0) end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp = code(x, y, z)
tmp = x * 1.0;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := N[(x * 1.0), $MachinePrecision]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
x \cdot 1
\end{array}
Initial program 95.1%
Taylor expanded in y around 0
Applied rewrites51.5%
herbie shell --seed 2024329
(FPCore (x y z)
:name "Data.Colour.RGBSpace.HSV:hsv from colour-2.3.3, I"
:precision binary64
(* x (- 1.0 (* y z))))