(FPCore (x y z t) :precision binary64 (/ (* x (- y z)) (- t z)))
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (* x (- y z)) (- t z))))
(if (<= t_1 -2e+63)
(/ x (/ (- t z) (- y z)))
(if (<= t_1 2e+299)
(- (/ (* x y) (- t z)) (/ (* x z) (- t z)))
(* x (/ (- y z) (- t z)))))))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 = (x * (y - z)) / (t - z);
double tmp;
if (t_1 <= -2e+63) {
tmp = x / ((t - z) / (y - z));
} else if (t_1 <= 2e+299) {
tmp = ((x * y) / (t - z)) - ((x * z) / (t - z));
} else {
tmp = x * ((y - z) / (t - z));
}
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 = (x * (y - z)) / (t - z)
if (t_1 <= (-2d+63)) then
tmp = x / ((t - z) / (y - z))
else if (t_1 <= 2d+299) then
tmp = ((x * y) / (t - z)) - ((x * z) / (t - z))
else
tmp = x * ((y - z) / (t - z))
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 = (x * (y - z)) / (t - z);
double tmp;
if (t_1 <= -2e+63) {
tmp = x / ((t - z) / (y - z));
} else if (t_1 <= 2e+299) {
tmp = ((x * y) / (t - z)) - ((x * z) / (t - z));
} else {
tmp = x * ((y - z) / (t - z));
}
return tmp;
}
def code(x, y, z, t): return (x * (y - z)) / (t - z)
def code(x, y, z, t): t_1 = (x * (y - z)) / (t - z) tmp = 0 if t_1 <= -2e+63: tmp = x / ((t - z) / (y - z)) elif t_1 <= 2e+299: tmp = ((x * y) / (t - z)) - ((x * z) / (t - z)) else: tmp = x * ((y - z) / (t - z)) 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(Float64(x * Float64(y - z)) / Float64(t - z)) tmp = 0.0 if (t_1 <= -2e+63) tmp = Float64(x / Float64(Float64(t - z) / Float64(y - z))); elseif (t_1 <= 2e+299) tmp = Float64(Float64(Float64(x * y) / Float64(t - z)) - Float64(Float64(x * z) / Float64(t - z))); else tmp = Float64(x * Float64(Float64(y - z) / Float64(t - z))); 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 = (x * (y - z)) / (t - z); tmp = 0.0; if (t_1 <= -2e+63) tmp = x / ((t - z) / (y - z)); elseif (t_1 <= 2e+299) tmp = ((x * y) / (t - z)) - ((x * z) / (t - z)); else tmp = x * ((y - z) / (t - z)); 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[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+63], N[(x / N[(N[(t - z), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+299], N[(N[(N[(x * y), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision] - N[(N[(x * z), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y - z), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\frac{x \cdot \left(y - z\right)}{t - z}
\begin{array}{l}
t_1 := \frac{x \cdot \left(y - z\right)}{t - z}\\
\mathbf{if}\;t_1 \leq -2 \cdot 10^{+63}:\\
\;\;\;\;\frac{x}{\frac{t - z}{y - z}}\\
\mathbf{elif}\;t_1 \leq 2 \cdot 10^{+299}:\\
\;\;\;\;\frac{x \cdot y}{t - z} - \frac{x \cdot z}{t - z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y - z}{t - z}\\
\end{array}
Results
| Original | 11.5 |
|---|---|
| Target | 2.3 |
| Herbie | 1.6 |
if (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < -2.00000000000000012e63Initial program 29.2
Simplified2.9
Applied egg-rr2.7
if -2.00000000000000012e63 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < 2.0000000000000001e299Initial program 1.5
Simplified2.4
Taylor expanded in y around 0 1.5
if 2.0000000000000001e299 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) Initial program 62.5
Simplified0.5
Final simplification1.6
herbie shell --seed 2022210
(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)))