
(FPCore (x y z t) :precision binary64 (/ (* x (- y z)) (- t z)))
double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - z);
}
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
public static double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - z);
}
def code(x, y, z, t): return (x * (y - z)) / (t - z)
function code(x, y, z, t) return Float64(Float64(x * Float64(y - z)) / Float64(t - z)) end
function tmp = code(x, y, z, t) tmp = (x * (y - z)) / (t - z); end
code[x_, y_, z_, t_] := N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(y - z\right)}{t - z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (/ (* x (- y z)) (- t z)))
double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - z);
}
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
public static double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - z);
}
def code(x, y, z, t): return (x * (y - z)) / (t - z)
function code(x, y, z, t) return Float64(Float64(x * Float64(y - z)) / Float64(t - z)) end
function tmp = code(x, y, z, t) tmp = (x * (y - z)) / (t - z); end
code[x_, y_, z_, t_] := N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(y - z\right)}{t - z}
\end{array}
(FPCore (x y z t) :precision binary64 (* x (/ (- y z) (- t z))))
double code(double x, double y, double z, double t) {
return x * ((y - z) / (t - z));
}
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
public static double code(double x, double y, double z, double t) {
return x * ((y - z) / (t - z));
}
def code(x, y, z, t): return x * ((y - z) / (t - z))
function code(x, y, z, t) return Float64(x * Float64(Float64(y - z) / Float64(t - z))) end
function tmp = code(x, y, z, t) tmp = x * ((y - z) / (t - z)); end
code[x_, y_, z_, t_] := N[(x * N[(N[(y - z), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \frac{y - z}{t - z}
\end{array}
(FPCore (x y z t)
:precision binary64
(if (<= z -2.9e-13)
(- x (/ (* x y) z))
(if (<= z 6e+97)
(* x (/ y (- t z)))
(if (<= z 7.2e+172) (/ (* x z) (- z t)) (+ x (* x (/ t z)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.9e-13) {
tmp = x - ((x * y) / z);
} else if (z <= 6e+97) {
tmp = x * (y / (t - z));
} else if (z <= 7.2e+172) {
tmp = (x * z) / (z - t);
} else {
tmp = x + (x * (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
real(8) :: tmp
if (z <= (-2.9d-13)) then
tmp = x - ((x * y) / z)
else if (z <= 6d+97) then
tmp = x * (y / (t - z))
else if (z <= 7.2d+172) then
tmp = (x * z) / (z - t)
else
tmp = x + (x * (t / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.9e-13) {
tmp = x - ((x * y) / z);
} else if (z <= 6e+97) {
tmp = x * (y / (t - z));
} else if (z <= 7.2e+172) {
tmp = (x * z) / (z - t);
} else {
tmp = x + (x * (t / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.9e-13: tmp = x - ((x * y) / z) elif z <= 6e+97: tmp = x * (y / (t - z)) elif z <= 7.2e+172: tmp = (x * z) / (z - t) else: tmp = x + (x * (t / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.9e-13) tmp = Float64(x - Float64(Float64(x * y) / z)); elseif (z <= 6e+97) tmp = Float64(x * Float64(y / Float64(t - z))); elseif (z <= 7.2e+172) tmp = Float64(Float64(x * z) / Float64(z - t)); else tmp = Float64(x + Float64(x * Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -2.9e-13) tmp = x - ((x * y) / z); elseif (z <= 6e+97) tmp = x * (y / (t - z)); elseif (z <= 7.2e+172) tmp = (x * z) / (z - t); else tmp = x + (x * (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.9e-13], N[(x - N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6e+97], N[(x * N[(y / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.2e+172], N[(N[(x * z), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision], N[(x + N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.9 \cdot 10^{-13}:\\
\;\;\;\;x - \frac{x \cdot y}{z}\\
\mathbf{elif}\;z \leq 6 \cdot 10^{+97}:\\
\;\;\;\;x \cdot \frac{y}{t - z}\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{+172}:\\
\;\;\;\;\frac{x \cdot z}{z - t}\\
\mathbf{else}:\\
\;\;\;\;x + x \cdot \frac{t}{z}\\
\end{array}
\end{array}
(FPCore (x y z t) :precision binary64 (if (or (<= y -5.5e-33) (not (<= y 1.06e-10))) (* x (/ y (- t z))) (* z (/ x (- z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -5.5e-33) || !(y <= 1.06e-10)) {
tmp = x * (y / (t - z));
} else {
tmp = z * (x / (z - t));
}
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
real(8) :: tmp
if ((y <= (-5.5d-33)) .or. (.not. (y <= 1.06d-10))) then
tmp = x * (y / (t - z))
else
tmp = z * (x / (z - t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -5.5e-33) || !(y <= 1.06e-10)) {
tmp = x * (y / (t - z));
} else {
tmp = z * (x / (z - t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -5.5e-33) or not (y <= 1.06e-10): tmp = x * (y / (t - z)) else: tmp = z * (x / (z - t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -5.5e-33) || !(y <= 1.06e-10)) tmp = Float64(x * Float64(y / Float64(t - z))); else tmp = Float64(z * Float64(x / Float64(z - t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -5.5e-33) || ~((y <= 1.06e-10))) tmp = x * (y / (t - z)); else tmp = z * (x / (z - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -5.5e-33], N[Not[LessEqual[y, 1.06e-10]], $MachinePrecision]], N[(x * N[(y / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(x / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.5 \cdot 10^{-33} \lor \neg \left(y \leq 1.06 \cdot 10^{-10}\right):\\
\;\;\;\;x \cdot \frac{y}{t - z}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{x}{z - t}\\
\end{array}
\end{array}
(FPCore (x y z t) :precision binary64 (if (or (<= z -5e-17) (not (<= z 9.6e+97))) (- x (/ (* x y) z)) (* x (/ y (- t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5e-17) || !(z <= 9.6e+97)) {
tmp = x - ((x * y) / z);
} else {
tmp = x * (y / (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
real(8) :: tmp
if ((z <= (-5d-17)) .or. (.not. (z <= 9.6d+97))) then
tmp = x - ((x * y) / z)
else
tmp = x * (y / (t - z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5e-17) || !(z <= 9.6e+97)) {
tmp = x - ((x * y) / z);
} else {
tmp = x * (y / (t - z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5e-17) or not (z <= 9.6e+97): tmp = x - ((x * y) / z) else: tmp = x * (y / (t - z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5e-17) || !(z <= 9.6e+97)) tmp = Float64(x - Float64(Float64(x * y) / z)); else tmp = Float64(x * Float64(y / Float64(t - z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -5e-17) || ~((z <= 9.6e+97))) tmp = x - ((x * y) / z); else tmp = x * (y / (t - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5e-17], N[Not[LessEqual[z, 9.6e+97]], $MachinePrecision]], N[(x - N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{-17} \lor \neg \left(z \leq 9.6 \cdot 10^{+97}\right):\\
\;\;\;\;x - \frac{x \cdot y}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{t - z}\\
\end{array}
\end{array}
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.15e-12) (not (<= z 7.5e+38))) (* x (/ (- z y) z)) (* x (/ y (- t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.15e-12) || !(z <= 7.5e+38)) {
tmp = x * ((z - y) / z);
} else {
tmp = x * (y / (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
real(8) :: tmp
if ((z <= (-2.15d-12)) .or. (.not. (z <= 7.5d+38))) then
tmp = x * ((z - y) / z)
else
tmp = x * (y / (t - z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.15e-12) || !(z <= 7.5e+38)) {
tmp = x * ((z - y) / z);
} else {
tmp = x * (y / (t - z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.15e-12) or not (z <= 7.5e+38): tmp = x * ((z - y) / z) else: tmp = x * (y / (t - z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.15e-12) || !(z <= 7.5e+38)) tmp = Float64(x * Float64(Float64(z - y) / z)); else tmp = Float64(x * Float64(y / Float64(t - z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -2.15e-12) || ~((z <= 7.5e+38))) tmp = x * ((z - y) / z); else tmp = x * (y / (t - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.15e-12], N[Not[LessEqual[z, 7.5e+38]], $MachinePrecision]], N[(x * N[(N[(z - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.15 \cdot 10^{-12} \lor \neg \left(z \leq 7.5 \cdot 10^{+38}\right):\\
\;\;\;\;x \cdot \frac{z - y}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{t - z}\\
\end{array}
\end{array}
(FPCore (x y z t) :precision binary64 (if (<= z -2.9e-13) x (if (<= z 1.2e+161) (* x (/ y (- t z))) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.9e-13) {
tmp = x;
} else if (z <= 1.2e+161) {
tmp = x * (y / (t - z));
} else {
tmp = x;
}
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
real(8) :: tmp
if (z <= (-2.9d-13)) then
tmp = x
else if (z <= 1.2d+161) then
tmp = x * (y / (t - z))
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.9e-13) {
tmp = x;
} else if (z <= 1.2e+161) {
tmp = x * (y / (t - z));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.9e-13: tmp = x elif z <= 1.2e+161: tmp = x * (y / (t - z)) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.9e-13) tmp = x; elseif (z <= 1.2e+161) tmp = Float64(x * Float64(y / Float64(t - z))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -2.9e-13) tmp = x; elseif (z <= 1.2e+161) tmp = x * (y / (t - z)); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.9e-13], x, If[LessEqual[z, 1.2e+161], N[(x * N[(y / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.9 \cdot 10^{-13}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{+161}:\\
\;\;\;\;x \cdot \frac{y}{t - z}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
(FPCore (x y z t) :precision binary64 (if (<= z -6.3e-12) x (if (<= z 1.4e+41) (* x (/ y t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -6.3e-12) {
tmp = x;
} else if (z <= 1.4e+41) {
tmp = x * (y / t);
} else {
tmp = x;
}
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
real(8) :: tmp
if (z <= (-6.3d-12)) then
tmp = x
else if (z <= 1.4d+41) then
tmp = x * (y / t)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -6.3e-12) {
tmp = x;
} else if (z <= 1.4e+41) {
tmp = x * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -6.3e-12: tmp = x elif z <= 1.4e+41: tmp = x * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -6.3e-12) tmp = x; elseif (z <= 1.4e+41) tmp = Float64(x * Float64(y / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -6.3e-12) tmp = x; elseif (z <= 1.4e+41) tmp = x * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -6.3e-12], x, If[LessEqual[z, 1.4e+41], N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.3 \cdot 10^{-12}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{+41}:\\
\;\;\;\;x \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
(FPCore (x y z t) :precision binary64 (if (<= z -1.32e-14) x (if (<= z 2.9e+39) (/ x (/ t y)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.32e-14) {
tmp = x;
} else if (z <= 2.9e+39) {
tmp = x / (t / y);
} else {
tmp = x;
}
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
real(8) :: tmp
if (z <= (-1.32d-14)) then
tmp = x
else if (z <= 2.9d+39) then
tmp = x / (t / y)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.32e-14) {
tmp = x;
} else if (z <= 2.9e+39) {
tmp = x / (t / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.32e-14: tmp = x elif z <= 2.9e+39: tmp = x / (t / y) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.32e-14) tmp = x; elseif (z <= 2.9e+39) tmp = Float64(x / Float64(t / y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.32e-14) tmp = x; elseif (z <= 2.9e+39) tmp = x / (t / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.32e-14], x, If[LessEqual[z, 2.9e+39], N[(x / N[(t / y), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.32 \cdot 10^{-14}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{+39}:\\
\;\;\;\;\frac{x}{\frac{t}{y}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
return x;
}
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
end function
public static double code(double x, double y, double z, double t) {
return x;
}
def code(x, y, z, t): return x
function code(x, y, z, t) return x end
function tmp = code(x, y, z, t) tmp = x; end
code[x_, y_, z_, t_] := x
\begin{array}{l}
\\
x
\end{array}
(FPCore (x y z t) :precision binary64 (/ x (/ (- t z) (- y z))))
double code(double x, double y, double z, double t) {
return x / ((t - z) / (y - z));
}
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 / ((t - z) / (y - z))
end function
public static double code(double x, double y, double z, double t) {
return x / ((t - z) / (y - z));
}
def code(x, y, z, t): return x / ((t - z) / (y - z))
function code(x, y, z, t) return Float64(x / Float64(Float64(t - z) / Float64(y - z))) end
function tmp = code(x, y, z, t) tmp = x / ((t - z) / (y - z)); end
code[x_, y_, z_, t_] := N[(x / N[(N[(t - z), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{\frac{t - z}{y - z}}
\end{array}
herbie shell --seed 2023350
(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)))