
(FPCore (x y z) :precision binary64 (/ (+ x (* y (- z x))) z))
double code(double x, double y, double z) {
return (x + (y * (z - x))) / 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 + (y * (z - x))) / z
end function
public static double code(double x, double y, double z) {
return (x + (y * (z - x))) / z;
}
def code(x, y, z): return (x + (y * (z - x))) / z
function code(x, y, z) return Float64(Float64(x + Float64(y * Float64(z - x))) / z) end
function tmp = code(x, y, z) tmp = (x + (y * (z - x))) / z; end
code[x_, y_, z_] := N[(N[(x + N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + y \cdot \left(z - x\right)}{z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (+ x (* y (- z x))) z))
double code(double x, double y, double z) {
return (x + (y * (z - x))) / 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 + (y * (z - x))) / z
end function
public static double code(double x, double y, double z) {
return (x + (y * (z - x))) / z;
}
def code(x, y, z): return (x + (y * (z - x))) / z
function code(x, y, z) return Float64(Float64(x + Float64(y * Float64(z - x))) / z) end
function tmp = code(x, y, z) tmp = (x + (y * (z - x))) / z; end
code[x_, y_, z_] := N[(N[(x + N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + y \cdot \left(z - x\right)}{z}
\end{array}
(FPCore (x y z) :precision binary64 (if (or (<= y -2.85e+57) (not (<= y 6.2e-10))) (* y (/ (- z x) z)) (/ (fma y (- z x) x) z)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.85e+57) || !(y <= 6.2e-10)) {
tmp = y * ((z - x) / z);
} else {
tmp = fma(y, (z - x), x) / z;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((y <= -2.85e+57) || !(y <= 6.2e-10)) tmp = Float64(y * Float64(Float64(z - x) / z)); else tmp = Float64(fma(y, Float64(z - x), x) / z); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.85e+57], N[Not[LessEqual[y, 6.2e-10]], $MachinePrecision]], N[(y * N[(N[(z - x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(y * N[(z - x), $MachinePrecision] + x), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.85 \cdot 10^{+57} \lor \neg \left(y \leq 6.2 \cdot 10^{-10}\right):\\
\;\;\;\;y \cdot \frac{z - x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, z - x, x\right)}{z}\\
\end{array}
\end{array}
if y < -2.8499999999999999e57 or 6.2000000000000003e-10 < y Initial program 80.9%
Taylor expanded in y around inf 80.9%
associate-/l*100.0%
Simplified100.0%
if -2.8499999999999999e57 < y < 6.2000000000000003e-10Initial program 99.9%
+-commutative99.9%
fma-define100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.85e+57) (not (<= y 6.2e-10))) (* y (/ (- z x) z)) (/ (+ x (* y (- z x))) z)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.85e+57) || !(y <= 6.2e-10)) {
tmp = y * ((z - x) / z);
} else {
tmp = (x + (y * (z - x))) / z;
}
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.85d+57)) .or. (.not. (y <= 6.2d-10))) then
tmp = y * ((z - x) / z)
else
tmp = (x + (y * (z - x))) / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -2.85e+57) || !(y <= 6.2e-10)) {
tmp = y * ((z - x) / z);
} else {
tmp = (x + (y * (z - x))) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.85e+57) or not (y <= 6.2e-10): tmp = y * ((z - x) / z) else: tmp = (x + (y * (z - x))) / z return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.85e+57) || !(y <= 6.2e-10)) tmp = Float64(y * Float64(Float64(z - x) / z)); else tmp = Float64(Float64(x + Float64(y * Float64(z - x))) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -2.85e+57) || ~((y <= 6.2e-10))) tmp = y * ((z - x) / z); else tmp = (x + (y * (z - x))) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.85e+57], N[Not[LessEqual[y, 6.2e-10]], $MachinePrecision]], N[(y * N[(N[(z - x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.85 \cdot 10^{+57} \lor \neg \left(y \leq 6.2 \cdot 10^{-10}\right):\\
\;\;\;\;y \cdot \frac{z - x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + y \cdot \left(z - x\right)}{z}\\
\end{array}
\end{array}
if y < -2.8499999999999999e57 or 6.2000000000000003e-10 < y Initial program 80.9%
Taylor expanded in y around inf 80.9%
associate-/l*100.0%
Simplified100.0%
if -2.8499999999999999e57 < y < 6.2000000000000003e-10Initial program 99.9%
Final simplification100.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.2e+23) (not (<= y 6.2e-10))) (* y (/ (- z x) z)) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.2e+23) || !(y <= 6.2e-10)) {
tmp = y * ((z - x) / z);
} else {
tmp = y + (x / z);
}
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.2d+23)) .or. (.not. (y <= 6.2d-10))) then
tmp = y * ((z - x) / z)
else
tmp = y + (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -2.2e+23) || !(y <= 6.2e-10)) {
tmp = y * ((z - x) / z);
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.2e+23) or not (y <= 6.2e-10): tmp = y * ((z - x) / z) else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.2e+23) || !(y <= 6.2e-10)) tmp = Float64(y * Float64(Float64(z - x) / z)); else tmp = Float64(y + Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -2.2e+23) || ~((y <= 6.2e-10))) tmp = y * ((z - x) / z); else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.2e+23], N[Not[LessEqual[y, 6.2e-10]], $MachinePrecision]], N[(y * N[(N[(z - x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.2 \cdot 10^{+23} \lor \neg \left(y \leq 6.2 \cdot 10^{-10}\right):\\
\;\;\;\;y \cdot \frac{z - x}{z}\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if y < -2.20000000000000008e23 or 6.2000000000000003e-10 < y Initial program 81.9%
Taylor expanded in y around inf 81.9%
associate-/l*100.0%
Simplified100.0%
if -2.20000000000000008e23 < y < 6.2000000000000003e-10Initial program 99.9%
Taylor expanded in x around 0 99.8%
Taylor expanded in y around 0 98.9%
Final simplification99.5%
(FPCore (x y z) :precision binary64 (if (or (<= y -3.5e+207) (not (<= y 1.2e+229))) (* (/ x z) (- y)) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3.5e+207) || !(y <= 1.2e+229)) {
tmp = (x / z) * -y;
} else {
tmp = y + (x / z);
}
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 <= (-3.5d+207)) .or. (.not. (y <= 1.2d+229))) then
tmp = (x / z) * -y
else
tmp = y + (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -3.5e+207) || !(y <= 1.2e+229)) {
tmp = (x / z) * -y;
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -3.5e+207) or not (y <= 1.2e+229): tmp = (x / z) * -y else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -3.5e+207) || !(y <= 1.2e+229)) tmp = Float64(Float64(x / z) * Float64(-y)); else tmp = Float64(y + Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -3.5e+207) || ~((y <= 1.2e+229))) tmp = (x / z) * -y; else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -3.5e+207], N[Not[LessEqual[y, 1.2e+229]], $MachinePrecision]], N[(N[(x / z), $MachinePrecision] * (-y)), $MachinePrecision], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.5 \cdot 10^{+207} \lor \neg \left(y \leq 1.2 \cdot 10^{+229}\right):\\
\;\;\;\;\frac{x}{z} \cdot \left(-y\right)\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if y < -3.50000000000000028e207 or 1.2e229 < y Initial program 79.6%
Taylor expanded in x around inf 67.0%
mul-1-neg67.0%
unsub-neg67.0%
Simplified67.0%
Taylor expanded in y around inf 67.0%
neg-mul-167.0%
Simplified67.0%
Taylor expanded in x around 0 67.0%
mul-1-neg67.0%
associate-*l/67.7%
*-commutative67.7%
distribute-rgt-neg-in67.7%
distribute-frac-neg267.7%
Simplified67.7%
if -3.50000000000000028e207 < y < 1.2e229Initial program 92.5%
Taylor expanded in x around 0 95.5%
Taylor expanded in y around 0 84.4%
Final simplification82.1%
(FPCore (x y z) :precision binary64 (if (<= y -3.2e+206) (/ (* y x) (- z)) (if (<= y 1.5e+222) (+ y (/ x z)) (* (/ x z) (- y)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -3.2e+206) {
tmp = (y * x) / -z;
} else if (y <= 1.5e+222) {
tmp = y + (x / z);
} else {
tmp = (x / 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 (y <= (-3.2d+206)) then
tmp = (y * x) / -z
else if (y <= 1.5d+222) then
tmp = y + (x / z)
else
tmp = (x / z) * -y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -3.2e+206) {
tmp = (y * x) / -z;
} else if (y <= 1.5e+222) {
tmp = y + (x / z);
} else {
tmp = (x / z) * -y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -3.2e+206: tmp = (y * x) / -z elif y <= 1.5e+222: tmp = y + (x / z) else: tmp = (x / z) * -y return tmp
function code(x, y, z) tmp = 0.0 if (y <= -3.2e+206) tmp = Float64(Float64(y * x) / Float64(-z)); elseif (y <= 1.5e+222) tmp = Float64(y + Float64(x / z)); else tmp = Float64(Float64(x / z) * Float64(-y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -3.2e+206) tmp = (y * x) / -z; elseif (y <= 1.5e+222) tmp = y + (x / z); else tmp = (x / z) * -y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -3.2e+206], N[(N[(y * x), $MachinePrecision] / (-z)), $MachinePrecision], If[LessEqual[y, 1.5e+222], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], N[(N[(x / z), $MachinePrecision] * (-y)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.2 \cdot 10^{+206}:\\
\;\;\;\;\frac{y \cdot x}{-z}\\
\mathbf{elif}\;y \leq 1.5 \cdot 10^{+222}:\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} \cdot \left(-y\right)\\
\end{array}
\end{array}
if y < -3.20000000000000005e206Initial program 82.7%
Taylor expanded in x around inf 70.3%
mul-1-neg70.3%
unsub-neg70.3%
Simplified70.3%
Taylor expanded in y around inf 70.3%
neg-mul-170.3%
Simplified70.3%
if -3.20000000000000005e206 < y < 1.50000000000000007e222Initial program 92.5%
Taylor expanded in x around 0 95.5%
Taylor expanded in y around 0 84.4%
if 1.50000000000000007e222 < y Initial program 75.4%
Taylor expanded in x around inf 62.2%
mul-1-neg62.2%
unsub-neg62.2%
Simplified62.2%
Taylor expanded in y around inf 62.2%
neg-mul-162.2%
Simplified62.2%
Taylor expanded in x around 0 62.2%
mul-1-neg62.2%
associate-*l/64.2%
*-commutative64.2%
distribute-rgt-neg-in64.2%
distribute-frac-neg264.2%
Simplified64.2%
Final simplification82.1%
(FPCore (x y z) :precision binary64 (if (<= y -3e-11) (* z (/ y z)) (if (<= y 5.9e-99) (/ x z) y)))
double code(double x, double y, double z) {
double tmp;
if (y <= -3e-11) {
tmp = z * (y / z);
} else if (y <= 5.9e-99) {
tmp = x / z;
} else {
tmp = 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 (y <= (-3d-11)) then
tmp = z * (y / z)
else if (y <= 5.9d-99) then
tmp = x / z
else
tmp = y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -3e-11) {
tmp = z * (y / z);
} else if (y <= 5.9e-99) {
tmp = x / z;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -3e-11: tmp = z * (y / z) elif y <= 5.9e-99: tmp = x / z else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if (y <= -3e-11) tmp = Float64(z * Float64(y / z)); elseif (y <= 5.9e-99) tmp = Float64(x / z); else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -3e-11) tmp = z * (y / z); elseif (y <= 5.9e-99) tmp = x / z; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -3e-11], N[(z * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.9e-99], N[(x / z), $MachinePrecision], y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3 \cdot 10^{-11}:\\
\;\;\;\;z \cdot \frac{y}{z}\\
\mathbf{elif}\;y \leq 5.9 \cdot 10^{-99}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < -3e-11Initial program 87.3%
Taylor expanded in y around inf 87.2%
Taylor expanded in z around inf 35.9%
*-commutative35.9%
Simplified35.9%
associate-/l*53.6%
*-commutative53.6%
Applied egg-rr53.6%
if -3e-11 < y < 5.8999999999999999e-99Initial program 99.9%
Taylor expanded in y around 0 76.6%
if 5.8999999999999999e-99 < y Initial program 81.7%
Taylor expanded in x around 0 55.8%
Final simplification63.6%
(FPCore (x y z) :precision binary64 (if (<= y -5.9e-12) y (if (<= y 3.35e-102) (/ x z) y)))
double code(double x, double y, double z) {
double tmp;
if (y <= -5.9e-12) {
tmp = y;
} else if (y <= 3.35e-102) {
tmp = x / z;
} else {
tmp = 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 (y <= (-5.9d-12)) then
tmp = y
else if (y <= 3.35d-102) then
tmp = x / z
else
tmp = y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -5.9e-12) {
tmp = y;
} else if (y <= 3.35e-102) {
tmp = x / z;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -5.9e-12: tmp = y elif y <= 3.35e-102: tmp = x / z else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if (y <= -5.9e-12) tmp = y; elseif (y <= 3.35e-102) tmp = Float64(x / z); else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -5.9e-12) tmp = y; elseif (y <= 3.35e-102) tmp = x / z; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -5.9e-12], y, If[LessEqual[y, 3.35e-102], N[(x / z), $MachinePrecision], y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.9 \cdot 10^{-12}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 3.35 \cdot 10^{-102}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < -5.9e-12 or 3.35e-102 < y Initial program 84.4%
Taylor expanded in x around 0 50.5%
if -5.9e-12 < y < 3.35e-102Initial program 99.9%
Taylor expanded in y around 0 76.6%
(FPCore (x y z) :precision binary64 (if (<= x -7.2e-6) (* x (/ (- 1.0 y) z)) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if (x <= -7.2e-6) {
tmp = x * ((1.0 - y) / z);
} else {
tmp = y + (x / z);
}
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 <= (-7.2d-6)) then
tmp = x * ((1.0d0 - y) / z)
else
tmp = y + (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -7.2e-6) {
tmp = x * ((1.0 - y) / z);
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -7.2e-6: tmp = x * ((1.0 - y) / z) else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -7.2e-6) tmp = Float64(x * Float64(Float64(1.0 - y) / z)); else tmp = Float64(y + Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -7.2e-6) tmp = x * ((1.0 - y) / z); else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -7.2e-6], N[(x * N[(N[(1.0 - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.2 \cdot 10^{-6}:\\
\;\;\;\;x \cdot \frac{1 - y}{z}\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if x < -7.19999999999999967e-6Initial program 92.6%
Taylor expanded in x around inf 83.2%
associate-/l*84.9%
mul-1-neg84.9%
unsub-neg84.9%
Simplified84.9%
if -7.19999999999999967e-6 < x Initial program 90.1%
Taylor expanded in x around 0 91.2%
Taylor expanded in y around 0 84.4%
(FPCore (x y z) :precision binary64 (if (<= x -5.5e+299) (* x (- (/ y z))) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if (x <= -5.5e+299) {
tmp = x * -(y / z);
} else {
tmp = y + (x / z);
}
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 <= (-5.5d+299)) then
tmp = x * -(y / z)
else
tmp = y + (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -5.5e+299) {
tmp = x * -(y / z);
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -5.5e+299: tmp = x * -(y / z) else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -5.5e+299) tmp = Float64(x * Float64(-Float64(y / z))); else tmp = Float64(y + Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -5.5e+299) tmp = x * -(y / z); else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -5.5e+299], N[(x * (-N[(y / z), $MachinePrecision])), $MachinePrecision], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.5 \cdot 10^{+299}:\\
\;\;\;\;x \cdot \left(-\frac{y}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if x < -5.5000000000000003e299Initial program 84.9%
Taylor expanded in x around inf 84.9%
associate-/l*89.1%
mul-1-neg89.1%
unsub-neg89.1%
Simplified89.1%
Taylor expanded in y around inf 89.1%
neg-mul-184.9%
Simplified89.1%
if -5.5000000000000003e299 < x Initial program 90.8%
Taylor expanded in x around 0 93.2%
Taylor expanded in y around 0 79.9%
Final simplification80.1%
(FPCore (x y z) :precision binary64 (+ y (/ x z)))
double code(double x, double y, double z) {
return y + (x / z);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = y + (x / z)
end function
public static double code(double x, double y, double z) {
return y + (x / z);
}
def code(x, y, z): return y + (x / z)
function code(x, y, z) return Float64(y + Float64(x / z)) end
function tmp = code(x, y, z) tmp = y + (x / z); end
code[x_, y_, z_] := N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y + \frac{x}{z}
\end{array}
Initial program 90.7%
Taylor expanded in x around 0 93.3%
Taylor expanded in y around 0 78.5%
(FPCore (x y z) :precision binary64 y)
double code(double x, double y, double z) {
return y;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = y
end function
public static double code(double x, double y, double z) {
return y;
}
def code(x, y, z): return y
function code(x, y, z) return y end
function tmp = code(x, y, z) tmp = y; end
code[x_, y_, z_] := y
\begin{array}{l}
\\
y
\end{array}
Initial program 90.7%
Taylor expanded in x around 0 40.4%
(FPCore (x y z) :precision binary64 (- (+ y (/ x z)) (/ y (/ z x))))
double code(double x, double y, double z) {
return (y + (x / z)) - (y / (z / x));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (y + (x / z)) - (y / (z / x))
end function
public static double code(double x, double y, double z) {
return (y + (x / z)) - (y / (z / x));
}
def code(x, y, z): return (y + (x / z)) - (y / (z / x))
function code(x, y, z) return Float64(Float64(y + Float64(x / z)) - Float64(y / Float64(z / x))) end
function tmp = code(x, y, z) tmp = (y + (x / z)) - (y / (z / x)); end
code[x_, y_, z_] := N[(N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision] - N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(y + \frac{x}{z}\right) - \frac{y}{\frac{z}{x}}
\end{array}
herbie shell --seed 2024132
(FPCore (x y z)
:name "Diagrams.Backend.Rasterific:rasterificRadialGradient from diagrams-rasterific-1.3.1.3"
:precision binary64
:alt
(! :herbie-platform default (- (+ y (/ x z)) (/ y (/ z x))))
(/ (+ x (* y (- z x))) z))