
(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) -2e+196) (- (* z (* x y))) (if (<= (* y z) 5e+275) (* x (- 1.0 (* y z))) (* y (* x (- z))))))
assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if ((y * z) <= -2e+196) {
tmp = -(z * (x * y));
} else if ((y * z) <= 5e+275) {
tmp = x * (1.0 - (y * z));
} else {
tmp = y * (x * -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) <= (-2d+196)) then
tmp = -(z * (x * y))
else if ((y * z) <= 5d+275) then
tmp = x * (1.0d0 - (y * z))
else
tmp = y * (x * -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) <= -2e+196) {
tmp = -(z * (x * y));
} else if ((y * z) <= 5e+275) {
tmp = x * (1.0 - (y * z));
} else {
tmp = y * (x * -z);
}
return tmp;
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): tmp = 0 if (y * z) <= -2e+196: tmp = -(z * (x * y)) elif (y * z) <= 5e+275: tmp = x * (1.0 - (y * z)) else: tmp = y * (x * -z) return tmp
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if (Float64(y * z) <= -2e+196) tmp = Float64(-Float64(z * Float64(x * y))); elseif (Float64(y * z) <= 5e+275) tmp = Float64(x * Float64(1.0 - Float64(y * z))); else tmp = Float64(y * Float64(x * Float64(-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) <= -2e+196)
tmp = -(z * (x * y));
elseif ((y * z) <= 5e+275)
tmp = x * (1.0 - (y * z));
else
tmp = y * (x * -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[LessEqual[N[(y * z), $MachinePrecision], -2e+196], (-N[(z * N[(x * y), $MachinePrecision]), $MachinePrecision]), If[LessEqual[N[(y * z), $MachinePrecision], 5e+275], N[(x * N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(x * (-z)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;y \cdot z \leq -2 \cdot 10^{+196}:\\
\;\;\;\;-z \cdot \left(x \cdot y\right)\\
\mathbf{elif}\;y \cdot z \leq 5 \cdot 10^{+275}:\\
\;\;\;\;x \cdot \left(1 - y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x \cdot \left(-z\right)\right)\\
\end{array}
\end{array}
if (*.f64 y z) < -1.9999999999999999e196Initial program 73.1%
Taylor expanded in y around inf
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6498.6
Applied rewrites98.6%
Applied rewrites99.9%
if -1.9999999999999999e196 < (*.f64 y z) < 5.0000000000000003e275Initial program 99.9%
if 5.0000000000000003e275 < (*.f64 y z) Initial program 69.0%
Taylor expanded in y around inf
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6499.7
Applied rewrites99.7%
Final simplification99.9%
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
:precision binary64
(if (<= (* y z) -2e+15)
(- (* z (* x y)))
(if (<= (* y z) 0.5)
(* x 1.0)
(if (<= (* y z) 5e+275) (* x (* y (- z))) (* y (* x (- z)))))))assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if ((y * z) <= -2e+15) {
tmp = -(z * (x * y));
} else if ((y * z) <= 0.5) {
tmp = x * 1.0;
} else if ((y * z) <= 5e+275) {
tmp = x * (y * -z);
} else {
tmp = y * (x * -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) <= (-2d+15)) then
tmp = -(z * (x * y))
else if ((y * z) <= 0.5d0) then
tmp = x * 1.0d0
else if ((y * z) <= 5d+275) then
tmp = x * (y * -z)
else
tmp = y * (x * -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) <= -2e+15) {
tmp = -(z * (x * y));
} else if ((y * z) <= 0.5) {
tmp = x * 1.0;
} else if ((y * z) <= 5e+275) {
tmp = x * (y * -z);
} else {
tmp = y * (x * -z);
}
return tmp;
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): tmp = 0 if (y * z) <= -2e+15: tmp = -(z * (x * y)) elif (y * z) <= 0.5: tmp = x * 1.0 elif (y * z) <= 5e+275: tmp = x * (y * -z) else: tmp = y * (x * -z) return tmp
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if (Float64(y * z) <= -2e+15) tmp = Float64(-Float64(z * Float64(x * y))); elseif (Float64(y * z) <= 0.5) tmp = Float64(x * 1.0); elseif (Float64(y * z) <= 5e+275) tmp = Float64(x * Float64(y * Float64(-z))); else tmp = Float64(y * Float64(x * Float64(-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) <= -2e+15)
tmp = -(z * (x * y));
elseif ((y * z) <= 0.5)
tmp = x * 1.0;
elseif ((y * z) <= 5e+275)
tmp = x * (y * -z);
else
tmp = y * (x * -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[LessEqual[N[(y * z), $MachinePrecision], -2e+15], (-N[(z * N[(x * y), $MachinePrecision]), $MachinePrecision]), If[LessEqual[N[(y * z), $MachinePrecision], 0.5], N[(x * 1.0), $MachinePrecision], If[LessEqual[N[(y * z), $MachinePrecision], 5e+275], N[(x * N[(y * (-z)), $MachinePrecision]), $MachinePrecision], N[(y * N[(x * (-z)), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;y \cdot z \leq -2 \cdot 10^{+15}:\\
\;\;\;\;-z \cdot \left(x \cdot y\right)\\
\mathbf{elif}\;y \cdot z \leq 0.5:\\
\;\;\;\;x \cdot 1\\
\mathbf{elif}\;y \cdot z \leq 5 \cdot 10^{+275}:\\
\;\;\;\;x \cdot \left(y \cdot \left(-z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x \cdot \left(-z\right)\right)\\
\end{array}
\end{array}
if (*.f64 y z) < -2e15Initial program 84.5%
Taylor expanded in y around inf
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6492.9
Applied rewrites92.9%
Applied rewrites95.2%
if -2e15 < (*.f64 y z) < 0.5Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites98.2%
if 0.5 < (*.f64 y z) < 5.0000000000000003e275Initial program 99.7%
Taylor expanded in y around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6498.8
Applied rewrites98.8%
if 5.0000000000000003e275 < (*.f64 y z) Initial program 69.0%
Taylor expanded in y around inf
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6499.7
Applied rewrites99.7%
Final simplification97.7%
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- 1.0 (* y z))))
(if (<= t_0 -40000000000.0)
(* y (* x (- z)))
(if (<= t_0 2.0) (* x 1.0) (- (* z (* x y)))))))assert(x < y && y < z);
double code(double x, double y, double z) {
double t_0 = 1.0 - (y * z);
double tmp;
if (t_0 <= -40000000000.0) {
tmp = y * (x * -z);
} else if (t_0 <= 2.0) {
tmp = x * 1.0;
} else {
tmp = -(z * (x * y));
}
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 = 1.0d0 - (y * z)
if (t_0 <= (-40000000000.0d0)) then
tmp = y * (x * -z)
else if (t_0 <= 2.0d0) then
tmp = x * 1.0d0
else
tmp = -(z * (x * y))
end if
code = tmp
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
double t_0 = 1.0 - (y * z);
double tmp;
if (t_0 <= -40000000000.0) {
tmp = y * (x * -z);
} else if (t_0 <= 2.0) {
tmp = x * 1.0;
} else {
tmp = -(z * (x * y));
}
return tmp;
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): t_0 = 1.0 - (y * z) tmp = 0 if t_0 <= -40000000000.0: tmp = y * (x * -z) elif t_0 <= 2.0: tmp = x * 1.0 else: tmp = -(z * (x * y)) return tmp
x, y, z = sort([x, y, z]) function code(x, y, z) t_0 = Float64(1.0 - Float64(y * z)) tmp = 0.0 if (t_0 <= -40000000000.0) tmp = Float64(y * Float64(x * Float64(-z))); elseif (t_0 <= 2.0) tmp = Float64(x * 1.0); else tmp = Float64(-Float64(z * Float64(x * y))); end return tmp end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp_2 = code(x, y, z)
t_0 = 1.0 - (y * z);
tmp = 0.0;
if (t_0 <= -40000000000.0)
tmp = y * (x * -z);
elseif (t_0 <= 2.0)
tmp = x * 1.0;
else
tmp = -(z * (x * y));
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[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -40000000000.0], N[(y * N[(x * (-z)), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2.0], N[(x * 1.0), $MachinePrecision], (-N[(z * N[(x * y), $MachinePrecision]), $MachinePrecision])]]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
t_0 := 1 - y \cdot z\\
\mathbf{if}\;t\_0 \leq -40000000000:\\
\;\;\;\;y \cdot \left(x \cdot \left(-z\right)\right)\\
\mathbf{elif}\;t\_0 \leq 2:\\
\;\;\;\;x \cdot 1\\
\mathbf{else}:\\
\;\;\;\;-z \cdot \left(x \cdot y\right)\\
\end{array}
\end{array}
if (-.f64 #s(literal 1 binary64) (*.f64 y z)) < -4e10Initial program 89.5%
Taylor expanded in y around inf
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6494.1
Applied rewrites94.1%
if -4e10 < (-.f64 #s(literal 1 binary64) (*.f64 y z)) < 2Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites98.2%
if 2 < (-.f64 #s(literal 1 binary64) (*.f64 y z)) Initial program 84.5%
Taylor expanded in y around inf
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6492.9
Applied rewrites92.9%
Applied rewrites95.2%
Final simplification96.5%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (let* ((t_0 (- 1.0 (* y z))) (t_1 (* y (* x (- z))))) (if (<= t_0 -40000000000.0) t_1 (if (<= t_0 2.0) (* x 1.0) t_1))))
assert(x < y && y < z);
double code(double x, double y, double z) {
double t_0 = 1.0 - (y * z);
double t_1 = y * (x * -z);
double tmp;
if (t_0 <= -40000000000.0) {
tmp = t_1;
} else if (t_0 <= 2.0) {
tmp = x * 1.0;
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_0 = 1.0d0 - (y * z)
t_1 = y * (x * -z)
if (t_0 <= (-40000000000.0d0)) then
tmp = t_1
else if (t_0 <= 2.0d0) then
tmp = x * 1.0d0
else
tmp = t_1
end if
code = tmp
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
double t_0 = 1.0 - (y * z);
double t_1 = y * (x * -z);
double tmp;
if (t_0 <= -40000000000.0) {
tmp = t_1;
} else if (t_0 <= 2.0) {
tmp = x * 1.0;
} else {
tmp = t_1;
}
return tmp;
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): t_0 = 1.0 - (y * z) t_1 = y * (x * -z) tmp = 0 if t_0 <= -40000000000.0: tmp = t_1 elif t_0 <= 2.0: tmp = x * 1.0 else: tmp = t_1 return tmp
x, y, z = sort([x, y, z]) function code(x, y, z) t_0 = Float64(1.0 - Float64(y * z)) t_1 = Float64(y * Float64(x * Float64(-z))) tmp = 0.0 if (t_0 <= -40000000000.0) tmp = t_1; elseif (t_0 <= 2.0) tmp = Float64(x * 1.0); else tmp = t_1; end return tmp end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp_2 = code(x, y, z)
t_0 = 1.0 - (y * z);
t_1 = y * (x * -z);
tmp = 0.0;
if (t_0 <= -40000000000.0)
tmp = t_1;
elseif (t_0 <= 2.0)
tmp = x * 1.0;
else
tmp = t_1;
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[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y * N[(x * (-z)), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -40000000000.0], t$95$1, If[LessEqual[t$95$0, 2.0], N[(x * 1.0), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
t_0 := 1 - y \cdot z\\
t_1 := y \cdot \left(x \cdot \left(-z\right)\right)\\
\mathbf{if}\;t\_0 \leq -40000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 2:\\
\;\;\;\;x \cdot 1\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 #s(literal 1 binary64) (*.f64 y z)) < -4e10 or 2 < (-.f64 #s(literal 1 binary64) (*.f64 y z)) Initial program 87.0%
Taylor expanded in y around inf
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6493.5
Applied rewrites93.5%
if -4e10 < (-.f64 #s(literal 1 binary64) (*.f64 y z)) < 2Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites98.2%
Final simplification95.9%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= x 9.5e-14) (fma (- (* x y)) z x) (* x (- 1.0 (* y z)))))
assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if (x <= 9.5e-14) {
tmp = fma(-(x * y), z, x);
} 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 (x <= 9.5e-14) tmp = fma(Float64(-Float64(x * y)), z, x); else tmp = Float64(x * Float64(1.0 - Float64(y * z))); 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, 9.5e-14], N[((-N[(x * y), $MachinePrecision]) * z + x), $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}\;x \leq 9.5 \cdot 10^{-14}:\\
\;\;\;\;\mathsf{fma}\left(-x \cdot y, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - y \cdot z\right)\\
\end{array}
\end{array}
if x < 9.4999999999999999e-14Initial program 91.6%
lift-*.f64N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-lft-inN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
associate-*r*N/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-neg.f6492.1
Applied rewrites92.1%
if 9.4999999999999999e-14 < x Initial program 100.0%
Final simplification94.1%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (- x (* y (* x z))))
assert(x < y && y < z);
double code(double x, double y, double z) {
return x - (y * (x * z));
}
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 - (y * (x * z))
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
return x - (y * (x * z));
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): return x - (y * (x * z))
x, y, z = sort([x, y, z]) function code(x, y, z) return Float64(x - Float64(y * Float64(x * z))) end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp = code(x, y, z)
tmp = x - (y * (x * z));
end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := N[(x - N[(y * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
x - y \cdot \left(x \cdot z\right)
\end{array}
Initial program 93.7%
Taylor expanded in x around 0
distribute-lft-out--N/A
*-rgt-identityN/A
lower--.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6495.5
Applied rewrites95.5%
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 93.7%
Taylor expanded in y around 0
Applied rewrites52.2%
herbie shell --seed 2024221
(FPCore (x y z)
:name "Data.Colour.RGBSpace.HSV:hsv from colour-2.3.3, I"
:precision binary64
(* x (- 1.0 (* y z))))