
(FPCore (x y z t) :precision binary64 (+ x (* (- y x) (/ z t))))
double code(double x, double y, double z, double t) {
return x + ((y - x) * (z / t));
}
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 - x) * (z / t))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - x) * (z / t));
}
def code(x, y, z, t): return x + ((y - x) * (z / t))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - x) * Float64(z / t))) end
function tmp = code(x, y, z, t) tmp = x + ((y - x) * (z / t)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - x\right) \cdot \frac{z}{t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (* (- y x) (/ z t))))
double code(double x, double y, double z, double t) {
return x + ((y - x) * (z / t));
}
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 - x) * (z / t))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - x) * (z / t));
}
def code(x, y, z, t): return x + ((y - x) * (z / t))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - x) * Float64(z / t))) end
function tmp = code(x, y, z, t) tmp = x + ((y - x) * (z / t)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - x\right) \cdot \frac{z}{t}
\end{array}
(FPCore (x y z t) :precision binary64 (fma (- y x) (/ z t) x))
double code(double x, double y, double z, double t) {
return fma((y - x), (z / t), x);
}
function code(x, y, z, t) return fma(Float64(y - x), Float64(z / t), x) end
code[x_, y_, z_, t_] := N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y - x, \frac{z}{t}, x\right)
\end{array}
Initial program 98.5%
+-commutative98.5%
fma-define98.5%
Simplified98.5%
(FPCore (x y z t)
:precision binary64
(if (<= (/ z t) -5.0)
(/ x (/ t (- z)))
(if (<= (/ z t) 1e-9)
x
(if (or (<= (/ z t) 1e+91) (not (<= (/ z t) 4e+228)))
(* y (/ z t))
(* x (/ z (- t)))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z / t) <= -5.0) {
tmp = x / (t / -z);
} else if ((z / t) <= 1e-9) {
tmp = x;
} else if (((z / t) <= 1e+91) || !((z / t) <= 4e+228)) {
tmp = y * (z / t);
} else {
tmp = 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 ((z / t) <= (-5.0d0)) then
tmp = x / (t / -z)
else if ((z / t) <= 1d-9) then
tmp = x
else if (((z / t) <= 1d+91) .or. (.not. ((z / t) <= 4d+228))) then
tmp = y * (z / t)
else
tmp = x * (z / -t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z / t) <= -5.0) {
tmp = x / (t / -z);
} else if ((z / t) <= 1e-9) {
tmp = x;
} else if (((z / t) <= 1e+91) || !((z / t) <= 4e+228)) {
tmp = y * (z / t);
} else {
tmp = x * (z / -t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z / t) <= -5.0: tmp = x / (t / -z) elif (z / t) <= 1e-9: tmp = x elif ((z / t) <= 1e+91) or not ((z / t) <= 4e+228): tmp = y * (z / t) else: tmp = x * (z / -t) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z / t) <= -5.0) tmp = Float64(x / Float64(t / Float64(-z))); elseif (Float64(z / t) <= 1e-9) tmp = x; elseif ((Float64(z / t) <= 1e+91) || !(Float64(z / t) <= 4e+228)) tmp = Float64(y * Float64(z / t)); else tmp = Float64(x * Float64(z / Float64(-t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z / t) <= -5.0) tmp = x / (t / -z); elseif ((z / t) <= 1e-9) tmp = x; elseif (((z / t) <= 1e+91) || ~(((z / t) <= 4e+228))) tmp = y * (z / t); else tmp = x * (z / -t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z / t), $MachinePrecision], -5.0], N[(x / N[(t / (-z)), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z / t), $MachinePrecision], 1e-9], x, If[Or[LessEqual[N[(z / t), $MachinePrecision], 1e+91], N[Not[LessEqual[N[(z / t), $MachinePrecision], 4e+228]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], N[(x * N[(z / (-t)), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -5:\\
\;\;\;\;\frac{x}{\frac{t}{-z}}\\
\mathbf{elif}\;\frac{z}{t} \leq 10^{-9}:\\
\;\;\;\;x\\
\mathbf{elif}\;\frac{z}{t} \leq 10^{+91} \lor \neg \left(\frac{z}{t} \leq 4 \cdot 10^{+228}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{z}{-t}\\
\end{array}
\end{array}
if (/.f64 z t) < -5Initial program 97.2%
Taylor expanded in x around inf 65.8%
mul-1-neg65.8%
unsub-neg65.8%
Simplified65.8%
Taylor expanded in z around inf 64.4%
mul-1-neg64.4%
distribute-frac-neg64.4%
Simplified64.4%
distribute-frac-neg64.4%
distribute-rgt-neg-in64.4%
clear-num64.4%
div-inv64.4%
distribute-neg-frac64.4%
Applied egg-rr64.4%
if -5 < (/.f64 z t) < 1.00000000000000006e-9Initial program 99.4%
Taylor expanded in z around 0 78.7%
if 1.00000000000000006e-9 < (/.f64 z t) < 1.00000000000000008e91 or 3.9999999999999997e228 < (/.f64 z t) Initial program 97.5%
Taylor expanded in y around 0 83.9%
mul-1-neg83.9%
associate-/l*88.5%
distribute-lft-neg-out88.5%
associate-*r/92.7%
distribute-rgt-in97.5%
+-commutative97.5%
sub-neg97.5%
associate-*l/86.3%
associate-/l*92.9%
Simplified92.9%
Taylor expanded in y around inf 79.1%
+-commutative79.1%
mul-1-neg79.1%
unsub-neg79.1%
associate-/l*81.4%
*-commutative81.4%
Simplified81.4%
Taylor expanded in x around 0 62.9%
associate-*r/74.1%
Simplified74.1%
if 1.00000000000000008e91 < (/.f64 z t) < 3.9999999999999997e228Initial program 99.9%
Taylor expanded in x around inf 76.6%
mul-1-neg76.6%
unsub-neg76.6%
Simplified76.6%
Taylor expanded in z around inf 76.6%
mul-1-neg76.6%
distribute-frac-neg76.6%
Simplified76.6%
Final simplification73.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ z (- t)))))
(if (<= (/ z t) -5.0)
t_1
(if (<= (/ z t) 1e-9)
x
(if (or (<= (/ z t) 1e+91) (not (<= (/ z t) 4e+228)))
(* y (/ z t))
t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x * (z / -t);
double tmp;
if ((z / t) <= -5.0) {
tmp = t_1;
} else if ((z / t) <= 1e-9) {
tmp = x;
} else if (((z / t) <= 1e+91) || !((z / t) <= 4e+228)) {
tmp = y * (z / t);
} else {
tmp = 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
real(8) :: t_1
real(8) :: tmp
t_1 = x * (z / -t)
if ((z / t) <= (-5.0d0)) then
tmp = t_1
else if ((z / t) <= 1d-9) then
tmp = x
else if (((z / t) <= 1d+91) .or. (.not. ((z / t) <= 4d+228))) then
tmp = y * (z / t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (z / -t);
double tmp;
if ((z / t) <= -5.0) {
tmp = t_1;
} else if ((z / t) <= 1e-9) {
tmp = x;
} else if (((z / t) <= 1e+91) || !((z / t) <= 4e+228)) {
tmp = y * (z / t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (z / -t) tmp = 0 if (z / t) <= -5.0: tmp = t_1 elif (z / t) <= 1e-9: tmp = x elif ((z / t) <= 1e+91) or not ((z / t) <= 4e+228): tmp = y * (z / t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(z / Float64(-t))) tmp = 0.0 if (Float64(z / t) <= -5.0) tmp = t_1; elseif (Float64(z / t) <= 1e-9) tmp = x; elseif ((Float64(z / t) <= 1e+91) || !(Float64(z / t) <= 4e+228)) tmp = Float64(y * Float64(z / t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (z / -t); tmp = 0.0; if ((z / t) <= -5.0) tmp = t_1; elseif ((z / t) <= 1e-9) tmp = x; elseif (((z / t) <= 1e+91) || ~(((z / t) <= 4e+228))) tmp = y * (z / t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(z / (-t)), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z / t), $MachinePrecision], -5.0], t$95$1, If[LessEqual[N[(z / t), $MachinePrecision], 1e-9], x, If[Or[LessEqual[N[(z / t), $MachinePrecision], 1e+91], N[Not[LessEqual[N[(z / t), $MachinePrecision], 4e+228]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{z}{-t}\\
\mathbf{if}\;\frac{z}{t} \leq -5:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{z}{t} \leq 10^{-9}:\\
\;\;\;\;x\\
\mathbf{elif}\;\frac{z}{t} \leq 10^{+91} \lor \neg \left(\frac{z}{t} \leq 4 \cdot 10^{+228}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 z t) < -5 or 1.00000000000000008e91 < (/.f64 z t) < 3.9999999999999997e228Initial program 97.8%
Taylor expanded in x around inf 68.3%
mul-1-neg68.3%
unsub-neg68.3%
Simplified68.3%
Taylor expanded in z around inf 67.2%
mul-1-neg67.2%
distribute-frac-neg67.2%
Simplified67.2%
if -5 < (/.f64 z t) < 1.00000000000000006e-9Initial program 99.4%
Taylor expanded in z around 0 78.7%
if 1.00000000000000006e-9 < (/.f64 z t) < 1.00000000000000008e91 or 3.9999999999999997e228 < (/.f64 z t) Initial program 97.5%
Taylor expanded in y around 0 83.9%
mul-1-neg83.9%
associate-/l*88.5%
distribute-lft-neg-out88.5%
associate-*r/92.7%
distribute-rgt-in97.5%
+-commutative97.5%
sub-neg97.5%
associate-*l/86.3%
associate-/l*92.9%
Simplified92.9%
Taylor expanded in y around inf 79.1%
+-commutative79.1%
mul-1-neg79.1%
unsub-neg79.1%
associate-/l*81.4%
*-commutative81.4%
Simplified81.4%
Taylor expanded in x around 0 62.9%
associate-*r/74.1%
Simplified74.1%
Final simplification73.8%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ z t) -5e-11) (not (<= (/ z t) 1e-9))) (* y (/ z t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -5e-11) || !((z / t) <= 1e-9)) {
tmp = y * (z / 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 / t) <= (-5d-11)) .or. (.not. ((z / t) <= 1d-9))) then
tmp = y * (z / 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 / t) <= -5e-11) || !((z / t) <= 1e-9)) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z / t) <= -5e-11) or not ((z / t) <= 1e-9): tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(z / t) <= -5e-11) || !(Float64(z / t) <= 1e-9)) tmp = Float64(y * Float64(z / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((z / t) <= -5e-11) || ~(((z / t) <= 1e-9))) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(z / t), $MachinePrecision], -5e-11], N[Not[LessEqual[N[(z / t), $MachinePrecision], 1e-9]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -5 \cdot 10^{-11} \lor \neg \left(\frac{z}{t} \leq 10^{-9}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if (/.f64 z t) < -5.00000000000000018e-11 or 1.00000000000000006e-9 < (/.f64 z t) Initial program 97.8%
Taylor expanded in y around 0 88.8%
mul-1-neg88.8%
associate-/l*90.2%
distribute-lft-neg-out90.2%
associate-*r/89.5%
distribute-rgt-in97.8%
+-commutative97.8%
sub-neg97.8%
associate-*l/92.5%
associate-/l*93.0%
Simplified93.0%
Taylor expanded in y around inf 71.4%
+-commutative71.4%
mul-1-neg71.4%
unsub-neg71.4%
associate-/l*72.9%
*-commutative72.9%
Simplified72.9%
Taylor expanded in x around 0 51.1%
associate-*r/55.3%
Simplified55.3%
if -5.00000000000000018e-11 < (/.f64 z t) < 1.00000000000000006e-9Initial program 99.4%
Taylor expanded in z around 0 79.6%
Final simplification66.7%
(FPCore (x y z t) :precision binary64 (if (<= (/ z t) -200000000000.0) (* z (- (/ x t))) (if (<= (/ z t) 1e-9) x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z / t) <= -200000000000.0) {
tmp = z * -(x / t);
} else if ((z / t) <= 1e-9) {
tmp = x;
} else {
tmp = y * (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 ((z / t) <= (-200000000000.0d0)) then
tmp = z * -(x / t)
else if ((z / t) <= 1d-9) then
tmp = x
else
tmp = y * (z / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z / t) <= -200000000000.0) {
tmp = z * -(x / t);
} else if ((z / t) <= 1e-9) {
tmp = x;
} else {
tmp = y * (z / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z / t) <= -200000000000.0: tmp = z * -(x / t) elif (z / t) <= 1e-9: tmp = x else: tmp = y * (z / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z / t) <= -200000000000.0) tmp = Float64(z * Float64(-Float64(x / t))); elseif (Float64(z / t) <= 1e-9) tmp = x; else tmp = Float64(y * Float64(z / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z / t) <= -200000000000.0) tmp = z * -(x / t); elseif ((z / t) <= 1e-9) tmp = x; else tmp = y * (z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z / t), $MachinePrecision], -200000000000.0], N[(z * (-N[(x / t), $MachinePrecision])), $MachinePrecision], If[LessEqual[N[(z / t), $MachinePrecision], 1e-9], x, N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -200000000000:\\
\;\;\;\;z \cdot \left(-\frac{x}{t}\right)\\
\mathbf{elif}\;\frac{z}{t} \leq 10^{-9}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if (/.f64 z t) < -2e11Initial program 97.1%
Taylor expanded in x around inf 66.3%
mul-1-neg66.3%
unsub-neg66.3%
Simplified66.3%
Taylor expanded in z around inf 65.9%
mul-1-neg65.9%
distribute-frac-neg65.9%
Simplified65.9%
distribute-frac-neg65.9%
distribute-rgt-neg-in65.9%
clear-num66.0%
div-inv66.0%
associate-/r/61.0%
Applied egg-rr61.0%
if -2e11 < (/.f64 z t) < 1.00000000000000006e-9Initial program 99.4%
Taylor expanded in z around 0 77.5%
if 1.00000000000000006e-9 < (/.f64 z t) Initial program 98.3%
Taylor expanded in y around 0 84.6%
mul-1-neg84.6%
associate-/l*89.2%
distribute-lft-neg-out89.2%
associate-*r/95.1%
distribute-rgt-in98.3%
+-commutative98.3%
sub-neg98.3%
associate-*l/87.8%
associate-/l*92.3%
Simplified92.3%
Taylor expanded in y around inf 75.3%
+-commutative75.3%
mul-1-neg75.3%
unsub-neg75.3%
associate-/l*76.9%
*-commutative76.9%
Simplified76.9%
Taylor expanded in x around 0 52.0%
associate-*r/61.0%
Simplified61.0%
Final simplification69.0%
(FPCore (x y z t) :precision binary64 (if (or (<= y -3.7e-13) (not (<= y 2.7e-132))) (+ x (* y (/ z t))) (* x (- 1.0 (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.7e-13) || !(y <= 2.7e-132)) {
tmp = x + (y * (z / t));
} else {
tmp = x * (1.0 - (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 <= (-3.7d-13)) .or. (.not. (y <= 2.7d-132))) then
tmp = x + (y * (z / t))
else
tmp = x * (1.0d0 - (z / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.7e-13) || !(y <= 2.7e-132)) {
tmp = x + (y * (z / t));
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -3.7e-13) or not (y <= 2.7e-132): tmp = x + (y * (z / t)) else: tmp = x * (1.0 - (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -3.7e-13) || !(y <= 2.7e-132)) tmp = Float64(x + Float64(y * Float64(z / t))); else tmp = Float64(x * Float64(1.0 - Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -3.7e-13) || ~((y <= 2.7e-132))) tmp = x + (y * (z / t)); else tmp = x * (1.0 - (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -3.7e-13], N[Not[LessEqual[y, 2.7e-132]], $MachinePrecision]], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.7 \cdot 10^{-13} \lor \neg \left(y \leq 2.7 \cdot 10^{-132}\right):\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\end{array}
\end{array}
if y < -3.69999999999999989e-13 or 2.6999999999999999e-132 < y Initial program 99.5%
Taylor expanded in y around inf 89.0%
associate-*r/92.3%
Simplified92.3%
if -3.69999999999999989e-13 < y < 2.6999999999999999e-132Initial program 97.1%
Taylor expanded in x around inf 90.6%
mul-1-neg90.6%
unsub-neg90.6%
Simplified90.6%
Final simplification91.6%
(FPCore (x y z t) :precision binary64 (if (or (<= y -4.7e+83) (not (<= y 1e+202))) (* y (/ z t)) (* x (- 1.0 (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4.7e+83) || !(y <= 1e+202)) {
tmp = y * (z / t);
} else {
tmp = x * (1.0 - (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 <= (-4.7d+83)) .or. (.not. (y <= 1d+202))) then
tmp = y * (z / t)
else
tmp = x * (1.0d0 - (z / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4.7e+83) || !(y <= 1e+202)) {
tmp = y * (z / t);
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -4.7e+83) or not (y <= 1e+202): tmp = y * (z / t) else: tmp = x * (1.0 - (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -4.7e+83) || !(y <= 1e+202)) tmp = Float64(y * Float64(z / t)); else tmp = Float64(x * Float64(1.0 - Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -4.7e+83) || ~((y <= 1e+202))) tmp = y * (z / t); else tmp = x * (1.0 - (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -4.7e+83], N[Not[LessEqual[y, 1e+202]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.7 \cdot 10^{+83} \lor \neg \left(y \leq 10^{+202}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\end{array}
\end{array}
if y < -4.6999999999999999e83 or 9.999999999999999e201 < y Initial program 99.0%
Taylor expanded in y around 0 88.6%
mul-1-neg88.6%
associate-/l*88.6%
distribute-lft-neg-out88.6%
associate-*r/94.6%
distribute-rgt-in99.0%
+-commutative99.0%
sub-neg99.0%
associate-*l/93.0%
associate-/l*90.1%
Simplified90.1%
Taylor expanded in y around inf 96.0%
+-commutative96.0%
mul-1-neg96.0%
unsub-neg96.0%
associate-/l*99.0%
*-commutative99.0%
Simplified99.0%
Taylor expanded in x around 0 67.4%
associate-*r/74.0%
Simplified74.0%
if -4.6999999999999999e83 < y < 9.999999999999999e201Initial program 98.4%
Taylor expanded in x around inf 80.9%
mul-1-neg80.9%
unsub-neg80.9%
Simplified80.9%
Final simplification79.1%
(FPCore (x y z t) :precision binary64 (+ x (* (- y x) (/ z t))))
double code(double x, double y, double z, double t) {
return x + ((y - x) * (z / t));
}
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 - x) * (z / t))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - x) * (z / t));
}
def code(x, y, z, t): return x + ((y - x) * (z / t))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - x) * Float64(z / t))) end
function tmp = code(x, y, z, t) tmp = x + ((y - x) * (z / t)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - x\right) \cdot \frac{z}{t}
\end{array}
Initial program 98.5%
(FPCore (x y z t) :precision binary64 (+ x (* z (/ (- y x) t))))
double code(double x, double y, double z, double t) {
return x + (z * ((y - x) / t));
}
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 + (z * ((y - x) / t))
end function
public static double code(double x, double y, double z, double t) {
return x + (z * ((y - x) / t));
}
def code(x, y, z, t): return x + (z * ((y - x) / t))
function code(x, y, z, t) return Float64(x + Float64(z * Float64(Float64(y - x) / t))) end
function tmp = code(x, y, z, t) tmp = x + (z * ((y - x) / t)); end
code[x_, y_, z_, t_] := N[(x + N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + z \cdot \frac{y - x}{t}
\end{array}
Initial program 98.5%
Taylor expanded in y around 0 91.8%
mul-1-neg91.8%
associate-/l*93.7%
distribute-lft-neg-out93.7%
associate-*r/94.2%
distribute-rgt-in98.5%
+-commutative98.5%
sub-neg98.5%
associate-*l/93.8%
associate-/l*94.0%
Simplified94.0%
(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}
Initial program 98.5%
Taylor expanded in z around 0 39.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- y x) (/ z t))) (t_2 (+ x (/ (- y x) (/ t z)))))
(if (< t_1 -1013646692435.8867)
t_2
(if (< t_1 0.0) (+ x (/ (* (- y x) z) t)) t_2))))
double code(double x, double y, double z, double t) {
double t_1 = (y - x) * (z / t);
double t_2 = x + ((y - x) / (t / z));
double tmp;
if (t_1 < -1013646692435.8867) {
tmp = t_2;
} else if (t_1 < 0.0) {
tmp = x + (((y - x) * z) / t);
} else {
tmp = t_2;
}
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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (y - x) * (z / t)
t_2 = x + ((y - x) / (t / z))
if (t_1 < (-1013646692435.8867d0)) then
tmp = t_2
else if (t_1 < 0.0d0) then
tmp = x + (((y - x) * z) / t)
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (y - x) * (z / t);
double t_2 = x + ((y - x) / (t / z));
double tmp;
if (t_1 < -1013646692435.8867) {
tmp = t_2;
} else if (t_1 < 0.0) {
tmp = x + (((y - x) * z) / t);
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y - x) * (z / t) t_2 = x + ((y - x) / (t / z)) tmp = 0 if t_1 < -1013646692435.8867: tmp = t_2 elif t_1 < 0.0: tmp = x + (((y - x) * z) / t) else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y - x) * Float64(z / t)) t_2 = Float64(x + Float64(Float64(y - x) / Float64(t / z))) tmp = 0.0 if (t_1 < -1013646692435.8867) tmp = t_2; elseif (t_1 < 0.0) tmp = Float64(x + Float64(Float64(Float64(y - x) * z) / t)); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y - x) * (z / t); t_2 = x + ((y - x) / (t / z)); tmp = 0.0; if (t_1 < -1013646692435.8867) tmp = t_2; elseif (t_1 < 0.0) tmp = x + (((y - x) * z) / t); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(y - x), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$1, -1013646692435.8867], t$95$2, If[Less[t$95$1, 0.0], N[(x + N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y - x\right) \cdot \frac{z}{t}\\
t_2 := x + \frac{y - x}{\frac{t}{z}}\\
\mathbf{if}\;t\_1 < -1013646692435.8867:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 < 0:\\
\;\;\;\;x + \frac{\left(y - x\right) \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
herbie shell --seed 2024146
(FPCore (x y z t)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:tickPosition from plot-0.2.3.4"
:precision binary64
:alt
(! :herbie-platform default (if (< (* (- y x) (/ z t)) -10136466924358867/10000) (+ x (/ (- y x) (/ t z))) (if (< (* (- y x) (/ z t)) 0) (+ x (/ (* (- y x) z) t)) (+ x (/ (- y x) (/ t z))))))
(+ x (* (- y x) (/ z t))))