
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y z) t) (- a z))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * t) / (a - z));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (((y - z) * t) / (a - z))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * t) / (a - z));
}
def code(x, y, z, t, a): return x + (((y - z) * t) / (a - z))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - z) * t) / Float64(a - z))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - z) * t) / (a - z)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - z\right) \cdot t}{a - z}
\end{array}
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y z) t) (- a z))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * t) / (a - z));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (((y - z) * t) / (a - z))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * t) / (a - z));
}
def code(x, y, z, t, a): return x + (((y - z) * t) / (a - z))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - z) * t) / Float64(a - z))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - z) * t) / (a - z)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - z\right) \cdot t}{a - z}
\end{array}
(FPCore (x y z t a) :precision binary64 (fma (* (/ 1.0 (- a z)) y) t (fma (/ z (- z a)) t x)))
double code(double x, double y, double z, double t, double a) {
return fma(((1.0 / (a - z)) * y), t, fma((z / (z - a)), t, x));
}
function code(x, y, z, t, a) return fma(Float64(Float64(1.0 / Float64(a - z)) * y), t, fma(Float64(z / Float64(z - a)), t, x)) end
code[x_, y_, z_, t_, a_] := N[(N[(N[(1.0 / N[(a - z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision] * t + N[(N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision] * t + x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{1}{a - z} \cdot y, t, \mathsf{fma}\left(\frac{z}{z - a}, t, x\right)\right)
\end{array}
Initial program 85.7%
Applied rewrites98.0%
(FPCore (x y z t a) :precision binary64 (fma (/ (- z y) (- z a)) t x))
double code(double x, double y, double z, double t, double a) {
return fma(((z - y) / (z - a)), t, x);
}
function code(x, y, z, t, a) return fma(Float64(Float64(z - y) / Float64(z - a)), t, x) end
code[x_, y_, z_, t_, a_] := N[(N[(N[(z - y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * t + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{z - y}{z - a}, t, x\right)
\end{array}
Initial program 85.7%
Applied rewrites98.0%
(FPCore (x y z t a) :precision binary64 (fma (/ t (- z a)) (- z y) x))
double code(double x, double y, double z, double t, double a) {
return fma((t / (z - a)), (z - y), x);
}
function code(x, y, z, t, a) return fma(Float64(t / Float64(z - a)), Float64(z - y), x) end
code[x_, y_, z_, t_, a_] := N[(N[(t / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(z - y), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{t}{z - a}, z - y, x\right)
\end{array}
Initial program 85.7%
Applied rewrites95.7%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (+ x (/ (* t y) (- a z))))) (if (<= y -1.1e-54) t_1 (if (<= y 2.7e-51) (fma (/ z (- z a)) t x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + ((t * y) / (a - z));
double tmp;
if (y <= -1.1e-54) {
tmp = t_1;
} else if (y <= 2.7e-51) {
tmp = fma((z / (z - a)), t, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(t * y) / Float64(a - z))) tmp = 0.0 if (y <= -1.1e-54) tmp = t_1; elseif (y <= 2.7e-51) tmp = fma(Float64(z / Float64(z - a)), t, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(t * y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.1e-54], t$95$1, If[LessEqual[y, 2.7e-51], N[(N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision] * t + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{t \cdot y}{a - z}\\
\mathbf{if}\;y \leq -1.1 \cdot 10^{-54}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.7 \cdot 10^{-51}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{z - a}, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.1e-54 or 2.6999999999999997e-51 < y Initial program 85.7%
Taylor expanded in y around inf
Applied rewrites73.9%
if -1.1e-54 < y < 2.6999999999999997e-51Initial program 85.7%
Applied rewrites98.0%
Taylor expanded in y around 0
Applied rewrites71.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* (- y z) t) (- a z))))
(if (<= t_1 -2e-18)
(* (/ t (- z a)) (- z y))
(if (<= t_1 1e+79) (fma (/ z (- z a)) t x) (* (/ (- z y) (- z a)) t)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((y - z) * t) / (a - z);
double tmp;
if (t_1 <= -2e-18) {
tmp = (t / (z - a)) * (z - y);
} else if (t_1 <= 1e+79) {
tmp = fma((z / (z - a)), t, x);
} else {
tmp = ((z - y) / (z - a)) * t;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(y - z) * t) / Float64(a - z)) tmp = 0.0 if (t_1 <= -2e-18) tmp = Float64(Float64(t / Float64(z - a)) * Float64(z - y)); elseif (t_1 <= 1e+79) tmp = fma(Float64(z / Float64(z - a)), t, x); else tmp = Float64(Float64(Float64(z - y) / Float64(z - a)) * t); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-18], N[(N[(t / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(z - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+79], N[(N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision] * t + x), $MachinePrecision], N[(N[(N[(z - y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(y - z\right) \cdot t}{a - z}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-18}:\\
\;\;\;\;\frac{t}{z - a} \cdot \left(z - y\right)\\
\mathbf{elif}\;t\_1 \leq 10^{+79}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{z - a}, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z - y}{z - a} \cdot t\\
\end{array}
\end{array}
if (/.f64 (*.f64 (-.f64 y z) t) (-.f64 a z)) < -2.0000000000000001e-18Initial program 85.7%
Taylor expanded in x around 0
Applied rewrites39.3%
Applied rewrites46.6%
if -2.0000000000000001e-18 < (/.f64 (*.f64 (-.f64 y z) t) (-.f64 a z)) < 9.99999999999999967e78Initial program 85.7%
Applied rewrites98.0%
Taylor expanded in y around 0
Applied rewrites71.7%
if 9.99999999999999967e78 < (/.f64 (*.f64 (-.f64 y z) t) (-.f64 a z)) Initial program 85.7%
Taylor expanded in x around 0
Applied rewrites39.3%
Applied rewrites48.8%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (/ t (- z a)) (- z y))) (t_2 (/ (* (- y z) t) (- a z)))) (if (<= t_2 -2e-18) t_1 (if (<= t_2 5e+146) (fma (/ z (- z a)) t x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t / (z - a)) * (z - y);
double t_2 = ((y - z) * t) / (a - z);
double tmp;
if (t_2 <= -2e-18) {
tmp = t_1;
} else if (t_2 <= 5e+146) {
tmp = fma((z / (z - a)), t, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(t / Float64(z - a)) * Float64(z - y)) t_2 = Float64(Float64(Float64(y - z) * t) / Float64(a - z)) tmp = 0.0 if (t_2 <= -2e-18) tmp = t_1; elseif (t_2 <= 5e+146) tmp = fma(Float64(z / Float64(z - a)), t, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(z - y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e-18], t$95$1, If[LessEqual[t$95$2, 5e+146], N[(N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision] * t + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t}{z - a} \cdot \left(z - y\right)\\
t_2 := \frac{\left(y - z\right) \cdot t}{a - z}\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{-18}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+146}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{z - a}, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 (-.f64 y z) t) (-.f64 a z)) < -2.0000000000000001e-18 or 4.9999999999999999e146 < (/.f64 (*.f64 (-.f64 y z) t) (-.f64 a z)) Initial program 85.7%
Taylor expanded in x around 0
Applied rewrites39.3%
Applied rewrites46.6%
if -2.0000000000000001e-18 < (/.f64 (*.f64 (-.f64 y z) t) (-.f64 a z)) < 4.9999999999999999e146Initial program 85.7%
Applied rewrites98.0%
Taylor expanded in y around 0
Applied rewrites71.7%
(FPCore (x y z t a) :precision binary64 (if (<= a -1.2e+68) (fma (/ y a) t x) (if (<= a 6.5e-85) (fma (/ (- z y) z) t x) (fma (/ z (- z a)) t x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.2e+68) {
tmp = fma((y / a), t, x);
} else if (a <= 6.5e-85) {
tmp = fma(((z - y) / z), t, x);
} else {
tmp = fma((z / (z - a)), t, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.2e+68) tmp = fma(Float64(y / a), t, x); elseif (a <= 6.5e-85) tmp = fma(Float64(Float64(z - y) / z), t, x); else tmp = fma(Float64(z / Float64(z - a)), t, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.2e+68], N[(N[(y / a), $MachinePrecision] * t + x), $MachinePrecision], If[LessEqual[a, 6.5e-85], N[(N[(N[(z - y), $MachinePrecision] / z), $MachinePrecision] * t + x), $MachinePrecision], N[(N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision] * t + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.2 \cdot 10^{+68}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t, x\right)\\
\mathbf{elif}\;a \leq 6.5 \cdot 10^{-85}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{z}, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{z - a}, t, x\right)\\
\end{array}
\end{array}
if a < -1.20000000000000004e68Initial program 85.7%
Applied rewrites98.0%
Applied rewrites98.0%
Taylor expanded in z around 0
Applied rewrites62.2%
if -1.20000000000000004e68 < a < 6.5e-85Initial program 85.7%
Applied rewrites98.0%
Taylor expanded in a around 0
Applied rewrites66.4%
if 6.5e-85 < a Initial program 85.7%
Applied rewrites98.0%
Taylor expanded in y around 0
Applied rewrites71.7%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma (/ (- z y) z) t x))) (if (<= z -2.1e-95) t_1 (if (<= z 5.3e-46) (fma (/ y a) t x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((z - y) / z), t, x);
double tmp;
if (z <= -2.1e-95) {
tmp = t_1;
} else if (z <= 5.3e-46) {
tmp = fma((y / a), t, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(z - y) / z), t, x) tmp = 0.0 if (z <= -2.1e-95) tmp = t_1; elseif (z <= 5.3e-46) tmp = fma(Float64(y / a), t, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(z - y), $MachinePrecision] / z), $MachinePrecision] * t + x), $MachinePrecision]}, If[LessEqual[z, -2.1e-95], t$95$1, If[LessEqual[z, 5.3e-46], N[(N[(y / a), $MachinePrecision] * t + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{z - y}{z}, t, x\right)\\
\mathbf{if}\;z \leq -2.1 \cdot 10^{-95}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 5.3 \cdot 10^{-46}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.1e-95 or 5.30000000000000018e-46 < z Initial program 85.7%
Applied rewrites98.0%
Taylor expanded in a around 0
Applied rewrites66.4%
if -2.1e-95 < z < 5.30000000000000018e-46Initial program 85.7%
Applied rewrites98.0%
Applied rewrites98.0%
Taylor expanded in z around 0
Applied rewrites62.2%
(FPCore (x y z t a) :precision binary64 (if (<= a -5.4e+59) (fma (/ y a) t x) (if (<= a 2.55e-81) (fma (/ t z) (- z y) x) (+ x (/ (* t y) a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -5.4e+59) {
tmp = fma((y / a), t, x);
} else if (a <= 2.55e-81) {
tmp = fma((t / z), (z - y), x);
} else {
tmp = x + ((t * y) / a);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -5.4e+59) tmp = fma(Float64(y / a), t, x); elseif (a <= 2.55e-81) tmp = fma(Float64(t / z), Float64(z - y), x); else tmp = Float64(x + Float64(Float64(t * y) / a)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -5.4e+59], N[(N[(y / a), $MachinePrecision] * t + x), $MachinePrecision], If[LessEqual[a, 2.55e-81], N[(N[(t / z), $MachinePrecision] * N[(z - y), $MachinePrecision] + x), $MachinePrecision], N[(x + N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.4 \cdot 10^{+59}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t, x\right)\\
\mathbf{elif}\;a \leq 2.55 \cdot 10^{-81}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{z}, z - y, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{t \cdot y}{a}\\
\end{array}
\end{array}
if a < -5.4000000000000002e59Initial program 85.7%
Applied rewrites98.0%
Applied rewrites98.0%
Taylor expanded in z around 0
Applied rewrites62.2%
if -5.4000000000000002e59 < a < 2.55000000000000014e-81Initial program 85.7%
Applied rewrites95.7%
Taylor expanded in z around inf
Applied rewrites65.2%
if 2.55000000000000014e-81 < a Initial program 85.7%
Taylor expanded in z around 0
Applied rewrites60.5%
(FPCore (x y z t a) :precision binary64 (if (<= z -650000000000.0) (+ x t) (if (<= z 1600000.0) (fma (/ y a) t x) (+ x t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -650000000000.0) {
tmp = x + t;
} else if (z <= 1600000.0) {
tmp = fma((y / a), t, x);
} else {
tmp = x + t;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -650000000000.0) tmp = Float64(x + t); elseif (z <= 1600000.0) tmp = fma(Float64(y / a), t, x); else tmp = Float64(x + t); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -650000000000.0], N[(x + t), $MachinePrecision], If[LessEqual[z, 1600000.0], N[(N[(y / a), $MachinePrecision] * t + x), $MachinePrecision], N[(x + t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -650000000000:\\
\;\;\;\;x + t\\
\mathbf{elif}\;z \leq 1600000:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + t\\
\end{array}
\end{array}
if z < -6.5e11 or 1.6e6 < z Initial program 85.7%
Taylor expanded in z around inf
Applied rewrites60.7%
if -6.5e11 < z < 1.6e6Initial program 85.7%
Applied rewrites98.0%
Applied rewrites98.0%
Taylor expanded in z around 0
Applied rewrites62.2%
(FPCore (x y z t a) :precision binary64 (if (<= t 2.2e+195) (+ x t) (* (/ y a) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 2.2e+195) {
tmp = x + t;
} else {
tmp = (y / a) * t;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (t <= 2.2d+195) then
tmp = x + t
else
tmp = (y / a) * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 2.2e+195) {
tmp = x + t;
} else {
tmp = (y / a) * t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 2.2e+195: tmp = x + t else: tmp = (y / a) * t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 2.2e+195) tmp = Float64(x + t); else tmp = Float64(Float64(y / a) * t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 2.2e+195) tmp = x + t; else tmp = (y / a) * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 2.2e+195], N[(x + t), $MachinePrecision], N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 2.2 \cdot 10^{+195}:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a} \cdot t\\
\end{array}
\end{array}
if t < 2.2e195Initial program 85.7%
Taylor expanded in z around inf
Applied rewrites60.7%
if 2.2e195 < t Initial program 85.7%
Taylor expanded in y around inf
Applied rewrites26.4%
Applied rewrites28.6%
Taylor expanded in z around 0
Applied rewrites20.3%
(FPCore (x y z t a) :precision binary64 (+ x t))
double code(double x, double y, double z, double t, double a) {
return x + t;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + t
end function
public static double code(double x, double y, double z, double t, double a) {
return x + t;
}
def code(x, y, z, t, a): return x + t
function code(x, y, z, t, a) return Float64(x + t) end
function tmp = code(x, y, z, t, a) tmp = x + t; end
code[x_, y_, z_, t_, a_] := N[(x + t), $MachinePrecision]
\begin{array}{l}
\\
x + t
\end{array}
Initial program 85.7%
Taylor expanded in z around inf
Applied rewrites60.7%
(FPCore (x y z t a) :precision binary64 t)
double code(double x, double y, double z, double t, double a) {
return t;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = t
end function
public static double code(double x, double y, double z, double t, double a) {
return t;
}
def code(x, y, z, t, a): return t
function code(x, y, z, t, a) return t end
function tmp = code(x, y, z, t, a) tmp = t; end
code[x_, y_, z_, t_, a_] := t
\begin{array}{l}
\\
t
\end{array}
Initial program 85.7%
Taylor expanded in x around 0
Applied rewrites39.3%
Applied rewrites48.8%
Taylor expanded in z around inf
Applied rewrites18.5%
herbie shell --seed 2025153
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, A"
:precision binary64
(+ x (/ (* (- y z) t) (- a z))))