
(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 9 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) (/ 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.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.15e-110) (not (<= z 3.5e-131))) (+ x (* z (/ (- y x) t))) (+ x (/ (* y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.15e-110) || !(z <= 3.5e-131)) {
tmp = x + (z * ((y - x) / t));
} else {
tmp = x + ((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 <= (-1.15d-110)) .or. (.not. (z <= 3.5d-131))) then
tmp = x + (z * ((y - x) / t))
else
tmp = x + ((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 <= -1.15e-110) || !(z <= 3.5e-131)) {
tmp = x + (z * ((y - x) / t));
} else {
tmp = x + ((y * z) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.15e-110) or not (z <= 3.5e-131): tmp = x + (z * ((y - x) / t)) else: tmp = x + ((y * z) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.15e-110) || !(z <= 3.5e-131)) tmp = Float64(x + Float64(z * Float64(Float64(y - x) / t))); else tmp = Float64(x + Float64(Float64(y * z) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.15e-110) || ~((z <= 3.5e-131))) tmp = x + (z * ((y - x) / t)); else tmp = x + ((y * z) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.15e-110], N[Not[LessEqual[z, 3.5e-131]], $MachinePrecision]], N[(x + N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \cdot 10^{-110} \lor \neg \left(z \leq 3.5 \cdot 10^{-131}\right):\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot z}{t}\\
\end{array}
\end{array}
if z < -1.1500000000000001e-110 or 3.5000000000000002e-131 < z Initial program 97.3%
Taylor expanded in y around 0 82.3%
+-commutative82.3%
mul-1-neg82.3%
unsub-neg82.3%
associate-*l/83.6%
associate-*l/89.7%
distribute-rgt-out--95.1%
div-sub97.3%
Simplified97.3%
if -1.1500000000000001e-110 < z < 3.5000000000000002e-131Initial program 99.9%
Taylor expanded in y around inf 98.6%
Final simplification97.6%
(FPCore (x y z t) :precision binary64 (if (or (<= x -5.4e+186) (not (<= x 480000000.0))) (* x (- 1.0 (/ z t))) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -5.4e+186) || !(x <= 480000000.0)) {
tmp = x * (1.0 - (z / t));
} else {
tmp = x + (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 ((x <= (-5.4d+186)) .or. (.not. (x <= 480000000.0d0))) then
tmp = x * (1.0d0 - (z / t))
else
tmp = x + (y * (z / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -5.4e+186) || !(x <= 480000000.0)) {
tmp = x * (1.0 - (z / t));
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -5.4e+186) or not (x <= 480000000.0): tmp = x * (1.0 - (z / t)) else: tmp = x + (y * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -5.4e+186) || !(x <= 480000000.0)) tmp = Float64(x * Float64(1.0 - Float64(z / t))); else tmp = Float64(x + Float64(y * Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -5.4e+186) || ~((x <= 480000000.0))) tmp = x * (1.0 - (z / t)); else tmp = x + (y * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -5.4e+186], N[Not[LessEqual[x, 480000000.0]], $MachinePrecision]], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.4 \cdot 10^{+186} \lor \neg \left(x \leq 480000000\right):\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if x < -5.3999999999999998e186 or 4.8e8 < x Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 82.5%
mul-1-neg82.5%
unsub-neg82.5%
associate-/l*94.2%
*-rgt-identity94.2%
distribute-lft-out--94.2%
Simplified94.2%
if -5.3999999999999998e186 < x < 4.8e8Initial program 96.7%
Taylor expanded in y around inf 84.4%
associate-*r/86.5%
Simplified86.5%
Final simplification89.7%
(FPCore (x y z t) :precision binary64 (if (<= x -2.2e+189) (* x (- 1.0 (/ z t))) (if (<= x 440000000.0) (+ x (* y (/ z t))) (- x (* x (/ z t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.2e+189) {
tmp = x * (1.0 - (z / t));
} else if (x <= 440000000.0) {
tmp = x + (y * (z / t));
} 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 (x <= (-2.2d+189)) then
tmp = x * (1.0d0 - (z / t))
else if (x <= 440000000.0d0) then
tmp = x + (y * (z / t))
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 (x <= -2.2e+189) {
tmp = x * (1.0 - (z / t));
} else if (x <= 440000000.0) {
tmp = x + (y * (z / t));
} else {
tmp = x - (x * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.2e+189: tmp = x * (1.0 - (z / t)) elif x <= 440000000.0: tmp = x + (y * (z / t)) else: tmp = x - (x * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.2e+189) tmp = Float64(x * Float64(1.0 - Float64(z / t))); elseif (x <= 440000000.0) tmp = Float64(x + Float64(y * Float64(z / t))); 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 (x <= -2.2e+189) tmp = x * (1.0 - (z / t)); elseif (x <= 440000000.0) tmp = x + (y * (z / t)); else tmp = x - (x * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.2e+189], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 440000000.0], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(x * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.2 \cdot 10^{+189}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{elif}\;x \leq 440000000:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x - x \cdot \frac{z}{t}\\
\end{array}
\end{array}
if x < -2.20000000000000005e189Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around 0 89.1%
mul-1-neg89.1%
unsub-neg89.1%
associate-/l*100.0%
*-rgt-identity100.0%
distribute-lft-out--100.0%
Simplified100.0%
if -2.20000000000000005e189 < x < 4.4e8Initial program 96.7%
Taylor expanded in y around inf 84.4%
associate-*r/86.5%
Simplified86.5%
if 4.4e8 < x Initial program 99.9%
Taylor expanded in y around 0 80.3%
mul-1-neg80.3%
associate-/l*92.3%
distribute-lft-neg-out92.3%
*-commutative92.3%
Simplified92.3%
Final simplification89.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -3.8e+47) (not (<= z 3.9e+110))) (* x (/ (- z) t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.8e+47) || !(z <= 3.9e+110)) {
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 <= (-3.8d+47)) .or. (.not. (z <= 3.9d+110))) 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 <= -3.8e+47) || !(z <= 3.9e+110)) {
tmp = x * (-z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -3.8e+47) or not (z <= 3.9e+110): tmp = x * (-z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -3.8e+47) || !(z <= 3.9e+110)) tmp = Float64(x * Float64(Float64(-z) / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -3.8e+47) || ~((z <= 3.9e+110))) tmp = x * (-z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -3.8e+47], N[Not[LessEqual[z, 3.9e+110]], $MachinePrecision]], N[(x * N[((-z) / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{+47} \lor \neg \left(z \leq 3.9 \cdot 10^{+110}\right):\\
\;\;\;\;x \cdot \frac{-z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -3.8000000000000003e47 or 3.9000000000000003e110 < z Initial program 96.9%
+-commutative96.9%
fma-define96.9%
Simplified96.9%
Taylor expanded in y around 0 45.4%
mul-1-neg45.4%
unsub-neg45.4%
associate-/l*57.4%
*-rgt-identity57.4%
distribute-lft-out--57.4%
Simplified57.4%
Taylor expanded in z around inf 42.8%
mul-1-neg42.8%
distribute-frac-neg242.8%
associate-/l*49.7%
Simplified49.7%
if -3.8000000000000003e47 < z < 3.9000000000000003e110Initial program 98.7%
+-commutative98.7%
fma-define98.7%
Simplified98.7%
Taylor expanded in z around 0 59.7%
Final simplification56.1%
(FPCore (x y z t) :precision binary64 (if (<= z -4.2e+44) (* x (/ (- z) t)) (if (<= z 2.15e+111) x (/ (- z) (/ t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.2e+44) {
tmp = x * (-z / t);
} else if (z <= 2.15e+111) {
tmp = x;
} else {
tmp = -z / (t / 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 <= (-4.2d+44)) then
tmp = x * (-z / t)
else if (z <= 2.15d+111) then
tmp = x
else
tmp = -z / (t / x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.2e+44) {
tmp = x * (-z / t);
} else if (z <= 2.15e+111) {
tmp = x;
} else {
tmp = -z / (t / x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -4.2e+44: tmp = x * (-z / t) elif z <= 2.15e+111: tmp = x else: tmp = -z / (t / x) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -4.2e+44) tmp = Float64(x * Float64(Float64(-z) / t)); elseif (z <= 2.15e+111) tmp = x; else tmp = Float64(Float64(-z) / Float64(t / x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -4.2e+44) tmp = x * (-z / t); elseif (z <= 2.15e+111) tmp = x; else tmp = -z / (t / x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -4.2e+44], N[(x * N[((-z) / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.15e+111], x, N[((-z) / N[(t / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.2 \cdot 10^{+44}:\\
\;\;\;\;x \cdot \frac{-z}{t}\\
\mathbf{elif}\;z \leq 2.15 \cdot 10^{+111}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{-z}{\frac{t}{x}}\\
\end{array}
\end{array}
if z < -4.19999999999999974e44Initial program 99.8%
+-commutative99.8%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 47.7%
mul-1-neg47.7%
unsub-neg47.7%
associate-/l*65.9%
*-rgt-identity65.9%
distribute-lft-out--65.9%
Simplified65.9%
Taylor expanded in z around inf 45.8%
mul-1-neg45.8%
distribute-frac-neg245.8%
associate-/l*56.6%
Simplified56.6%
if -4.19999999999999974e44 < z < 2.14999999999999997e111Initial program 98.7%
+-commutative98.7%
fma-define98.7%
Simplified98.7%
Taylor expanded in z around 0 59.7%
if 2.14999999999999997e111 < z Initial program 93.1%
+-commutative93.1%
fma-define93.1%
Simplified93.1%
Taylor expanded in y around 0 42.5%
mul-1-neg42.5%
unsub-neg42.5%
associate-/l*47.0%
*-rgt-identity47.0%
distribute-lft-out--47.0%
Simplified47.0%
Taylor expanded in z around inf 39.2%
mul-1-neg39.2%
distribute-frac-neg239.2%
associate-/l*41.2%
Simplified41.2%
*-commutative41.2%
associate-/r/41.4%
distribute-frac-neg41.4%
distribute-frac-neg241.4%
distribute-frac-neg41.4%
Applied egg-rr41.4%
Final simplification56.1%
(FPCore (x y z t) :precision binary64 (if (<= z -3e+45) (* x (/ (- z) t)) (if (<= z 1e+111) x (* z (/ x (- t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3e+45) {
tmp = x * (-z / t);
} else if (z <= 1e+111) {
tmp = x;
} else {
tmp = z * (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 (z <= (-3d+45)) then
tmp = x * (-z / t)
else if (z <= 1d+111) then
tmp = x
else
tmp = z * (x / -t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3e+45) {
tmp = x * (-z / t);
} else if (z <= 1e+111) {
tmp = x;
} else {
tmp = z * (x / -t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -3e+45: tmp = x * (-z / t) elif z <= 1e+111: tmp = x else: tmp = z * (x / -t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -3e+45) tmp = Float64(x * Float64(Float64(-z) / t)); elseif (z <= 1e+111) tmp = x; else tmp = Float64(z * Float64(x / Float64(-t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -3e+45) tmp = x * (-z / t); elseif (z <= 1e+111) tmp = x; else tmp = z * (x / -t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -3e+45], N[(x * N[((-z) / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1e+111], x, N[(z * N[(x / (-t)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3 \cdot 10^{+45}:\\
\;\;\;\;x \cdot \frac{-z}{t}\\
\mathbf{elif}\;z \leq 10^{+111}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{x}{-t}\\
\end{array}
\end{array}
if z < -3.00000000000000011e45Initial program 99.8%
+-commutative99.8%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 47.7%
mul-1-neg47.7%
unsub-neg47.7%
associate-/l*65.9%
*-rgt-identity65.9%
distribute-lft-out--65.9%
Simplified65.9%
Taylor expanded in z around inf 45.8%
mul-1-neg45.8%
distribute-frac-neg245.8%
associate-/l*56.6%
Simplified56.6%
if -3.00000000000000011e45 < z < 9.99999999999999957e110Initial program 98.7%
+-commutative98.7%
fma-define98.7%
Simplified98.7%
Taylor expanded in z around 0 59.7%
if 9.99999999999999957e110 < z Initial program 93.1%
+-commutative93.1%
fma-define93.1%
Simplified93.1%
Taylor expanded in y around 0 42.5%
mul-1-neg42.5%
unsub-neg42.5%
associate-/l*47.0%
*-rgt-identity47.0%
distribute-lft-out--47.0%
Simplified47.0%
Taylor expanded in z around inf 39.2%
mul-1-neg39.2%
distribute-frac-neg39.2%
distribute-lft-neg-out39.2%
*-commutative39.2%
associate-*r/41.3%
Simplified41.3%
Final simplification56.1%
(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 98.0%
+-commutative98.0%
fma-define98.0%
Simplified98.0%
Taylor expanded in y around 0 61.7%
mul-1-neg61.7%
unsub-neg61.7%
associate-/l*67.6%
*-rgt-identity67.6%
distribute-lft-out--67.6%
Simplified67.6%
(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.0%
+-commutative98.0%
fma-define98.0%
Simplified98.0%
Taylor expanded in z around 0 41.5%
(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 2024087
(FPCore (x y z t)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:tickPosition from plot-0.2.3.4"
:precision binary64
:alt
(if (< (* (- y x) (/ z t)) -1013646692435.8867) (+ x (/ (- y x) (/ t z))) (if (< (* (- y x) (/ z t)) 0.0) (+ x (/ (* (- y x) z) t)) (+ x (/ (- y x) (/ t z)))))
(+ x (* (- y x) (/ z t))))