
(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 10 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 (+ y (* (/ x z) (- 1.0 y))))
double code(double x, double y, double z) {
return y + ((x / z) * (1.0 - 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 + ((x / z) * (1.0d0 - y))
end function
public static double code(double x, double y, double z) {
return y + ((x / z) * (1.0 - y));
}
def code(x, y, z): return y + ((x / z) * (1.0 - y))
function code(x, y, z) return Float64(y + Float64(Float64(x / z) * Float64(1.0 - y))) end
function tmp = code(x, y, z) tmp = y + ((x / z) * (1.0 - y)); end
code[x_, y_, z_] := N[(y + N[(N[(x / z), $MachinePrecision] * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y + \frac{x}{z} \cdot \left(1 - y\right)
\end{array}
Initial program 88.6%
Taylor expanded in y around 0 92.5%
Taylor expanded in x around 0 96.9%
+-commutative96.9%
neg-mul-196.9%
sub-neg96.9%
div-sub96.9%
associate-*r/96.7%
associate-*l/100.0%
Simplified100.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -155000000000.0) (not (<= y 1.0))) (* y (- 1.0 (/ x z))) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -155000000000.0) || !(y <= 1.0)) {
tmp = y * (1.0 - (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 <= (-155000000000.0d0)) .or. (.not. (y <= 1.0d0))) then
tmp = y * (1.0d0 - (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 <= -155000000000.0) || !(y <= 1.0)) {
tmp = y * (1.0 - (x / z));
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -155000000000.0) or not (y <= 1.0): tmp = y * (1.0 - (x / z)) else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -155000000000.0) || !(y <= 1.0)) tmp = Float64(y * Float64(1.0 - Float64(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 <= -155000000000.0) || ~((y <= 1.0))) tmp = y * (1.0 - (x / z)); else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -155000000000.0], N[Not[LessEqual[y, 1.0]], $MachinePrecision]], N[(y * N[(1.0 - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -155000000000 \lor \neg \left(y \leq 1\right):\\
\;\;\;\;y \cdot \left(1 - \frac{x}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if y < -1.55e11 or 1 < y Initial program 77.2%
Taylor expanded in y around inf 76.2%
associate-/l*98.9%
div-sub98.9%
sub-neg98.9%
*-inverses98.9%
sub-neg98.9%
Simplified98.9%
if -1.55e11 < y < 1Initial program 99.9%
Taylor expanded in y around 0 90.6%
Taylor expanded in x around 0 98.8%
Final simplification98.9%
(FPCore (x y z) :precision binary64 (if (or (<= x -2.55e-64) (not (<= x 53000.0))) (* x (/ (- 1.0 y) z)) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -2.55e-64) || !(x <= 53000.0)) {
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 <= (-2.55d-64)) .or. (.not. (x <= 53000.0d0))) 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 <= -2.55e-64) || !(x <= 53000.0)) {
tmp = x * ((1.0 - y) / z);
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -2.55e-64) or not (x <= 53000.0): tmp = x * ((1.0 - y) / z) else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -2.55e-64) || !(x <= 53000.0)) 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 <= -2.55e-64) || ~((x <= 53000.0))) tmp = x * ((1.0 - y) / z); else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -2.55e-64], N[Not[LessEqual[x, 53000.0]], $MachinePrecision]], 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 -2.55 \cdot 10^{-64} \lor \neg \left(x \leq 53000\right):\\
\;\;\;\;x \cdot \frac{1 - y}{z}\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if x < -2.54999999999999992e-64 or 53000 < x Initial program 90.9%
Taylor expanded in x around inf 85.0%
associate-/l*87.3%
mul-1-neg87.3%
unsub-neg87.3%
Simplified87.3%
if -2.54999999999999992e-64 < x < 53000Initial program 85.5%
Taylor expanded in y around 0 100.0%
Taylor expanded in x around 0 91.1%
Final simplification89.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.1e+107) (not (<= y 1.16e+172))) (* (/ x z) (- y)) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.1e+107) || !(y <= 1.16e+172)) {
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 <= (-2.1d+107)) .or. (.not. (y <= 1.16d+172))) 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 <= -2.1e+107) || !(y <= 1.16e+172)) {
tmp = (x / z) * -y;
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.1e+107) or not (y <= 1.16e+172): tmp = (x / z) * -y else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.1e+107) || !(y <= 1.16e+172)) 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 <= -2.1e+107) || ~((y <= 1.16e+172))) tmp = (x / z) * -y; else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.1e+107], N[Not[LessEqual[y, 1.16e+172]], $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 -2.1 \cdot 10^{+107} \lor \neg \left(y \leq 1.16 \cdot 10^{+172}\right):\\
\;\;\;\;\frac{x}{z} \cdot \left(-y\right)\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if y < -2.1e107 or 1.15999999999999994e172 < y Initial program 74.2%
Taylor expanded in x around inf 63.0%
mul-1-neg63.0%
unsub-neg63.0%
Simplified63.0%
Taylor expanded in y around inf 63.0%
neg-mul-165.7%
Simplified63.0%
associate-/l*60.3%
*-commutative60.3%
add-sqr-sqrt33.5%
sqrt-unprod31.6%
sqr-neg31.6%
sqrt-unprod0.3%
add-sqr-sqrt0.9%
associate-/r/0.9%
frac-2neg0.9%
associate-/r/0.9%
Applied egg-rr60.3%
Taylor expanded in y around 0 63.0%
mul-1-neg63.0%
*-commutative63.0%
distribute-frac-neg263.0%
associate-/l*65.6%
Simplified65.6%
if -2.1e107 < y < 1.15999999999999994e172Initial program 93.8%
Taylor expanded in y around 0 93.0%
Taylor expanded in x around 0 88.7%
Final simplification82.6%
(FPCore (x y z) :precision binary64 (if (<= y -2.1e+107) (/ (- y) (/ z x)) (if (<= y 1.65e+172) (+ y (/ x z)) (* (/ x z) (- y)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.1e+107) {
tmp = -y / (z / x);
} else if (y <= 1.65e+172) {
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 <= (-2.1d+107)) then
tmp = -y / (z / x)
else if (y <= 1.65d+172) 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 <= -2.1e+107) {
tmp = -y / (z / x);
} else if (y <= 1.65e+172) {
tmp = y + (x / z);
} else {
tmp = (x / z) * -y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.1e+107: tmp = -y / (z / x) elif y <= 1.65e+172: tmp = y + (x / z) else: tmp = (x / z) * -y return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.1e+107) tmp = Float64(Float64(-y) / Float64(z / x)); elseif (y <= 1.65e+172) 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 <= -2.1e+107) tmp = -y / (z / x); elseif (y <= 1.65e+172) tmp = y + (x / z); else tmp = (x / z) * -y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.1e+107], N[((-y) / N[(z / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.65e+172], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], N[(N[(x / z), $MachinePrecision] * (-y)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.1 \cdot 10^{+107}:\\
\;\;\;\;\frac{-y}{\frac{z}{x}}\\
\mathbf{elif}\;y \leq 1.65 \cdot 10^{+172}:\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} \cdot \left(-y\right)\\
\end{array}
\end{array}
if y < -2.1e107Initial program 69.1%
Taylor expanded in x around inf 58.5%
associate-/l*54.2%
mul-1-neg54.2%
unsub-neg54.2%
Simplified54.2%
associate-*r/58.5%
clear-num58.5%
associate-/r*62.8%
Applied egg-rr62.8%
associate-/r/62.8%
associate-*l/62.9%
*-lft-identity62.9%
Simplified62.9%
Taylor expanded in y around inf 62.9%
neg-mul-162.9%
Simplified62.9%
if -2.1e107 < y < 1.64999999999999991e172Initial program 93.8%
Taylor expanded in y around 0 93.0%
Taylor expanded in x around 0 88.7%
if 1.64999999999999991e172 < y Initial program 82.4%
Taylor expanded in x around inf 70.2%
mul-1-neg70.2%
unsub-neg70.2%
Simplified70.2%
Taylor expanded in y around inf 70.2%
neg-mul-170.3%
Simplified70.2%
associate-/l*70.2%
*-commutative70.2%
add-sqr-sqrt0.0%
sqrt-unprod1.3%
sqr-neg1.3%
sqrt-unprod0.8%
add-sqr-sqrt0.8%
associate-/r/0.7%
frac-2neg0.7%
associate-/r/0.8%
Applied egg-rr70.2%
Taylor expanded in y around 0 70.2%
mul-1-neg70.2%
*-commutative70.2%
distribute-frac-neg270.2%
associate-/l*70.3%
Simplified70.3%
Final simplification82.6%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.3e-65) (not (<= x 1.5e-27))) (/ x z) y))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.3e-65) || !(x <= 1.5e-27)) {
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 ((x <= (-1.3d-65)) .or. (.not. (x <= 1.5d-27))) 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 ((x <= -1.3e-65) || !(x <= 1.5e-27)) {
tmp = x / z;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.3e-65) or not (x <= 1.5e-27): tmp = x / z else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.3e-65) || !(x <= 1.5e-27)) tmp = Float64(x / z); else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.3e-65) || ~((x <= 1.5e-27))) tmp = x / z; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.3e-65], N[Not[LessEqual[x, 1.5e-27]], $MachinePrecision]], N[(x / z), $MachinePrecision], y]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.3 \cdot 10^{-65} \lor \neg \left(x \leq 1.5 \cdot 10^{-27}\right):\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if x < -1.30000000000000005e-65 or 1.5000000000000001e-27 < x Initial program 91.3%
Taylor expanded in y around 0 54.3%
if -1.30000000000000005e-65 < x < 1.5000000000000001e-27Initial program 84.7%
Taylor expanded in x around 0 78.6%
Final simplification64.3%
(FPCore (x y z) :precision binary64 (if (<= y 4.3e+172) (+ y (/ x z)) (* x (/ (- y) z))))
double code(double x, double y, double z) {
double tmp;
if (y <= 4.3e+172) {
tmp = y + (x / z);
} else {
tmp = x * (-y / 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 <= 4.3d+172) then
tmp = y + (x / z)
else
tmp = x * (-y / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 4.3e+172) {
tmp = y + (x / z);
} else {
tmp = x * (-y / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 4.3e+172: tmp = y + (x / z) else: tmp = x * (-y / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 4.3e+172) tmp = Float64(y + Float64(x / z)); else tmp = Float64(x * Float64(Float64(-y) / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 4.3e+172) tmp = y + (x / z); else tmp = x * (-y / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 4.3e+172], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x * N[((-y) / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.3 \cdot 10^{+172}:\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-y}{z}\\
\end{array}
\end{array}
if y < 4.3000000000000003e172Initial program 89.3%
Taylor expanded in y around 0 94.3%
Taylor expanded in x around 0 81.7%
if 4.3000000000000003e172 < y Initial program 82.4%
Taylor expanded in x around inf 70.2%
associate-/l*70.2%
mul-1-neg70.2%
unsub-neg70.2%
Simplified70.2%
Taylor expanded in y around inf 70.2%
neg-mul-170.2%
distribute-neg-frac70.2%
Simplified70.2%
(FPCore (x y z) :precision binary64 (if (<= y 1.0) (+ y (/ x z)) (- y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if (y <= 1.0) {
tmp = y + (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 <= 1.0d0) then
tmp = y + (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 <= 1.0) {
tmp = y + (x / z);
} else {
tmp = y - (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 1.0: tmp = y + (x / z) else: tmp = y - (x / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 1.0) tmp = Float64(y + Float64(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 <= 1.0) tmp = y + (x / z); else tmp = y - (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 1.0], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1:\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y - \frac{x}{z}\\
\end{array}
\end{array}
if y < 1Initial program 90.9%
Taylor expanded in y around 0 93.8%
Taylor expanded in x around 0 85.2%
if 1 < y Initial program 81.0%
Taylor expanded in y around 0 88.3%
Taylor expanded in x around 0 48.9%
add-sqr-sqrt18.8%
sqrt-unprod56.7%
sqr-neg56.7%
sqrt-unprod34.3%
add-sqr-sqrt61.9%
distribute-neg-frac61.9%
Applied egg-rr61.9%
Taylor expanded in y around 0 61.9%
(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 88.6%
Taylor expanded in y around 0 92.5%
Taylor expanded in x around 0 76.7%
(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 88.6%
Taylor expanded in x around 0 41.0%
(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 2024176
(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))