(FPCore (x y z) :precision binary64 (/ (* x (- y z)) y))
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- x (/ x (/ y z)))))
(if (<= x -2.5475090785488885e-183)
t_0
(if (<= x 6.005781062679642e-122) (- x (* z (/ x y))) t_0))))double code(double x, double y, double z) {
return (x * (y - z)) / y;
}
double code(double x, double y, double z) {
double t_0 = x - (x / (y / z));
double tmp;
if (x <= -2.5475090785488885e-183) {
tmp = t_0;
} else if (x <= 6.005781062679642e-122) {
tmp = x - (z * (x / y));
} else {
tmp = t_0;
}
return tmp;
}
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)) / y
end 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 - (x / (y / z))
if (x <= (-2.5475090785488885d-183)) then
tmp = t_0
else if (x <= 6.005781062679642d-122) then
tmp = x - (z * (x / y))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
return (x * (y - z)) / y;
}
public static double code(double x, double y, double z) {
double t_0 = x - (x / (y / z));
double tmp;
if (x <= -2.5475090785488885e-183) {
tmp = t_0;
} else if (x <= 6.005781062679642e-122) {
tmp = x - (z * (x / y));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): return (x * (y - z)) / y
def code(x, y, z): t_0 = x - (x / (y / z)) tmp = 0 if x <= -2.5475090785488885e-183: tmp = t_0 elif x <= 6.005781062679642e-122: tmp = x - (z * (x / y)) else: tmp = t_0 return tmp
function code(x, y, z) return Float64(Float64(x * Float64(y - z)) / y) end
function code(x, y, z) t_0 = Float64(x - Float64(x / Float64(y / z))) tmp = 0.0 if (x <= -2.5475090785488885e-183) tmp = t_0; elseif (x <= 6.005781062679642e-122) tmp = Float64(x - Float64(z * Float64(x / y))); else tmp = t_0; end return tmp end
function tmp = code(x, y, z) tmp = (x * (y - z)) / y; end
function tmp_2 = code(x, y, z) t_0 = x - (x / (y / z)); tmp = 0.0; if (x <= -2.5475090785488885e-183) tmp = t_0; elseif (x <= 6.005781062679642e-122) tmp = x - (z * (x / y)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]
code[x_, y_, z_] := Block[{t$95$0 = N[(x - N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.5475090785488885e-183], t$95$0, If[LessEqual[x, 6.005781062679642e-122], N[(x - N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\frac{x \cdot \left(y - z\right)}{y}
\begin{array}{l}
t_0 := x - \frac{x}{\frac{y}{z}}\\
\mathbf{if}\;x \leq -2.5475090785488885 \cdot 10^{-183}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 6.005781062679642 \cdot 10^{-122}:\\
\;\;\;\;x - z \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
Results
| Original | 12.8 |
|---|---|
| Target | 3.0 |
| Herbie | 2.2 |
if x < -2.54750907854888853e-183 or 6.00578106267964183e-122 < x Initial program 14.4
Simplified4.9
Taylor expanded in x around 0 1.5
Taylor expanded in z around 0 4.5
Simplified1.3
if -2.54750907854888853e-183 < x < 6.00578106267964183e-122Initial program 8.7
Simplified4.5
Applied egg-rr4.2
Final simplification2.2
herbie shell --seed 2022186
(FPCore (x y z)
:name "Diagrams.Backend.Cairo.Internal:setTexture from diagrams-cairo-1.3.0.3"
:precision binary64
:herbie-target
(if (< z -2.060202331921739e+104) (- x (/ (* z x) y)) (if (< z 1.6939766013828526e+213) (/ x (/ y (- y z))) (* (- y z) (/ x y))))
(/ (* x (- y z)) y))