
(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 12 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 (+ x (/ (- y x) (/ t z))))
double code(double x, double y, double z, double t) {
return x + ((y - x) / (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 - x) / (t / z))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - x) / (t / z));
}
def code(x, y, z, t): return x + ((y - x) / (t / z))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - x) / Float64(t / z))) end
function tmp = code(x, y, z, t) tmp = x + ((y - x) / (t / z)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - x), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y - x}{\frac{t}{z}}
\end{array}
Initial program 97.6%
clear-num97.6%
un-div-inv97.7%
Applied egg-rr97.7%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ z t) -100.0) (not (<= (/ z t) 4e-5))) (* x (/ z (- t))) x))
double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -100.0) || !((z / t) <= 4e-5)) {
tmp = x * (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) <= (-100.0d0)) .or. (.not. ((z / t) <= 4d-5))) then
tmp = x * (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) <= -100.0) || !((z / t) <= 4e-5)) {
tmp = x * (z / -t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z / t) <= -100.0) or not ((z / t) <= 4e-5): tmp = x * (z / -t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(z / t) <= -100.0) || !(Float64(z / t) <= 4e-5)) tmp = Float64(x * Float64(z / Float64(-t))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((z / t) <= -100.0) || ~(((z / t) <= 4e-5))) tmp = x * (z / -t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(z / t), $MachinePrecision], -100.0], N[Not[LessEqual[N[(z / t), $MachinePrecision], 4e-5]], $MachinePrecision]], N[(x * N[(z / (-t)), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -100 \lor \neg \left(\frac{z}{t} \leq 4 \cdot 10^{-5}\right):\\
\;\;\;\;x \cdot \frac{z}{-t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if (/.f64 z t) < -100 or 4.00000000000000033e-5 < (/.f64 z t) Initial program 96.1%
Taylor expanded in x around inf 56.9%
mul-1-neg56.9%
unsub-neg56.9%
Simplified56.9%
Taylor expanded in z around inf 54.4%
associate-*r/54.4%
mul-1-neg54.4%
Simplified54.4%
if -100 < (/.f64 z t) < 4.00000000000000033e-5Initial program 99.1%
Taylor expanded in z around 0 70.8%
Final simplification62.7%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ z t) -10000.0) (not (<= (/ z t) 4e-5))) (* (- z) (/ x t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -10000.0) || !((z / t) <= 4e-5)) {
tmp = -z * (x / 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) <= (-10000.0d0)) .or. (.not. ((z / t) <= 4d-5))) then
tmp = -z * (x / 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) <= -10000.0) || !((z / t) <= 4e-5)) {
tmp = -z * (x / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z / t) <= -10000.0) or not ((z / t) <= 4e-5): tmp = -z * (x / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(z / t) <= -10000.0) || !(Float64(z / t) <= 4e-5)) tmp = Float64(Float64(-z) * Float64(x / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((z / t) <= -10000.0) || ~(((z / t) <= 4e-5))) tmp = -z * (x / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(z / t), $MachinePrecision], -10000.0], N[Not[LessEqual[N[(z / t), $MachinePrecision], 4e-5]], $MachinePrecision]], N[((-z) * N[(x / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -10000 \lor \neg \left(\frac{z}{t} \leq 4 \cdot 10^{-5}\right):\\
\;\;\;\;\left(-z\right) \cdot \frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if (/.f64 z t) < -1e4 or 4.00000000000000033e-5 < (/.f64 z t) Initial program 96.0%
Taylor expanded in y around 0 51.6%
mul-1-neg51.6%
associate-/l*57.0%
distribute-lft-neg-out57.0%
*-commutative57.0%
Simplified57.0%
Taylor expanded in t around 0 50.8%
mul-1-neg50.8%
distribute-rgt-neg-out50.8%
+-commutative50.8%
*-commutative50.8%
distribute-lft-out51.6%
Simplified51.6%
Taylor expanded in t around 0 49.8%
associate-*r*49.8%
neg-mul-149.8%
Simplified49.8%
associate-/l*54.9%
distribute-lft-neg-out54.9%
add-sqr-sqrt28.1%
sqrt-unprod27.2%
sqr-neg27.2%
sqrt-unprod3.1%
add-sqr-sqrt12.0%
associate-/l*9.0%
*-commutative9.0%
associate-/l*8.3%
add-sqr-sqrt3.1%
sqrt-unprod27.3%
sqr-neg27.3%
sqrt-unprod26.5%
add-sqr-sqrt50.2%
Applied egg-rr50.2%
if -1e4 < (/.f64 z t) < 4.00000000000000033e-5Initial program 99.1%
Taylor expanded in z around 0 69.8%
Final simplification60.3%
(FPCore (x y z t) :precision binary64 (if (<= (/ z t) -1e+71) (* t (/ x t)) (if (<= (/ z t) 1e+115) x (* x (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z / t) <= -1e+71) {
tmp = t * (x / t);
} else if ((z / t) <= 1e+115) {
tmp = x;
} 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) <= (-1d+71)) then
tmp = t * (x / t)
else if ((z / t) <= 1d+115) then
tmp = x
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) <= -1e+71) {
tmp = t * (x / t);
} else if ((z / t) <= 1e+115) {
tmp = x;
} else {
tmp = x * (z / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z / t) <= -1e+71: tmp = t * (x / t) elif (z / t) <= 1e+115: tmp = x else: tmp = x * (z / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z / t) <= -1e+71) tmp = Float64(t * Float64(x / t)); elseif (Float64(z / t) <= 1e+115) tmp = x; else tmp = Float64(x * Float64(z / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z / t) <= -1e+71) tmp = t * (x / t); elseif ((z / t) <= 1e+115) tmp = x; else tmp = x * (z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z / t), $MachinePrecision], -1e+71], N[(t * N[(x / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z / t), $MachinePrecision], 1e+115], x, N[(x * N[(z / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -1 \cdot 10^{+71}:\\
\;\;\;\;t \cdot \frac{x}{t}\\
\mathbf{elif}\;\frac{z}{t} \leq 10^{+115}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{z}{t}\\
\end{array}
\end{array}
if (/.f64 z t) < -1e71Initial program 94.7%
Taylor expanded in y around 0 59.3%
mul-1-neg59.3%
associate-/l*61.3%
distribute-lft-neg-out61.3%
*-commutative61.3%
Simplified61.3%
Taylor expanded in t around 0 59.3%
mul-1-neg59.3%
distribute-rgt-neg-out59.3%
+-commutative59.3%
*-commutative59.3%
distribute-lft-out59.3%
Simplified59.3%
Taylor expanded in t around inf 3.8%
*-commutative3.8%
Simplified3.8%
*-commutative3.8%
associate-/l*20.9%
Applied egg-rr20.9%
if -1e71 < (/.f64 z t) < 1e115Initial program 99.2%
Taylor expanded in z around 0 56.0%
if 1e115 < (/.f64 z t) Initial program 94.6%
Taylor expanded in y around 0 43.7%
mul-1-neg43.7%
associate-/l*49.0%
distribute-lft-neg-out49.0%
*-commutative49.0%
Simplified49.0%
Taylor expanded in t around 0 43.7%
mul-1-neg43.7%
distribute-rgt-neg-out43.7%
+-commutative43.7%
*-commutative43.7%
distribute-lft-out43.7%
Simplified43.7%
Taylor expanded in t around 0 43.7%
associate-*r*43.7%
neg-mul-143.7%
Simplified43.7%
associate-/l*49.0%
*-commutative49.0%
add-sqr-sqrt20.3%
sqrt-unprod32.9%
sqr-neg32.9%
sqrt-unprod15.7%
add-sqr-sqrt19.0%
Applied egg-rr19.0%
Final simplification43.6%
(FPCore (x y z t) :precision binary64 (if (or (<= y -5.4e-54) (not (<= y 1.65e-87))) (+ x (/ y (/ t z))) (- x (* x (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -5.4e-54) || !(y <= 1.65e-87)) {
tmp = x + (y / (t / z));
} else {
tmp = x - (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.4d-54)) .or. (.not. (y <= 1.65d-87))) then
tmp = x + (y / (t / z))
else
tmp = x - (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.4e-54) || !(y <= 1.65e-87)) {
tmp = x + (y / (t / z));
} else {
tmp = x - (x * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -5.4e-54) or not (y <= 1.65e-87): tmp = x + (y / (t / z)) else: tmp = x - (x * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -5.4e-54) || !(y <= 1.65e-87)) tmp = Float64(x + Float64(y / Float64(t / z))); else tmp = Float64(x - Float64(x * Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -5.4e-54) || ~((y <= 1.65e-87))) tmp = x + (y / (t / z)); else tmp = x - (x * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -5.4e-54], N[Not[LessEqual[y, 1.65e-87]], $MachinePrecision]], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(x * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.4 \cdot 10^{-54} \lor \neg \left(y \leq 1.65 \cdot 10^{-87}\right):\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x - x \cdot \frac{z}{t}\\
\end{array}
\end{array}
if y < -5.40000000000000051e-54 or 1.65e-87 < y Initial program 99.1%
Taylor expanded in y around inf 85.4%
*-commutative85.4%
associate-/l*88.6%
Simplified88.6%
*-commutative88.6%
associate-/r/91.7%
Applied egg-rr91.7%
if -5.40000000000000051e-54 < y < 1.65e-87Initial program 95.5%
clear-num95.5%
un-div-inv95.6%
Applied egg-rr95.6%
Taylor expanded in x around inf 91.9%
mul-1-neg91.9%
unsub-neg91.9%
distribute-lft-out--92.0%
*-rgt-identity92.0%
Simplified92.0%
Final simplification91.8%
(FPCore (x y z t) :precision binary64 (if (or (<= y -8.8e-54) (not (<= y 1.05e-82))) (+ x (/ y (/ t z))) (* x (- 1.0 (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -8.8e-54) || !(y <= 1.05e-82)) {
tmp = x + (y / (t / z));
} 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 <= (-8.8d-54)) .or. (.not. (y <= 1.05d-82))) then
tmp = x + (y / (t / z))
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 <= -8.8e-54) || !(y <= 1.05e-82)) {
tmp = x + (y / (t / z));
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -8.8e-54) or not (y <= 1.05e-82): tmp = x + (y / (t / z)) else: tmp = x * (1.0 - (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -8.8e-54) || !(y <= 1.05e-82)) tmp = Float64(x + Float64(y / Float64(t / z))); 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 <= -8.8e-54) || ~((y <= 1.05e-82))) tmp = x + (y / (t / z)); else tmp = x * (1.0 - (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -8.8e-54], N[Not[LessEqual[y, 1.05e-82]], $MachinePrecision]], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.8 \cdot 10^{-54} \lor \neg \left(y \leq 1.05 \cdot 10^{-82}\right):\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\end{array}
\end{array}
if y < -8.7999999999999998e-54 or 1.05e-82 < y Initial program 99.1%
Taylor expanded in y around inf 85.4%
*-commutative85.4%
associate-/l*88.6%
Simplified88.6%
*-commutative88.6%
associate-/r/91.7%
Applied egg-rr91.7%
if -8.7999999999999998e-54 < y < 1.05e-82Initial program 95.5%
Taylor expanded in x around inf 91.9%
mul-1-neg91.9%
unsub-neg91.9%
Simplified91.9%
Final simplification91.8%
(FPCore (x y z t) :precision binary64 (if (or (<= y -6e-50) (not (<= y 5.8e-81))) (+ x (* y (/ z t))) (* x (- 1.0 (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -6e-50) || !(y <= 5.8e-81)) {
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 <= (-6d-50)) .or. (.not. (y <= 5.8d-81))) 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 <= -6e-50) || !(y <= 5.8e-81)) {
tmp = x + (y * (z / t));
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -6e-50) or not (y <= 5.8e-81): 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 <= -6e-50) || !(y <= 5.8e-81)) 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 <= -6e-50) || ~((y <= 5.8e-81))) 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, -6e-50], N[Not[LessEqual[y, 5.8e-81]], $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 -6 \cdot 10^{-50} \lor \neg \left(y \leq 5.8 \cdot 10^{-81}\right):\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\end{array}
\end{array}
if y < -5.99999999999999981e-50 or 5.79999999999999978e-81 < y Initial program 99.1%
Taylor expanded in y around inf 85.4%
associate-*r/91.6%
Simplified91.6%
if -5.99999999999999981e-50 < y < 5.79999999999999978e-81Initial program 95.5%
Taylor expanded in x around inf 91.9%
mul-1-neg91.9%
unsub-neg91.9%
Simplified91.9%
Final simplification91.7%
(FPCore (x y z t) :precision binary64 (if (<= x 3.2e+116) x (* t (/ x t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 3.2e+116) {
tmp = x;
} else {
tmp = t * (x / 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 (x <= 3.2d+116) then
tmp = x
else
tmp = t * (x / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 3.2e+116) {
tmp = x;
} else {
tmp = t * (x / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= 3.2e+116: tmp = x else: tmp = t * (x / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= 3.2e+116) tmp = x; else tmp = Float64(t * Float64(x / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= 3.2e+116) tmp = x; else tmp = t * (x / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, 3.2e+116], x, N[(t * N[(x / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.2 \cdot 10^{+116}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{x}{t}\\
\end{array}
\end{array}
if x < 3.2e116Initial program 97.2%
Taylor expanded in z around 0 36.6%
if 3.2e116 < x Initial program 99.9%
Taylor expanded in y around 0 75.4%
mul-1-neg75.4%
associate-/l*86.5%
distribute-lft-neg-out86.5%
*-commutative86.5%
Simplified86.5%
Taylor expanded in t around 0 62.1%
mul-1-neg62.1%
distribute-rgt-neg-out62.1%
+-commutative62.1%
*-commutative62.1%
distribute-lft-out62.4%
Simplified62.4%
Taylor expanded in t around inf 22.9%
*-commutative22.9%
Simplified22.9%
*-commutative22.9%
associate-/l*61.8%
Applied egg-rr61.8%
(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 97.6%
(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 97.6%
Taylor expanded in y around 0 85.7%
mul-1-neg85.7%
associate-/l*86.6%
distribute-lft-neg-out86.6%
associate-*r/90.6%
distribute-rgt-in97.6%
+-commutative97.6%
sub-neg97.6%
associate-*l/91.1%
associate-/l*95.5%
Simplified95.5%
(FPCore (x y z t) :precision binary64 (* x (- 1.0 (/ z t))))
double code(double x, double y, double z, double t) {
return x * (1.0 - (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 * (1.0d0 - (z / t))
end function
public static double code(double x, double y, double z, double t) {
return x * (1.0 - (z / t));
}
def code(x, y, z, t): return x * (1.0 - (z / t))
function code(x, y, z, t) return Float64(x * Float64(1.0 - Float64(z / t))) end
function tmp = code(x, y, z, t) tmp = x * (1.0 - (z / t)); end
code[x_, y_, z_, t_] := N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(1 - \frac{z}{t}\right)
\end{array}
Initial program 97.6%
Taylor expanded in x around inf 64.9%
mul-1-neg64.9%
unsub-neg64.9%
Simplified64.9%
(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 97.6%
Taylor expanded in z around 0 37.6%
(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 2024181
(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))))