(FPCore (x y z t) :precision binary64 (/ (* x (- y z)) (- t z)))
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ z (- t z))))
(if (<= x -1.1573558099256976e-117)
(- (* y (/ x (- t z))) (* x t_1))
(if (<= x 563.0956741630507)
(/ (* x (- z y)) (- z t))
(* x (- (/ y (- t z)) t_1))))))double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - z);
}
double code(double x, double y, double z, double t) {
double t_1 = z / (t - z);
double tmp;
if (x <= -1.1573558099256976e-117) {
tmp = (y * (x / (t - z))) - (x * t_1);
} else if (x <= 563.0956741630507) {
tmp = (x * (z - y)) / (z - t);
} else {
tmp = x * ((y / (t - z)) - t_1);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * (y - z)) / (t - z)
end function
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = z / (t - z)
if (x <= (-1.1573558099256976d-117)) then
tmp = (y * (x / (t - z))) - (x * t_1)
else if (x <= 563.0956741630507d0) then
tmp = (x * (z - y)) / (z - t)
else
tmp = x * ((y / (t - z)) - t_1)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - z);
}
public static double code(double x, double y, double z, double t) {
double t_1 = z / (t - z);
double tmp;
if (x <= -1.1573558099256976e-117) {
tmp = (y * (x / (t - z))) - (x * t_1);
} else if (x <= 563.0956741630507) {
tmp = (x * (z - y)) / (z - t);
} else {
tmp = x * ((y / (t - z)) - t_1);
}
return tmp;
}
def code(x, y, z, t): return (x * (y - z)) / (t - z)
def code(x, y, z, t): t_1 = z / (t - z) tmp = 0 if x <= -1.1573558099256976e-117: tmp = (y * (x / (t - z))) - (x * t_1) elif x <= 563.0956741630507: tmp = (x * (z - y)) / (z - t) else: tmp = x * ((y / (t - z)) - t_1) return tmp
function code(x, y, z, t) return Float64(Float64(x * Float64(y - z)) / Float64(t - z)) end
function code(x, y, z, t) t_1 = Float64(z / Float64(t - z)) tmp = 0.0 if (x <= -1.1573558099256976e-117) tmp = Float64(Float64(y * Float64(x / Float64(t - z))) - Float64(x * t_1)); elseif (x <= 563.0956741630507) tmp = Float64(Float64(x * Float64(z - y)) / Float64(z - t)); else tmp = Float64(x * Float64(Float64(y / Float64(t - z)) - t_1)); end return tmp end
function tmp = code(x, y, z, t) tmp = (x * (y - z)) / (t - z); end
function tmp_2 = code(x, y, z, t) t_1 = z / (t - z); tmp = 0.0; if (x <= -1.1573558099256976e-117) tmp = (y * (x / (t - z))) - (x * t_1); elseif (x <= 563.0956741630507) tmp = (x * (z - y)) / (z - t); else tmp = x * ((y / (t - z)) - t_1); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z / N[(t - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.1573558099256976e-117], N[(N[(y * N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 563.0956741630507], N[(N[(x * N[(z - y), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y / N[(t - z), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\frac{x \cdot \left(y - z\right)}{t - z}
\begin{array}{l}
t_1 := \frac{z}{t - z}\\
\mathbf{if}\;x \leq -1.1573558099256976 \cdot 10^{-117}:\\
\;\;\;\;y \cdot \frac{x}{t - z} - x \cdot t_1\\
\mathbf{elif}\;x \leq 563.0956741630507:\\
\;\;\;\;\frac{x \cdot \left(z - y\right)}{z - t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{t - z} - t_1\right)\\
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 11.8 |
|---|---|
| Target | 2.3 |
| Herbie | 2.7 |
if x < -1.1573558099256976e-117Initial program 16.7
Simplified1.7
Taylor expanded in x around 0 16.7
Simplified1.8
Applied egg-rr4.8
Taylor expanded in x around 0 15.5
Simplified3.2
if -1.1573558099256976e-117 < x < 563.0956741630507Initial program 2.5
Simplified2.7
Taylor expanded in x around 0 2.5
Simplified2.4
Applied egg-rr2.6
Applied egg-rr2.5
if 563.0956741630507 < x Initial program 22.5
Simplified2.4
Taylor expanded in x around 0 22.5
Simplified2.6
Applied egg-rr2.9
Taylor expanded in x around -inf 2.4
Simplified2.4
Final simplification2.7
herbie shell --seed 2022153
(FPCore (x y z t)
:name "Graphics.Rendering.Chart.Plot.AreaSpots:renderAreaSpots4D from Chart-1.5.3"
:precision binary64
:herbie-target
(/ x (/ (- t z) (- y z)))
(/ (* x (- y z)) (- t z)))