
(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 97.8%
Final simplification97.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (/ z t))) (t_2 (/ (- z) (/ t x))))
(if (<= (/ z t) -1e+119)
(* x (/ (- z) t))
(if (<= (/ z t) -5e+76)
t_1
(if (<= (/ z t) -1e+46)
t_2
(if (<= (/ z t) -5e-43)
t_1
(if (<= (/ z t) 2e-12)
x
(if (<= (/ z t) 5e+140) (* z (/ y t)) t_2))))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (z / t);
double t_2 = -z / (t / x);
double tmp;
if ((z / t) <= -1e+119) {
tmp = x * (-z / t);
} else if ((z / t) <= -5e+76) {
tmp = t_1;
} else if ((z / t) <= -1e+46) {
tmp = t_2;
} else if ((z / t) <= -5e-43) {
tmp = t_1;
} else if ((z / t) <= 2e-12) {
tmp = x;
} else if ((z / t) <= 5e+140) {
tmp = z * (y / 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 * (z / t)
t_2 = -z / (t / x)
if ((z / t) <= (-1d+119)) then
tmp = x * (-z / t)
else if ((z / t) <= (-5d+76)) then
tmp = t_1
else if ((z / t) <= (-1d+46)) then
tmp = t_2
else if ((z / t) <= (-5d-43)) then
tmp = t_1
else if ((z / t) <= 2d-12) then
tmp = x
else if ((z / t) <= 5d+140) then
tmp = z * (y / 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 * (z / t);
double t_2 = -z / (t / x);
double tmp;
if ((z / t) <= -1e+119) {
tmp = x * (-z / t);
} else if ((z / t) <= -5e+76) {
tmp = t_1;
} else if ((z / t) <= -1e+46) {
tmp = t_2;
} else if ((z / t) <= -5e-43) {
tmp = t_1;
} else if ((z / t) <= 2e-12) {
tmp = x;
} else if ((z / t) <= 5e+140) {
tmp = z * (y / t);
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (z / t) t_2 = -z / (t / x) tmp = 0 if (z / t) <= -1e+119: tmp = x * (-z / t) elif (z / t) <= -5e+76: tmp = t_1 elif (z / t) <= -1e+46: tmp = t_2 elif (z / t) <= -5e-43: tmp = t_1 elif (z / t) <= 2e-12: tmp = x elif (z / t) <= 5e+140: tmp = z * (y / t) else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(z / t)) t_2 = Float64(Float64(-z) / Float64(t / x)) tmp = 0.0 if (Float64(z / t) <= -1e+119) tmp = Float64(x * Float64(Float64(-z) / t)); elseif (Float64(z / t) <= -5e+76) tmp = t_1; elseif (Float64(z / t) <= -1e+46) tmp = t_2; elseif (Float64(z / t) <= -5e-43) tmp = t_1; elseif (Float64(z / t) <= 2e-12) tmp = x; elseif (Float64(z / t) <= 5e+140) tmp = Float64(z * Float64(y / t)); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (z / t); t_2 = -z / (t / x); tmp = 0.0; if ((z / t) <= -1e+119) tmp = x * (-z / t); elseif ((z / t) <= -5e+76) tmp = t_1; elseif ((z / t) <= -1e+46) tmp = t_2; elseif ((z / t) <= -5e-43) tmp = t_1; elseif ((z / t) <= 2e-12) tmp = x; elseif ((z / t) <= 5e+140) tmp = z * (y / t); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[((-z) / N[(t / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z / t), $MachinePrecision], -1e+119], N[(x * N[((-z) / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z / t), $MachinePrecision], -5e+76], t$95$1, If[LessEqual[N[(z / t), $MachinePrecision], -1e+46], t$95$2, If[LessEqual[N[(z / t), $MachinePrecision], -5e-43], t$95$1, If[LessEqual[N[(z / t), $MachinePrecision], 2e-12], x, If[LessEqual[N[(z / t), $MachinePrecision], 5e+140], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z}{t}\\
t_2 := \frac{-z}{\frac{t}{x}}\\
\mathbf{if}\;\frac{z}{t} \leq -1 \cdot 10^{+119}:\\
\;\;\;\;x \cdot \frac{-z}{t}\\
\mathbf{elif}\;\frac{z}{t} \leq -5 \cdot 10^{+76}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{z}{t} \leq -1 \cdot 10^{+46}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\frac{z}{t} \leq -5 \cdot 10^{-43}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{z}{t} \leq 2 \cdot 10^{-12}:\\
\;\;\;\;x\\
\mathbf{elif}\;\frac{z}{t} \leq 5 \cdot 10^{+140}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if (/.f64 z t) < -9.99999999999999944e118Initial program 92.0%
Taylor expanded in x around inf 67.3%
*-commutative67.3%
mul-1-neg67.3%
unsub-neg67.3%
distribute-lft-out--67.3%
*-rgt-identity67.3%
Simplified67.3%
Taylor expanded in z around inf 51.3%
associate-*l/67.3%
associate-*r*67.3%
neg-mul-167.3%
*-commutative67.3%
distribute-neg-frac67.3%
Simplified67.3%
if -9.99999999999999944e118 < (/.f64 z t) < -4.99999999999999991e76 or -9.9999999999999999e45 < (/.f64 z t) < -5.00000000000000019e-43Initial program 99.9%
Taylor expanded in x around 0 86.6%
+-commutative86.6%
distribute-rgt1-in86.7%
mul-1-neg86.7%
cancel-sign-sub-inv86.7%
associate-*l/83.2%
unsub-neg83.2%
mul-1-neg83.2%
associate-+l+83.2%
mul-1-neg83.2%
unsub-neg83.2%
+-commutative83.2%
*-commutative83.2%
associate-/l*86.5%
associate-+r-86.5%
associate-/l*96.3%
div-sub99.8%
associate-/l*90.1%
*-commutative90.1%
Simplified87.1%
Taylor expanded in y around inf 56.7%
associate-*r/66.5%
Simplified66.5%
if -4.99999999999999991e76 < (/.f64 z t) < -9.9999999999999999e45 or 5.00000000000000008e140 < (/.f64 z t) Initial program 97.9%
Taylor expanded in x around 0 85.4%
+-commutative85.4%
distribute-rgt1-in85.4%
mul-1-neg85.4%
cancel-sign-sub-inv85.4%
associate-*l/87.7%
unsub-neg87.7%
mul-1-neg87.7%
associate-+l+87.7%
mul-1-neg87.7%
unsub-neg87.7%
+-commutative87.7%
*-commutative87.7%
associate-/l*87.3%
associate-+r-87.3%
associate-/l*82.3%
div-sub99.0%
associate-/l*96.0%
*-commutative96.0%
Simplified98.0%
Taylor expanded in z around inf 98.0%
div-sub98.0%
*-rgt-identity98.0%
associate-*r/97.8%
associate-*l*97.8%
associate-*l/97.9%
*-lft-identity97.9%
Simplified97.9%
Taylor expanded in y around 0 67.6%
mul-1-neg67.6%
associate-/l*71.5%
Simplified71.5%
if -5.00000000000000019e-43 < (/.f64 z t) < 1.99999999999999996e-12Initial program 98.6%
Taylor expanded in z around 0 79.9%
if 1.99999999999999996e-12 < (/.f64 z t) < 5.00000000000000008e140Initial program 99.7%
Taylor expanded in x around 0 87.1%
+-commutative87.1%
distribute-rgt1-in87.1%
mul-1-neg87.1%
cancel-sign-sub-inv87.1%
associate-*l/78.6%
unsub-neg78.6%
mul-1-neg78.6%
associate-+l+78.6%
mul-1-neg78.6%
unsub-neg78.6%
+-commutative78.6%
*-commutative78.6%
associate-/l*87.1%
associate-+r-87.1%
associate-/l*95.2%
div-sub99.5%
associate-/l*87.3%
*-commutative87.3%
Simplified99.7%
Taylor expanded in y around inf 66.8%
associate-/l*73.6%
associate-/r/77.9%
Applied egg-rr77.9%
Final simplification74.9%
(FPCore (x y z t)
:precision binary64
(if (<= (/ z t) -5e-43)
(* y (/ z t))
(if (<= (/ z t) 2e-12)
x
(if (<= (/ z t) 5e+140) (* z (/ y t)) (/ (- z) (/ t x))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z / t) <= -5e-43) {
tmp = y * (z / t);
} else if ((z / t) <= 2e-12) {
tmp = x;
} else if ((z / t) <= 5e+140) {
tmp = z * (y / t);
} 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 / t) <= (-5d-43)) then
tmp = y * (z / t)
else if ((z / t) <= 2d-12) then
tmp = x
else if ((z / t) <= 5d+140) then
tmp = z * (y / t)
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 / t) <= -5e-43) {
tmp = y * (z / t);
} else if ((z / t) <= 2e-12) {
tmp = x;
} else if ((z / t) <= 5e+140) {
tmp = z * (y / t);
} else {
tmp = -z / (t / x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z / t) <= -5e-43: tmp = y * (z / t) elif (z / t) <= 2e-12: tmp = x elif (z / t) <= 5e+140: tmp = z * (y / t) else: tmp = -z / (t / x) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z / t) <= -5e-43) tmp = Float64(y * Float64(z / t)); elseif (Float64(z / t) <= 2e-12) tmp = x; elseif (Float64(z / t) <= 5e+140) tmp = Float64(z * Float64(y / t)); 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 / t) <= -5e-43) tmp = y * (z / t); elseif ((z / t) <= 2e-12) tmp = x; elseif ((z / t) <= 5e+140) tmp = z * (y / t); else tmp = -z / (t / x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z / t), $MachinePrecision], -5e-43], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z / t), $MachinePrecision], 2e-12], x, If[LessEqual[N[(z / t), $MachinePrecision], 5e+140], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], N[((-z) / N[(t / x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -5 \cdot 10^{-43}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{elif}\;\frac{z}{t} \leq 2 \cdot 10^{-12}:\\
\;\;\;\;x\\
\mathbf{elif}\;\frac{z}{t} \leq 5 \cdot 10^{+140}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{-z}{\frac{t}{x}}\\
\end{array}
\end{array}
if (/.f64 z t) < -5.00000000000000019e-43Initial program 95.9%
Taylor expanded in x around 0 83.1%
+-commutative83.1%
distribute-rgt1-in83.1%
mul-1-neg83.1%
cancel-sign-sub-inv83.1%
associate-*l/82.0%
unsub-neg82.0%
mul-1-neg82.0%
associate-+l+82.0%
mul-1-neg82.0%
unsub-neg82.0%
+-commutative82.0%
*-commutative82.0%
associate-/l*83.0%
associate-+r-83.0%
associate-/l*84.2%
div-sub95.8%
associate-/l*90.5%
*-commutative90.5%
Simplified93.3%
Taylor expanded in y around inf 50.3%
associate-*r/53.1%
Simplified53.1%
if -5.00000000000000019e-43 < (/.f64 z t) < 1.99999999999999996e-12Initial program 98.6%
Taylor expanded in z around 0 79.9%
if 1.99999999999999996e-12 < (/.f64 z t) < 5.00000000000000008e140Initial program 99.7%
Taylor expanded in x around 0 87.1%
+-commutative87.1%
distribute-rgt1-in87.1%
mul-1-neg87.1%
cancel-sign-sub-inv87.1%
associate-*l/78.6%
unsub-neg78.6%
mul-1-neg78.6%
associate-+l+78.6%
mul-1-neg78.6%
unsub-neg78.6%
+-commutative78.6%
*-commutative78.6%
associate-/l*87.1%
associate-+r-87.1%
associate-/l*95.2%
div-sub99.5%
associate-/l*87.3%
*-commutative87.3%
Simplified99.7%
Taylor expanded in y around inf 66.8%
associate-/l*73.6%
associate-/r/77.9%
Applied egg-rr77.9%
if 5.00000000000000008e140 < (/.f64 z t) Initial program 97.6%
Taylor expanded in x around 0 83.4%
+-commutative83.4%
distribute-rgt1-in83.4%
mul-1-neg83.4%
cancel-sign-sub-inv83.4%
associate-*l/88.2%
unsub-neg88.2%
mul-1-neg88.2%
associate-+l+88.2%
mul-1-neg88.2%
unsub-neg88.2%
+-commutative88.2%
*-commutative88.2%
associate-/l*85.6%
associate-+r-85.6%
associate-/l*79.9%
div-sub98.9%
associate-/l*97.7%
*-commutative97.7%
Simplified97.8%
Taylor expanded in z around inf 97.8%
div-sub97.8%
*-rgt-identity97.8%
associate-*r/97.6%
associate-*l*97.5%
associate-*l/97.6%
*-lft-identity97.6%
Simplified97.6%
Taylor expanded in y around 0 65.2%
mul-1-neg65.2%
associate-/l*67.5%
Simplified67.5%
Final simplification70.4%
(FPCore (x y z t) :precision binary64 (if (<= (/ z t) -10000000.0) (* (- y x) (/ z t)) (if (<= (/ z t) 2e-12) (+ x (* y (/ z t))) (* z (- (/ y t) (/ x t))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z / t) <= -10000000.0) {
tmp = (y - x) * (z / t);
} else if ((z / t) <= 2e-12) {
tmp = x + (y * (z / t));
} else {
tmp = z * ((y / 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 ((z / t) <= (-10000000.0d0)) then
tmp = (y - x) * (z / t)
else if ((z / t) <= 2d-12) then
tmp = x + (y * (z / t))
else
tmp = z * ((y / t) - (x / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z / t) <= -10000000.0) {
tmp = (y - x) * (z / t);
} else if ((z / t) <= 2e-12) {
tmp = x + (y * (z / t));
} else {
tmp = z * ((y / t) - (x / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z / t) <= -10000000.0: tmp = (y - x) * (z / t) elif (z / t) <= 2e-12: tmp = x + (y * (z / t)) else: tmp = z * ((y / t) - (x / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z / t) <= -10000000.0) tmp = Float64(Float64(y - x) * Float64(z / t)); elseif (Float64(z / t) <= 2e-12) tmp = Float64(x + Float64(y * Float64(z / t))); else tmp = Float64(z * Float64(Float64(y / t) - Float64(x / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z / t) <= -10000000.0) tmp = (y - x) * (z / t); elseif ((z / t) <= 2e-12) tmp = x + (y * (z / t)); else tmp = z * ((y / t) - (x / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z / t), $MachinePrecision], -10000000.0], N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z / t), $MachinePrecision], 2e-12], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(N[(y / t), $MachinePrecision] - N[(x / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -10000000:\\
\;\;\;\;\left(y - x\right) \cdot \frac{z}{t}\\
\mathbf{elif}\;\frac{z}{t} \leq 2 \cdot 10^{-12}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(\frac{y}{t} - \frac{x}{t}\right)\\
\end{array}
\end{array}
if (/.f64 z t) < -1e7Initial program 95.3%
Taylor expanded in x around 0 83.4%
+-commutative83.4%
distribute-rgt1-in83.5%
mul-1-neg83.5%
cancel-sign-sub-inv83.5%
associate-*l/82.2%
unsub-neg82.2%
mul-1-neg82.2%
associate-+l+82.2%
mul-1-neg82.2%
unsub-neg82.2%
+-commutative82.2%
*-commutative82.2%
associate-/l*83.3%
associate-+r-83.3%
associate-/l*81.6%
div-sub95.1%
associate-/l*92.1%
*-commutative92.1%
Simplified93.7%
Taylor expanded in z around inf 87.5%
div-sub92.6%
*-rgt-identity92.6%
associate-*r/92.4%
associate-*l*93.1%
associate-*l/93.2%
*-lft-identity93.2%
Simplified93.2%
if -1e7 < (/.f64 z t) < 1.99999999999999996e-12Initial program 98.7%
Taylor expanded in y around inf 96.0%
associate-*r/98.5%
Simplified98.5%
if 1.99999999999999996e-12 < (/.f64 z t) Initial program 98.4%
Taylor expanded in z around inf 97.6%
Final simplification97.0%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ z t) -5e-43) (not (<= (/ z t) 2e-12))) (* (- y x) (/ z t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -5e-43) || !((z / t) <= 2e-12)) {
tmp = (y - 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) <= (-5d-43)) .or. (.not. ((z / t) <= 2d-12))) then
tmp = (y - 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) <= -5e-43) || !((z / t) <= 2e-12)) {
tmp = (y - x) * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z / t) <= -5e-43) or not ((z / t) <= 2e-12): tmp = (y - x) * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(z / t) <= -5e-43) || !(Float64(z / t) <= 2e-12)) tmp = Float64(Float64(y - x) * 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-43) || ~(((z / t) <= 2e-12))) tmp = (y - x) * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(z / t), $MachinePrecision], -5e-43], N[Not[LessEqual[N[(z / t), $MachinePrecision], 2e-12]], $MachinePrecision]], N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -5 \cdot 10^{-43} \lor \neg \left(\frac{z}{t} \leq 2 \cdot 10^{-12}\right):\\
\;\;\;\;\left(y - x\right) \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if (/.f64 z t) < -5.00000000000000019e-43 or 1.99999999999999996e-12 < (/.f64 z t) Initial program 97.1%
Taylor expanded in x around 0 83.9%
+-commutative83.9%
distribute-rgt1-in83.9%
mul-1-neg83.9%
cancel-sign-sub-inv83.9%
associate-*l/83.3%
unsub-neg83.3%
mul-1-neg83.3%
associate-+l+83.3%
mul-1-neg83.3%
unsub-neg83.3%
+-commutative83.3%
*-commutative83.3%
associate-/l*84.5%
associate-+r-84.5%
associate-/l*84.7%
div-sub97.4%
associate-/l*92.2%
*-commutative92.2%
Simplified95.8%
Taylor expanded in z around inf 90.5%
div-sub92.8%
*-rgt-identity92.8%
associate-*r/92.6%
associate-*l*92.9%
associate-*l/93.1%
*-lft-identity93.1%
Simplified93.1%
if -5.00000000000000019e-43 < (/.f64 z t) < 1.99999999999999996e-12Initial program 98.6%
Taylor expanded in z around 0 79.9%
Final simplification86.9%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ z t) -10000000.0) (not (<= (/ z t) 2e-12))) (* (- y x) (/ z t)) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -10000000.0) || !((z / t) <= 2e-12)) {
tmp = (y - x) * (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 (((z / t) <= (-10000000.0d0)) .or. (.not. ((z / t) <= 2d-12))) then
tmp = (y - x) * (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 (((z / t) <= -10000000.0) || !((z / t) <= 2e-12)) {
tmp = (y - x) * (z / t);
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z / t) <= -10000000.0) or not ((z / t) <= 2e-12): tmp = (y - x) * (z / t) else: tmp = x + (y * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(z / t) <= -10000000.0) || !(Float64(z / t) <= 2e-12)) tmp = Float64(Float64(y - x) * 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 (((z / t) <= -10000000.0) || ~(((z / t) <= 2e-12))) tmp = (y - x) * (z / t); else tmp = x + (y * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(z / t), $MachinePrecision], -10000000.0], N[Not[LessEqual[N[(z / t), $MachinePrecision], 2e-12]], $MachinePrecision]], N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -10000000 \lor \neg \left(\frac{z}{t} \leq 2 \cdot 10^{-12}\right):\\
\;\;\;\;\left(y - x\right) \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if (/.f64 z t) < -1e7 or 1.99999999999999996e-12 < (/.f64 z t) Initial program 96.9%
Taylor expanded in x around 0 84.1%
+-commutative84.1%
distribute-rgt1-in84.1%
mul-1-neg84.1%
cancel-sign-sub-inv84.1%
associate-*l/83.5%
unsub-neg83.5%
mul-1-neg83.5%
associate-+l+83.5%
mul-1-neg83.5%
unsub-neg83.5%
+-commutative83.5%
*-commutative83.5%
associate-/l*84.8%
associate-+r-84.8%
associate-/l*83.5%
div-sub97.2%
associate-/l*93.1%
*-commutative93.1%
Simplified96.2%
Taylor expanded in z around inf 92.8%
div-sub95.2%
*-rgt-identity95.2%
associate-*r/95.0%
associate-*l*95.3%
associate-*l/95.5%
*-lft-identity95.5%
Simplified95.5%
if -1e7 < (/.f64 z t) < 1.99999999999999996e-12Initial program 98.7%
Taylor expanded in y around inf 96.0%
associate-*r/98.5%
Simplified98.5%
Final simplification97.0%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ z t) -5e-43) (not (<= (/ z t) 2e-12))) (* y (/ z t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -5e-43) || !((z / t) <= 2e-12)) {
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-43)) .or. (.not. ((z / t) <= 2d-12))) 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-43) || !((z / t) <= 2e-12)) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z / t) <= -5e-43) or not ((z / t) <= 2e-12): tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(z / t) <= -5e-43) || !(Float64(z / t) <= 2e-12)) 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-43) || ~(((z / t) <= 2e-12))) 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-43], N[Not[LessEqual[N[(z / t), $MachinePrecision], 2e-12]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -5 \cdot 10^{-43} \lor \neg \left(\frac{z}{t} \leq 2 \cdot 10^{-12}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if (/.f64 z t) < -5.00000000000000019e-43 or 1.99999999999999996e-12 < (/.f64 z t) Initial program 97.1%
Taylor expanded in x around 0 83.9%
+-commutative83.9%
distribute-rgt1-in83.9%
mul-1-neg83.9%
cancel-sign-sub-inv83.9%
associate-*l/83.3%
unsub-neg83.3%
mul-1-neg83.3%
associate-+l+83.3%
mul-1-neg83.3%
unsub-neg83.3%
+-commutative83.3%
*-commutative83.3%
associate-/l*84.5%
associate-+r-84.5%
associate-/l*84.7%
div-sub97.4%
associate-/l*92.2%
*-commutative92.2%
Simplified95.8%
Taylor expanded in y around inf 52.1%
associate-*r/56.2%
Simplified56.2%
if -5.00000000000000019e-43 < (/.f64 z t) < 1.99999999999999996e-12Initial program 98.6%
Taylor expanded in z around 0 79.9%
Final simplification67.4%
(FPCore (x y z t) :precision binary64 (if (<= (/ z t) -5e-43) (* y (/ z t)) (if (<= (/ z t) 2e-12) x (/ y (/ t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z / t) <= -5e-43) {
tmp = y * (z / t);
} else if ((z / t) <= 2e-12) {
tmp = x;
} else {
tmp = 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 / t) <= (-5d-43)) then
tmp = y * (z / t)
else if ((z / t) <= 2d-12) then
tmp = x
else
tmp = 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 / t) <= -5e-43) {
tmp = y * (z / t);
} else if ((z / t) <= 2e-12) {
tmp = x;
} else {
tmp = y / (t / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z / t) <= -5e-43: tmp = y * (z / t) elif (z / t) <= 2e-12: tmp = x else: tmp = y / (t / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z / t) <= -5e-43) tmp = Float64(y * Float64(z / t)); elseif (Float64(z / t) <= 2e-12) tmp = x; else tmp = Float64(y / Float64(t / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z / t) <= -5e-43) tmp = y * (z / t); elseif ((z / t) <= 2e-12) tmp = x; else tmp = y / (t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z / t), $MachinePrecision], -5e-43], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z / t), $MachinePrecision], 2e-12], x, N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -5 \cdot 10^{-43}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{elif}\;\frac{z}{t} \leq 2 \cdot 10^{-12}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{t}{z}}\\
\end{array}
\end{array}
if (/.f64 z t) < -5.00000000000000019e-43Initial program 95.9%
Taylor expanded in x around 0 83.1%
+-commutative83.1%
distribute-rgt1-in83.1%
mul-1-neg83.1%
cancel-sign-sub-inv83.1%
associate-*l/82.0%
unsub-neg82.0%
mul-1-neg82.0%
associate-+l+82.0%
mul-1-neg82.0%
unsub-neg82.0%
+-commutative82.0%
*-commutative82.0%
associate-/l*83.0%
associate-+r-83.0%
associate-/l*84.2%
div-sub95.8%
associate-/l*90.5%
*-commutative90.5%
Simplified93.3%
Taylor expanded in y around inf 50.3%
associate-*r/53.1%
Simplified53.1%
if -5.00000000000000019e-43 < (/.f64 z t) < 1.99999999999999996e-12Initial program 98.6%
Taylor expanded in z around 0 79.9%
if 1.99999999999999996e-12 < (/.f64 z t) Initial program 98.4%
Taylor expanded in x around 0 84.7%
+-commutative84.7%
distribute-rgt1-in84.7%
mul-1-neg84.7%
cancel-sign-sub-inv84.7%
associate-*l/84.8%
unsub-neg84.8%
mul-1-neg84.8%
associate-+l+84.8%
mul-1-neg84.8%
unsub-neg84.8%
+-commutative84.8%
*-commutative84.8%
associate-/l*86.1%
associate-+r-86.1%
associate-/l*85.3%
div-sub99.1%
associate-/l*94.0%
*-commutative94.0%
Simplified98.5%
Taylor expanded in y around inf 54.1%
associate-*r/59.5%
Simplified59.5%
associate-*r/54.1%
associate-/l*60.3%
Applied egg-rr60.3%
Final simplification67.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 97.8%
Taylor expanded in z around 0 40.8%
Final simplification40.8%
(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 2023187
(FPCore (x y z t)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:tickPosition from plot-0.2.3.4"
:precision binary64
:herbie-target
(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))))