
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) (- a t))))
double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (a - t));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + ((y * (z - t)) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (a - t));
}
def code(x, y, z, t, a): return x + ((y * (z - t)) / (a - t))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y * (z - t)) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{a - t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 7 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) (- a t))))
double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (a - t));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + ((y * (z - t)) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (a - t));
}
def code(x, y, z, t, a): return x + ((y * (z - t)) / (a - t))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y * (z - t)) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{a - t}
\end{array}
(FPCore (x y z t a) :precision binary64 (- x (* y (/ (- t z) (- a t)))))
double code(double x, double y, double z, double t, double a) {
return x - (y * ((t - z) / (a - t)));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x - (y * ((t - z) / (a - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x - (y * ((t - z) / (a - t)));
}
def code(x, y, z, t, a): return x - (y * ((t - z) / (a - t)))
function code(x, y, z, t, a) return Float64(x - Float64(y * Float64(Float64(t - z) / Float64(a - t)))) end
function tmp = code(x, y, z, t, a) tmp = x - (y * ((t - z) / (a - t))); end
code[x_, y_, z_, t_, a_] := N[(x - N[(y * N[(N[(t - z), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - y \cdot \frac{t - z}{a - t}
\end{array}
(FPCore (x y z t a) :precision binary64 (if (or (<= t -3.3e+139) (not (<= t 4.2e+76))) (+ x y) (+ x (* y (/ z (- a t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -3.3e+139) || !(t <= 4.2e+76)) {
tmp = x + y;
} else {
tmp = x + (y * (z / (a - t)));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((t <= (-3.3d+139)) .or. (.not. (t <= 4.2d+76))) then
tmp = x + y
else
tmp = x + (y * (z / (a - t)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -3.3e+139) || !(t <= 4.2e+76)) {
tmp = x + y;
} else {
tmp = x + (y * (z / (a - t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -3.3e+139) or not (t <= 4.2e+76): tmp = x + y else: tmp = x + (y * (z / (a - t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -3.3e+139) || !(t <= 4.2e+76)) tmp = Float64(x + y); else tmp = Float64(x + Float64(y * Float64(z / Float64(a - t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -3.3e+139) || ~((t <= 4.2e+76))) tmp = x + y; else tmp = x + (y * (z / (a - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -3.3e+139], N[Not[LessEqual[t, 4.2e+76]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(x + N[(y * N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.3 \cdot 10^{+139} \lor \neg \left(t \leq 4.2 \cdot 10^{+76}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{a - t}\\
\end{array}
\end{array}
(FPCore (x y z t a) :precision binary64 (if (or (<= t -2.9e+15) (not (<= t 3e+73))) (- x (/ y (/ t (- z t)))) (+ x (* y (/ z (- a t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2.9e+15) || !(t <= 3e+73)) {
tmp = x - (y / (t / (z - t)));
} else {
tmp = x + (y * (z / (a - t)));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((t <= (-2.9d+15)) .or. (.not. (t <= 3d+73))) then
tmp = x - (y / (t / (z - t)))
else
tmp = x + (y * (z / (a - t)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2.9e+15) || !(t <= 3e+73)) {
tmp = x - (y / (t / (z - t)));
} else {
tmp = x + (y * (z / (a - t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -2.9e+15) or not (t <= 3e+73): tmp = x - (y / (t / (z - t))) else: tmp = x + (y * (z / (a - t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -2.9e+15) || !(t <= 3e+73)) tmp = Float64(x - Float64(y / Float64(t / Float64(z - t)))); else tmp = Float64(x + Float64(y * Float64(z / Float64(a - t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -2.9e+15) || ~((t <= 3e+73))) tmp = x - (y / (t / (z - t))); else tmp = x + (y * (z / (a - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -2.9e+15], N[Not[LessEqual[t, 3e+73]], $MachinePrecision]], N[(x - N[(y / N[(t / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.9 \cdot 10^{+15} \lor \neg \left(t \leq 3 \cdot 10^{+73}\right):\\
\;\;\;\;x - \frac{y}{\frac{t}{z - t}}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{a - t}\\
\end{array}
\end{array}
(FPCore (x y z t a) :precision binary64 (if (<= t -2.7e+138) (+ x y) (if (<= t 8.8e+55) (+ x (* y (/ z (- a t)))) (+ x (* (/ y t) (- t z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.7e+138) {
tmp = x + y;
} else if (t <= 8.8e+55) {
tmp = x + (y * (z / (a - t)));
} else {
tmp = x + ((y / t) * (t - z));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (t <= (-2.7d+138)) then
tmp = x + y
else if (t <= 8.8d+55) then
tmp = x + (y * (z / (a - t)))
else
tmp = x + ((y / t) * (t - z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.7e+138) {
tmp = x + y;
} else if (t <= 8.8e+55) {
tmp = x + (y * (z / (a - t)));
} else {
tmp = x + ((y / t) * (t - z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -2.7e+138: tmp = x + y elif t <= 8.8e+55: tmp = x + (y * (z / (a - t))) else: tmp = x + ((y / t) * (t - z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -2.7e+138) tmp = Float64(x + y); elseif (t <= 8.8e+55) tmp = Float64(x + Float64(y * Float64(z / Float64(a - t)))); else tmp = Float64(x + Float64(Float64(y / t) * Float64(t - z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -2.7e+138) tmp = x + y; elseif (t <= 8.8e+55) tmp = x + (y * (z / (a - t))); else tmp = x + ((y / t) * (t - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -2.7e+138], N[(x + y), $MachinePrecision], If[LessEqual[t, 8.8e+55], N[(x + N[(y * N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y / t), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.7 \cdot 10^{+138}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq 8.8 \cdot 10^{+55}:\\
\;\;\;\;x + y \cdot \frac{z}{a - t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{t} \cdot \left(t - z\right)\\
\end{array}
\end{array}
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1.45e+15) (not (<= t 2.7e+20))) (+ x y) (+ x (* y (/ z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.45e+15) || !(t <= 2.7e+20)) {
tmp = x + y;
} else {
tmp = x + (y * (z / a));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((t <= (-1.45d+15)) .or. (.not. (t <= 2.7d+20))) then
tmp = x + y
else
tmp = x + (y * (z / a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.45e+15) || !(t <= 2.7e+20)) {
tmp = x + y;
} else {
tmp = x + (y * (z / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -1.45e+15) or not (t <= 2.7e+20): tmp = x + y else: tmp = x + (y * (z / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.45e+15) || !(t <= 2.7e+20)) tmp = Float64(x + y); else tmp = Float64(x + Float64(y * Float64(z / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -1.45e+15) || ~((t <= 2.7e+20))) tmp = x + y; else tmp = x + (y * (z / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1.45e+15], N[Not[LessEqual[t, 2.7e+20]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(x + N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.45 \cdot 10^{+15} \lor \neg \left(t \leq 2.7 \cdot 10^{+20}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{a}\\
\end{array}
\end{array}
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1.1e-37) (not (<= t 2.5e+55))) (+ x y) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.1e-37) || !(t <= 2.5e+55)) {
tmp = x + y;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((t <= (-1.1d-37)) .or. (.not. (t <= 2.5d+55))) then
tmp = x + y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.1e-37) || !(t <= 2.5e+55)) {
tmp = x + y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -1.1e-37) or not (t <= 2.5e+55): tmp = x + y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.1e-37) || !(t <= 2.5e+55)) tmp = Float64(x + y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -1.1e-37) || ~((t <= 2.5e+55))) tmp = x + y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1.1e-37], N[Not[LessEqual[t, 2.5e+55]], $MachinePrecision]], N[(x + y), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.1 \cdot 10^{-37} \lor \neg \left(t \leq 2.5 \cdot 10^{+55}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
(FPCore (x y z t a) :precision binary64 x)
double code(double x, double y, double z, double t, double a) {
return x;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x
end function
public static double code(double x, double y, double z, double t, double a) {
return x;
}
def code(x, y, z, t, a): return x
function code(x, y, z, t, a) return x end
function tmp = code(x, y, z, t, a) tmp = x; end
code[x_, y_, z_, t_, a_] := x
\begin{array}{l}
\\
x
\end{array}
(FPCore (x y z t a) :precision binary64 (+ x (/ y (/ (- a t) (- z t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y / ((a - t) / (z - t)));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (y / ((a - t) / (z - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y / ((a - t) / (z - t)));
}
def code(x, y, z, t, a): return x + (y / ((a - t) / (z - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y / Float64(Float64(a - t) / Float64(z - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y / ((a - t) / (z - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y / N[(N[(a - t), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{\frac{a - t}{z - t}}
\end{array}
herbie shell --seed 2024010
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTicks from plot-0.2.3.4, B"
:precision binary64
:herbie-target
(+ x (/ y (/ (- a t) (- z t))))
(+ x (/ (* y (- z t)) (- a t))))