
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y x) (- z t)) (- a t))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (a - 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 + (((y - x) * (z - t)) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (a - t));
}
def code(x, y, z, t, a): return x + (((y - x) * (z - t)) / (a - t))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - x) * Float64(z - t)) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - x) * (z - t)) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}
\end{array}
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y x) (- z t)) (- a t))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (a - 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 + (((y - x) * (z - t)) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (a - t));
}
def code(x, y, z, t, a): return x + (((y - x) * (z - t)) / (a - t))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - x) * Float64(z - t)) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - x) * (z - t)) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- t z) (- t a)) (- y x) x))
(t_2 (+ x (/ (* (- y x) (- z t)) (- a t)))))
(if (<= t_2 -4e-304)
t_1
(if (<= t_2 0.0)
(+ y (* -1.0 (/ (- (* z (- y x)) (* a (- y x))) t)))
t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((t - z) / (t - a)), (y - x), x);
double t_2 = x + (((y - x) * (z - t)) / (a - t));
double tmp;
if (t_2 <= -4e-304) {
tmp = t_1;
} else if (t_2 <= 0.0) {
tmp = y + (-1.0 * (((z * (y - x)) - (a * (y - x))) / t));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(t - z) / Float64(t - a)), Float64(y - x), x) t_2 = Float64(x + Float64(Float64(Float64(y - x) * Float64(z - t)) / Float64(a - t))) tmp = 0.0 if (t_2 <= -4e-304) tmp = t_1; elseif (t_2 <= 0.0) tmp = Float64(y + Float64(-1.0 * Float64(Float64(Float64(z * Float64(y - x)) - Float64(a * Float64(y - x))) / t))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(t - z), $MachinePrecision] / N[(t - a), $MachinePrecision]), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -4e-304], t$95$1, If[LessEqual[t$95$2, 0.0], N[(y + N[(-1.0 * N[(N[(N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision] - N[(a * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{t - z}{t - a}, y - x, x\right)\\
t_2 := x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\\
\mathbf{if}\;t\_2 \leq -4 \cdot 10^{-304}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;y + -1 \cdot \frac{z \cdot \left(y - x\right) - a \cdot \left(y - x\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < -3.99999999999999988e-304 or 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) Initial program 68.3%
lift-+.f64N/A
+-commutativeN/A
remove-double-negN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f64N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6484.1
Applied rewrites84.1%
if -3.99999999999999988e-304 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < 0.0Initial program 68.3%
Taylor expanded in t around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f6446.7
Applied rewrites46.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ (- z t) (- a t)) y)))
(if (<= t -5e+207)
t_1
(if (<= t 1.5e+250) (fma (/ (- t z) (- t a)) (- y x) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((z - t) / (a - t)) * y;
double tmp;
if (t <= -5e+207) {
tmp = t_1;
} else if (t <= 1.5e+250) {
tmp = fma(((t - z) / (t - a)), (y - x), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(z - t) / Float64(a - t)) * y) tmp = 0.0 if (t <= -5e+207) tmp = t_1; elseif (t <= 1.5e+250) tmp = fma(Float64(Float64(t - z) / Float64(t - a)), Float64(y - x), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[t, -5e+207], t$95$1, If[LessEqual[t, 1.5e+250], N[(N[(N[(t - z), $MachinePrecision] / N[(t - a), $MachinePrecision]), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{a - t} \cdot y\\
\mathbf{if}\;t \leq -5 \cdot 10^{+207}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.5 \cdot 10^{+250}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - z}{t - a}, y - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -4.9999999999999999e207 or 1.49999999999999988e250 < t Initial program 68.3%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.9
Applied rewrites39.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
frac-2negN/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6452.0
lift-/.f64N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
lower-/.f6452.0
Applied rewrites52.0%
if -4.9999999999999999e207 < t < 1.49999999999999988e250Initial program 68.3%
lift-+.f64N/A
+-commutativeN/A
remove-double-negN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f64N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6484.1
Applied rewrites84.1%
(FPCore (x y z t a)
:precision binary64
(if (<= a -1.4e+95)
(fma (/ z a) (- y x) x)
(if (<= a 0.00046)
(* (/ (- z t) (- a t)) y)
(fma (/ (- t z) (- t a)) y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.4e+95) {
tmp = fma((z / a), (y - x), x);
} else if (a <= 0.00046) {
tmp = ((z - t) / (a - t)) * y;
} else {
tmp = fma(((t - z) / (t - a)), y, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.4e+95) tmp = fma(Float64(z / a), Float64(y - x), x); elseif (a <= 0.00046) tmp = Float64(Float64(Float64(z - t) / Float64(a - t)) * y); else tmp = fma(Float64(Float64(t - z) / Float64(t - a)), y, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.4e+95], N[(N[(z / a), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[a, 0.00046], N[(N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], N[(N[(N[(t - z), $MachinePrecision] / N[(t - a), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.4 \cdot 10^{+95}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y - x, x\right)\\
\mathbf{elif}\;a \leq 0.00046:\\
\;\;\;\;\frac{z - t}{a - t} \cdot y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - z}{t - a}, y, x\right)\\
\end{array}
\end{array}
if a < -1.3999999999999999e95Initial program 68.3%
lift-+.f64N/A
+-commutativeN/A
remove-double-negN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f64N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6484.1
Applied rewrites84.1%
Taylor expanded in t around 0
lower-/.f6448.4
Applied rewrites48.4%
if -1.3999999999999999e95 < a < 4.6000000000000001e-4Initial program 68.3%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.9
Applied rewrites39.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
frac-2negN/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6452.0
lift-/.f64N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
lower-/.f6452.0
Applied rewrites52.0%
if 4.6000000000000001e-4 < a Initial program 68.3%
lift-+.f64N/A
+-commutativeN/A
remove-double-negN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f64N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6484.1
Applied rewrites84.1%
Taylor expanded in x around 0
Applied rewrites67.7%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma (/ z a) (- y x) x))) (if (<= a -1.4e+95) t_1 (if (<= a 0.014) (* (/ (- z t) (- a t)) y) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((z / a), (y - x), x);
double tmp;
if (a <= -1.4e+95) {
tmp = t_1;
} else if (a <= 0.014) {
tmp = ((z - t) / (a - t)) * y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(z / a), Float64(y - x), x) tmp = 0.0 if (a <= -1.4e+95) tmp = t_1; elseif (a <= 0.014) tmp = Float64(Float64(Float64(z - t) / Float64(a - t)) * y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z / a), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -1.4e+95], t$95$1, If[LessEqual[a, 0.014], N[(N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{z}{a}, y - x, x\right)\\
\mathbf{if}\;a \leq -1.4 \cdot 10^{+95}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 0.014:\\
\;\;\;\;\frac{z - t}{a - t} \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.3999999999999999e95 or 0.0140000000000000003 < a Initial program 68.3%
lift-+.f64N/A
+-commutativeN/A
remove-double-negN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f64N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6484.1
Applied rewrites84.1%
Taylor expanded in t around 0
lower-/.f6448.4
Applied rewrites48.4%
if -1.3999999999999999e95 < a < 0.0140000000000000003Initial program 68.3%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.9
Applied rewrites39.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
frac-2negN/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6452.0
lift-/.f64N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
lower-/.f6452.0
Applied rewrites52.0%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma (/ z a) (- y x) x))) (if (<= a -1.4e+63) t_1 (if (<= a 0.0135) (* (/ y (- t a)) (- t z)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((z / a), (y - x), x);
double tmp;
if (a <= -1.4e+63) {
tmp = t_1;
} else if (a <= 0.0135) {
tmp = (y / (t - a)) * (t - z);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(z / a), Float64(y - x), x) tmp = 0.0 if (a <= -1.4e+63) tmp = t_1; elseif (a <= 0.0135) tmp = Float64(Float64(y / Float64(t - a)) * Float64(t - z)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z / a), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -1.4e+63], t$95$1, If[LessEqual[a, 0.0135], N[(N[(y / N[(t - a), $MachinePrecision]), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{z}{a}, y - x, x\right)\\
\mathbf{if}\;a \leq -1.4 \cdot 10^{+63}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 0.0135:\\
\;\;\;\;\frac{y}{t - a} \cdot \left(t - z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.39999999999999993e63 or 0.0134999999999999998 < a Initial program 68.3%
lift-+.f64N/A
+-commutativeN/A
remove-double-negN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f64N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6484.1
Applied rewrites84.1%
Taylor expanded in t around 0
lower-/.f6448.4
Applied rewrites48.4%
if -1.39999999999999993e63 < a < 0.0134999999999999998Initial program 68.3%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.9
Applied rewrites39.9%
lift-/.f64N/A
mult-flipN/A
metadata-evalN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
frac-2negN/A
lift-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
Applied rewrites46.7%
(FPCore (x y z t a) :precision binary64 (if (<= t -2.2e+107) (* (/ y t) (- t z)) (if (<= t 7e+30) (fma (/ z a) (- y x) x) (fma (/ (- t z) t) y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.2e+107) {
tmp = (y / t) * (t - z);
} else if (t <= 7e+30) {
tmp = fma((z / a), (y - x), x);
} else {
tmp = fma(((t - z) / t), y, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -2.2e+107) tmp = Float64(Float64(y / t) * Float64(t - z)); elseif (t <= 7e+30) tmp = fma(Float64(z / a), Float64(y - x), x); else tmp = fma(Float64(Float64(t - z) / t), y, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -2.2e+107], N[(N[(y / t), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 7e+30], N[(N[(z / a), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(t - z), $MachinePrecision] / t), $MachinePrecision] * y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.2 \cdot 10^{+107}:\\
\;\;\;\;\frac{y}{t} \cdot \left(t - z\right)\\
\mathbf{elif}\;t \leq 7 \cdot 10^{+30}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - z}{t}, y, x\right)\\
\end{array}
\end{array}
if t < -2.2e107Initial program 68.3%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.9
Applied rewrites39.9%
lift-/.f64N/A
mult-flipN/A
metadata-evalN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
frac-2negN/A
lift-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
Applied rewrites46.7%
Taylor expanded in t around inf
lower-/.f6432.4
Applied rewrites32.4%
if -2.2e107 < t < 7.00000000000000042e30Initial program 68.3%
lift-+.f64N/A
+-commutativeN/A
remove-double-negN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f64N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6484.1
Applied rewrites84.1%
Taylor expanded in t around 0
lower-/.f6448.4
Applied rewrites48.4%
if 7.00000000000000042e30 < t Initial program 68.3%
lift-+.f64N/A
+-commutativeN/A
remove-double-negN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f64N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6484.1
Applied rewrites84.1%
Taylor expanded in x around 0
Applied rewrites67.7%
Taylor expanded in a around 0
lower-/.f64N/A
lower--.f6442.4
Applied rewrites42.4%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (/ y t) (- t z)))) (if (<= t -2.2e+107) t_1 (if (<= t 5e+19) (fma (/ z a) (- y x) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y / t) * (t - z);
double tmp;
if (t <= -2.2e+107) {
tmp = t_1;
} else if (t <= 5e+19) {
tmp = fma((z / a), (y - x), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(y / t) * Float64(t - z)) tmp = 0.0 if (t <= -2.2e+107) tmp = t_1; elseif (t <= 5e+19) tmp = fma(Float64(z / a), Float64(y - x), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / t), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -2.2e+107], t$95$1, If[LessEqual[t, 5e+19], N[(N[(z / a), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{t} \cdot \left(t - z\right)\\
\mathbf{if}\;t \leq -2.2 \cdot 10^{+107}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 5 \cdot 10^{+19}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -2.2e107 or 5e19 < t Initial program 68.3%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.9
Applied rewrites39.9%
lift-/.f64N/A
mult-flipN/A
metadata-evalN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
frac-2negN/A
lift-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
Applied rewrites46.7%
Taylor expanded in t around inf
lower-/.f6432.4
Applied rewrites32.4%
if -2.2e107 < t < 5e19Initial program 68.3%
lift-+.f64N/A
+-commutativeN/A
remove-double-negN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f64N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6484.1
Applied rewrites84.1%
Taylor expanded in t around 0
lower-/.f6448.4
Applied rewrites48.4%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (/ y t) (- t z)))) (if (<= y -7.4e-85) t_1 (if (<= y 5.2e-64) (/ (* x z) (- t a)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y / t) * (t - z);
double tmp;
if (y <= -7.4e-85) {
tmp = t_1;
} else if (y <= 5.2e-64) {
tmp = (x * z) / (t - a);
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_1 = (y / t) * (t - z)
if (y <= (-7.4d-85)) then
tmp = t_1
else if (y <= 5.2d-64) then
tmp = (x * z) / (t - a)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y / t) * (t - z);
double tmp;
if (y <= -7.4e-85) {
tmp = t_1;
} else if (y <= 5.2e-64) {
tmp = (x * z) / (t - a);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y / t) * (t - z) tmp = 0 if y <= -7.4e-85: tmp = t_1 elif y <= 5.2e-64: tmp = (x * z) / (t - a) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y / t) * Float64(t - z)) tmp = 0.0 if (y <= -7.4e-85) tmp = t_1; elseif (y <= 5.2e-64) tmp = Float64(Float64(x * z) / Float64(t - a)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y / t) * (t - z); tmp = 0.0; if (y <= -7.4e-85) tmp = t_1; elseif (y <= 5.2e-64) tmp = (x * z) / (t - a); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / t), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -7.4e-85], t$95$1, If[LessEqual[y, 5.2e-64], N[(N[(x * z), $MachinePrecision] / N[(t - a), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{t} \cdot \left(t - z\right)\\
\mathbf{if}\;y \leq -7.4 \cdot 10^{-85}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 5.2 \cdot 10^{-64}:\\
\;\;\;\;\frac{x \cdot z}{t - a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -7.39999999999999966e-85 or 5.2e-64 < y Initial program 68.3%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.9
Applied rewrites39.9%
lift-/.f64N/A
mult-flipN/A
metadata-evalN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
frac-2negN/A
lift-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
Applied rewrites46.7%
Taylor expanded in t around inf
lower-/.f6432.4
Applied rewrites32.4%
if -7.39999999999999966e-85 < y < 5.2e-64Initial program 68.3%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
mult-flip-revN/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6480.0
Applied rewrites80.0%
Taylor expanded in z around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6441.6
Applied rewrites41.6%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6421.0
Applied rewrites21.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ y t) (- t z))) (t_2 (+ x (/ (* (- y x) (- z t)) (- a t)))))
(if (<= t_2 (- INFINITY))
t_1
(if (<= t_2 2e+263) (/ (* t y) (- t a)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y / t) * (t - z);
double t_2 = x + (((y - x) * (z - t)) / (a - t));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= 2e+263) {
tmp = (t * y) / (t - a);
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y / t) * (t - z);
double t_2 = x + (((y - x) * (z - t)) / (a - t));
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = t_1;
} else if (t_2 <= 2e+263) {
tmp = (t * y) / (t - a);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y / t) * (t - z) t_2 = x + (((y - x) * (z - t)) / (a - t)) tmp = 0 if t_2 <= -math.inf: tmp = t_1 elif t_2 <= 2e+263: tmp = (t * y) / (t - a) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y / t) * Float64(t - z)) t_2 = Float64(x + Float64(Float64(Float64(y - x) * Float64(z - t)) / Float64(a - t))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= 2e+263) tmp = Float64(Float64(t * y) / Float64(t - a)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y / t) * (t - z); t_2 = x + (((y - x) * (z - t)) / (a - t)); tmp = 0.0; if (t_2 <= -Inf) tmp = t_1; elseif (t_2 <= 2e+263) tmp = (t * y) / (t - a); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / t), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, 2e+263], N[(N[(t * y), $MachinePrecision] / N[(t - a), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{t} \cdot \left(t - z\right)\\
t_2 := x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+263}:\\
\;\;\;\;\frac{t \cdot y}{t - a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < -inf.0 or 2.00000000000000003e263 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) Initial program 68.3%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.9
Applied rewrites39.9%
lift-/.f64N/A
mult-flipN/A
metadata-evalN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
frac-2negN/A
lift-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
Applied rewrites46.7%
Taylor expanded in t around inf
lower-/.f6432.4
Applied rewrites32.4%
if -inf.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < 2.00000000000000003e263Initial program 68.3%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.9
Applied rewrites39.9%
lift-/.f64N/A
mult-flipN/A
metadata-evalN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
frac-2negN/A
lift-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
Applied rewrites46.7%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f6421.4
Applied rewrites21.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* y (- t z)) t)))
(if (<= t -7e+163)
(fma 1.0 (- y x) x)
(if (<= t -4.7e-202) t_1 (if (<= t 1.95e-94) (* (/ z a) y) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y * (t - z)) / t;
double tmp;
if (t <= -7e+163) {
tmp = fma(1.0, (y - x), x);
} else if (t <= -4.7e-202) {
tmp = t_1;
} else if (t <= 1.95e-94) {
tmp = (z / a) * y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(y * Float64(t - z)) / t) tmp = 0.0 if (t <= -7e+163) tmp = fma(1.0, Float64(y - x), x); elseif (t <= -4.7e-202) tmp = t_1; elseif (t <= 1.95e-94) tmp = Float64(Float64(z / a) * y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y * N[(t - z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]}, If[LessEqual[t, -7e+163], N[(1.0 * N[(y - x), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t, -4.7e-202], t$95$1, If[LessEqual[t, 1.95e-94], N[(N[(z / a), $MachinePrecision] * y), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot \left(t - z\right)}{t}\\
\mathbf{if}\;t \leq -7 \cdot 10^{+163}:\\
\;\;\;\;\mathsf{fma}\left(1, y - x, x\right)\\
\mathbf{elif}\;t \leq -4.7 \cdot 10^{-202}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.95 \cdot 10^{-94}:\\
\;\;\;\;\frac{z}{a} \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -7.0000000000000005e163Initial program 68.3%
lift-+.f64N/A
+-commutativeN/A
remove-double-negN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f64N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6484.1
Applied rewrites84.1%
Taylor expanded in t around inf
Applied rewrites20.4%
if -7.0000000000000005e163 < t < -4.6999999999999999e-202 or 1.9500000000000001e-94 < t Initial program 68.3%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.9
Applied rewrites39.9%
lift-/.f64N/A
mult-flipN/A
metadata-evalN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
frac-2negN/A
lift-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
Applied rewrites46.7%
Taylor expanded in a around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f6427.7
Applied rewrites27.7%
if -4.6999999999999999e-202 < t < 1.9500000000000001e-94Initial program 68.3%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.9
Applied rewrites39.9%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6416.7
Applied rewrites16.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6418.9
Applied rewrites18.9%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (/ z a) y))) (if (<= z -1.2e+23) t_1 (if (<= z 9e-33) (/ (* t y) (- t a)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z / a) * y;
double tmp;
if (z <= -1.2e+23) {
tmp = t_1;
} else if (z <= 9e-33) {
tmp = (t * y) / (t - a);
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_1 = (z / a) * y
if (z <= (-1.2d+23)) then
tmp = t_1
else if (z <= 9d-33) then
tmp = (t * y) / (t - a)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (z / a) * y;
double tmp;
if (z <= -1.2e+23) {
tmp = t_1;
} else if (z <= 9e-33) {
tmp = (t * y) / (t - a);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z / a) * y tmp = 0 if z <= -1.2e+23: tmp = t_1 elif z <= 9e-33: tmp = (t * y) / (t - a) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z / a) * y) tmp = 0.0 if (z <= -1.2e+23) tmp = t_1; elseif (z <= 9e-33) tmp = Float64(Float64(t * y) / Float64(t - a)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (z / a) * y; tmp = 0.0; if (z <= -1.2e+23) tmp = t_1; elseif (z <= 9e-33) tmp = (t * y) / (t - a); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z / a), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[z, -1.2e+23], t$95$1, If[LessEqual[z, 9e-33], N[(N[(t * y), $MachinePrecision] / N[(t - a), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z}{a} \cdot y\\
\mathbf{if}\;z \leq -1.2 \cdot 10^{+23}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 9 \cdot 10^{-33}:\\
\;\;\;\;\frac{t \cdot y}{t - a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.2e23 or 8.99999999999999982e-33 < z Initial program 68.3%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.9
Applied rewrites39.9%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6416.7
Applied rewrites16.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6418.9
Applied rewrites18.9%
if -1.2e23 < z < 8.99999999999999982e-33Initial program 68.3%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.9
Applied rewrites39.9%
lift-/.f64N/A
mult-flipN/A
metadata-evalN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
frac-2negN/A
lift-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
Applied rewrites46.7%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f6421.4
Applied rewrites21.4%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma 1.0 (- y x) x))) (if (<= t -6.5e-93) t_1 (if (<= t 7.8e+39) (* (/ z a) y) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(1.0, (y - x), x);
double tmp;
if (t <= -6.5e-93) {
tmp = t_1;
} else if (t <= 7.8e+39) {
tmp = (z / a) * y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(1.0, Float64(y - x), x) tmp = 0.0 if (t <= -6.5e-93) tmp = t_1; elseif (t <= 7.8e+39) tmp = Float64(Float64(z / a) * y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(1.0 * N[(y - x), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t, -6.5e-93], t$95$1, If[LessEqual[t, 7.8e+39], N[(N[(z / a), $MachinePrecision] * y), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(1, y - x, x\right)\\
\mathbf{if}\;t \leq -6.5 \cdot 10^{-93}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 7.8 \cdot 10^{+39}:\\
\;\;\;\;\frac{z}{a} \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -6.5e-93 or 7.8000000000000002e39 < t Initial program 68.3%
lift-+.f64N/A
+-commutativeN/A
remove-double-negN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f64N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6484.1
Applied rewrites84.1%
Taylor expanded in t around inf
Applied rewrites20.4%
if -6.5e-93 < t < 7.8000000000000002e39Initial program 68.3%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.9
Applied rewrites39.9%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6416.7
Applied rewrites16.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6418.9
Applied rewrites18.9%
(FPCore (x y z t a) :precision binary64 (* (/ z a) y))
double code(double x, double y, double z, double t, double a) {
return (z / a) * y;
}
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 = (z / a) * y
end function
public static double code(double x, double y, double z, double t, double a) {
return (z / a) * y;
}
def code(x, y, z, t, a): return (z / a) * y
function code(x, y, z, t, a) return Float64(Float64(z / a) * y) end
function tmp = code(x, y, z, t, a) tmp = (z / a) * y; end
code[x_, y_, z_, t_, a_] := N[(N[(z / a), $MachinePrecision] * y), $MachinePrecision]
\begin{array}{l}
\\
\frac{z}{a} \cdot y
\end{array}
Initial program 68.3%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.9
Applied rewrites39.9%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6416.7
Applied rewrites16.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6418.9
Applied rewrites18.9%
(FPCore (x y z t a) :precision binary64 (* (/ y a) z))
double code(double x, double y, double z, double t, double a) {
return (y / 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 = (y / a) * z
end function
public static double code(double x, double y, double z, double t, double a) {
return (y / a) * z;
}
def code(x, y, z, t, a): return (y / a) * z
function code(x, y, z, t, a) return Float64(Float64(y / a) * z) end
function tmp = code(x, y, z, t, a) tmp = (y / a) * z; end
code[x_, y_, z_, t_, a_] := N[(N[(y / a), $MachinePrecision] * z), $MachinePrecision]
\begin{array}{l}
\\
\frac{y}{a} \cdot z
\end{array}
Initial program 68.3%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.9
Applied rewrites39.9%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6416.7
Applied rewrites16.7%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6417.9
Applied rewrites17.9%
herbie shell --seed 2025149
(FPCore (x y z t a)
:name "Graphics.Rendering.Chart.Axis.Types:linMap from Chart-1.5.3"
:precision binary64
(+ x (/ (* (- y x) (- z t)) (- a t))))