Math FPCore C Fortran Java Python Julia MATLAB Wolfram TeX \[x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right)
\]
↓
\[x \cdot 0.5 + \left(y \cdot \left(1 - z\right) + y \cdot \log z\right)
\]
(FPCore (x y z) :precision binary64 (+ (* x 0.5) (* y (+ (- 1.0 z) (log z))))) ↓
(FPCore (x y z)
:precision binary64
(+ (* x 0.5) (+ (* y (- 1.0 z)) (* y (log z))))) double code(double x, double y, double z) {
return (x * 0.5) + (y * ((1.0 - z) + log(z)));
}
↓
double code(double x, double y, double z) {
return (x * 0.5) + ((y * (1.0 - z)) + (y * log(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 * 0.5d0) + (y * ((1.0d0 - z) + log(z)))
end 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 * 0.5d0) + ((y * (1.0d0 - z)) + (y * log(z)))
end function
public static double code(double x, double y, double z) {
return (x * 0.5) + (y * ((1.0 - z) + Math.log(z)));
}
↓
public static double code(double x, double y, double z) {
return (x * 0.5) + ((y * (1.0 - z)) + (y * Math.log(z)));
}
def code(x, y, z):
return (x * 0.5) + (y * ((1.0 - z) + math.log(z)))
↓
def code(x, y, z):
return (x * 0.5) + ((y * (1.0 - z)) + (y * math.log(z)))
function code(x, y, z)
return Float64(Float64(x * 0.5) + Float64(y * Float64(Float64(1.0 - z) + log(z))))
end
↓
function code(x, y, z)
return Float64(Float64(x * 0.5) + Float64(Float64(y * Float64(1.0 - z)) + Float64(y * log(z))))
end
function tmp = code(x, y, z)
tmp = (x * 0.5) + (y * ((1.0 - z) + log(z)));
end
↓
function tmp = code(x, y, z)
tmp = (x * 0.5) + ((y * (1.0 - z)) + (y * log(z)));
end
code[x_, y_, z_] := N[(N[(x * 0.5), $MachinePrecision] + N[(y * N[(N[(1.0 - z), $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
↓
code[x_, y_, z_] := N[(N[(x * 0.5), $MachinePrecision] + N[(N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision] + N[(y * N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right)
↓
x \cdot 0.5 + \left(y \cdot \left(1 - z\right) + y \cdot \log z\right)
Alternatives Alternative 1 Error 18.7 Cost 7180
\[\begin{array}{l}
\mathbf{if}\;z \leq 7.8 \cdot 10^{-63}:\\
\;\;\;\;y \cdot \left(1 + \log z\right)\\
\mathbf{elif}\;z \leq 2.52 \cdot 10^{-51}:\\
\;\;\;\;x \cdot 0.5 - y \cdot z\\
\mathbf{elif}\;z \leq 6.1 \cdot 10^{-7}:\\
\;\;\;\;y + y \cdot \log z\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-z, y, x \cdot 0.5\right)\\
\end{array}
\]
Alternative 2 Error 18.7 Cost 7116
\[\begin{array}{l}
t_0 := y \cdot \left(1 + \log z\right)\\
t_1 := x \cdot 0.5 - y \cdot z\\
\mathbf{if}\;z \leq 9 \cdot 10^{-63}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{-50}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 8 \cdot 10^{-7}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 3 Error 18.7 Cost 7116
\[\begin{array}{l}
t_0 := x \cdot 0.5 - y \cdot z\\
\mathbf{if}\;z \leq 1.2 \cdot 10^{-62}:\\
\;\;\;\;y \cdot \left(1 + \log z\right)\\
\mathbf{elif}\;z \leq 1.05 \cdot 10^{-50}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{-7}:\\
\;\;\;\;y + y \cdot \log z\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
Alternative 4 Error 10.8 Cost 7112
\[\begin{array}{l}
t_0 := y \cdot \left(\left(1 - z\right) + \log z\right)\\
\mathbf{if}\;y \leq -1.45 \cdot 10^{+87}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 2.8 \cdot 10^{+35}:\\
\;\;\;\;\mathsf{fma}\left(-z, y, x \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
Alternative 5 Error 10.8 Cost 7112
\[\begin{array}{l}
\mathbf{if}\;y \leq -4.5 \cdot 10^{+87}:\\
\;\;\;\;y \cdot \left(\left(1 - z\right) + \log z\right)\\
\mathbf{elif}\;y \leq 5.8 \cdot 10^{+34}:\\
\;\;\;\;\mathsf{fma}\left(-z, y, x \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(\left(1 + \log z\right) - z\right)\\
\end{array}
\]
Alternative 6 Error 0.9 Cost 7108
\[\begin{array}{l}
\mathbf{if}\;z \leq 3:\\
\;\;\;\;x \cdot 0.5 + y \cdot \left(1 + \log z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-z, y, x \cdot 0.5\right)\\
\end{array}
\]
Alternative 7 Error 0.1 Cost 7104
\[x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right)
\]
Alternative 8 Error 27.7 Cost 520
\[\begin{array}{l}
\mathbf{if}\;x \leq -2.1 \cdot 10^{-68}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;x \leq 1.5 \cdot 10^{-75}:\\
\;\;\;\;y \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 0.5\\
\end{array}
\]
Alternative 9 Error 18.3 Cost 448
\[x \cdot 0.5 - y \cdot z
\]
Alternative 10 Error 34.8 Cost 192
\[x \cdot 0.5
\]