
(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 12 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 (- y x) (/ (- a z) t) y)))
(if (<= t -1e+160)
t_1
(if (<= t 3.75e+73) (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 = fma((y - x), ((a - z) / t), y);
double tmp;
if (t <= -1e+160) {
tmp = t_1;
} else if (t <= 3.75e+73) {
tmp = fma(((t - z) / (t - a)), (y - x), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y - x), Float64(Float64(a - z) / t), y) tmp = 0.0 if (t <= -1e+160) tmp = t_1; elseif (t <= 3.75e+73) 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[(y - x), $MachinePrecision] * N[(N[(a - z), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision]}, If[LessEqual[t, -1e+160], t$95$1, If[LessEqual[t, 3.75e+73], 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 := \mathsf{fma}\left(y - x, \frac{a - z}{t}, y\right)\\
\mathbf{if}\;t \leq -1 \cdot 10^{+160}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 3.75 \cdot 10^{+73}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - z}{t - a}, y - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.00000000000000001e160 or 3.75e73 < t Initial program 67.7%
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.0
Applied rewrites46.0%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
lift--.f64N/A
sub-negate-revN/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-out--N/A
associate-/l*N/A
remove-double-negN/A
lower-fma.f64N/A
Applied rewrites53.2%
if -1.00000000000000001e160 < t < 3.75e73Initial program 67.7%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/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--.f6483.5
Applied rewrites83.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- y x) (/ (- a z) t) y)))
(if (<= t -6.5e+73)
t_1
(if (<= t 3.75e+73) (- x (/ (* (- y x) z) (- t a))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y - x), ((a - z) / t), y);
double tmp;
if (t <= -6.5e+73) {
tmp = t_1;
} else if (t <= 3.75e+73) {
tmp = x - (((y - x) * z) / (t - a));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y - x), Float64(Float64(a - z) / t), y) tmp = 0.0 if (t <= -6.5e+73) tmp = t_1; elseif (t <= 3.75e+73) tmp = Float64(x - Float64(Float64(Float64(y - x) * z) / Float64(t - a))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - x), $MachinePrecision] * N[(N[(a - z), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision]}, If[LessEqual[t, -6.5e+73], t$95$1, If[LessEqual[t, 3.75e+73], N[(x - N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y - x, \frac{a - z}{t}, y\right)\\
\mathbf{if}\;t \leq -6.5 \cdot 10^{+73}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 3.75 \cdot 10^{+73}:\\
\;\;\;\;x - \frac{\left(y - x\right) \cdot z}{t - a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -6.5000000000000001e73 or 3.75e73 < t Initial program 67.7%
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.0
Applied rewrites46.0%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
lift--.f64N/A
sub-negate-revN/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-out--N/A
associate-/l*N/A
remove-double-negN/A
lower-fma.f64N/A
Applied rewrites53.2%
if -6.5000000000000001e73 < t < 3.75e73Initial program 67.7%
Taylor expanded in z around inf
lower-*.f64N/A
lower--.f6454.0
Applied rewrites54.0%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-/.f64N/A
distribute-neg-frac2N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
Applied rewrites54.0%
(FPCore (x y z t a)
:precision binary64
(if (<= a -2.85e-19)
(fma (/ t (- t a)) (- y x) x)
(if (<= a -1.18e-82)
(* (/ z (- t a)) (- x y))
(if (<= a 6000000.0)
(fma (- y x) (/ (- a z) t) y)
(fma (/ z a) (- y x) x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2.85e-19) {
tmp = fma((t / (t - a)), (y - x), x);
} else if (a <= -1.18e-82) {
tmp = (z / (t - a)) * (x - y);
} else if (a <= 6000000.0) {
tmp = fma((y - x), ((a - z) / t), y);
} else {
tmp = fma((z / a), (y - x), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -2.85e-19) tmp = fma(Float64(t / Float64(t - a)), Float64(y - x), x); elseif (a <= -1.18e-82) tmp = Float64(Float64(z / Float64(t - a)) * Float64(x - y)); elseif (a <= 6000000.0) tmp = fma(Float64(y - x), Float64(Float64(a - z) / t), y); else tmp = fma(Float64(z / a), Float64(y - x), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -2.85e-19], N[(N[(t / N[(t - a), $MachinePrecision]), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[a, -1.18e-82], N[(N[(z / N[(t - a), $MachinePrecision]), $MachinePrecision] * N[(x - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 6000000.0], N[(N[(y - x), $MachinePrecision] * N[(N[(a - z), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision], N[(N[(z / a), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.85 \cdot 10^{-19}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{t - a}, y - x, x\right)\\
\mathbf{elif}\;a \leq -1.18 \cdot 10^{-82}:\\
\;\;\;\;\frac{z}{t - a} \cdot \left(x - y\right)\\
\mathbf{elif}\;a \leq 6000000:\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{a - z}{t}, y\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y - x, x\right)\\
\end{array}
\end{array}
if a < -2.84999999999999976e-19Initial program 67.7%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/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--.f6483.5
Applied rewrites83.5%
Taylor expanded in z around 0
Applied rewrites46.6%
if -2.84999999999999976e-19 < a < -1.1799999999999999e-82Initial program 67.7%
Taylor expanded in z around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6441.7
Applied rewrites41.7%
lift-*.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-subN/A
associate-*r/N/A
sqr-neg-revN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
times-fracN/A
frac-2neg-revN/A
Applied rewrites43.2%
if -1.1799999999999999e-82 < a < 6e6Initial program 67.7%
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.0
Applied rewrites46.0%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
lift--.f64N/A
sub-negate-revN/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-out--N/A
associate-/l*N/A
remove-double-negN/A
lower-fma.f64N/A
Applied rewrites53.2%
if 6e6 < a Initial program 67.7%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/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--.f6483.5
Applied rewrites83.5%
Taylor expanded in t around 0
lower-/.f6448.6
Applied rewrites48.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ z a) (- y x) x)))
(if (<= a -1.18e-82)
t_1
(if (<= a 6000000.0) (fma (- y x) (/ (- a z) 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.18e-82) {
tmp = t_1;
} else if (a <= 6000000.0) {
tmp = fma((y - x), ((a - z) / 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.18e-82) tmp = t_1; elseif (a <= 6000000.0) tmp = fma(Float64(y - x), Float64(Float64(a - z) / 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.18e-82], t$95$1, If[LessEqual[a, 6000000.0], N[(N[(y - x), $MachinePrecision] * N[(N[(a - z), $MachinePrecision] / t), $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.18 \cdot 10^{-82}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 6000000:\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{a - z}{t}, y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.1799999999999999e-82 or 6e6 < a Initial program 67.7%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/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--.f6483.5
Applied rewrites83.5%
Taylor expanded in t around 0
lower-/.f6448.6
Applied rewrites48.6%
if -1.1799999999999999e-82 < a < 6e6Initial program 67.7%
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.0
Applied rewrites46.0%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
lift--.f64N/A
sub-negate-revN/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-out--N/A
associate-/l*N/A
remove-double-negN/A
lower-fma.f64N/A
Applied rewrites53.2%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (/ (- z t) (- a t)) y))) (if (<= t -3.3e+19) t_1 (if (<= t 3.75e+73) (fma (/ z 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 <= -3.3e+19) {
tmp = t_1;
} else if (t <= 3.75e+73) {
tmp = fma((z / 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 <= -3.3e+19) tmp = t_1; elseif (t <= 3.75e+73) 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[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[t, -3.3e+19], t$95$1, If[LessEqual[t, 3.75e+73], N[(N[(z / a), $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 -3.3 \cdot 10^{+19}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 3.75 \cdot 10^{+73}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -3.3e19 or 3.75e73 < t Initial program 67.7%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.8
Applied rewrites39.8%
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.1
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.1
Applied rewrites52.1%
if -3.3e19 < t < 3.75e73Initial program 67.7%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/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--.f6483.5
Applied rewrites83.5%
Taylor expanded in t around 0
lower-/.f6448.6
Applied rewrites48.6%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma y (/ (- a z) t) y))) (if (<= t -3.9e+76) t_1 (if (<= t 1.15e+83) (fma (/ z a) (- y x) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(y, ((a - z) / t), y);
double tmp;
if (t <= -3.9e+76) {
tmp = t_1;
} else if (t <= 1.15e+83) {
tmp = fma((z / a), (y - x), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(y, Float64(Float64(a - z) / t), y) tmp = 0.0 if (t <= -3.9e+76) tmp = t_1; elseif (t <= 1.15e+83) 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[(y * N[(N[(a - z), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision]}, If[LessEqual[t, -3.9e+76], t$95$1, If[LessEqual[t, 1.15e+83], N[(N[(z / a), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, \frac{a - z}{t}, y\right)\\
\mathbf{if}\;t \leq -3.9 \cdot 10^{+76}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.15 \cdot 10^{+83}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -3.89999999999999989e76 or 1.14999999999999997e83 < t Initial program 67.7%
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.0
Applied rewrites46.0%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
lift--.f64N/A
sub-negate-revN/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-out--N/A
associate-/l*N/A
remove-double-negN/A
lower-fma.f64N/A
Applied rewrites53.2%
Taylor expanded in x around 0
Applied rewrites36.2%
if -3.89999999999999989e76 < t < 1.14999999999999997e83Initial program 67.7%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/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--.f6483.5
Applied rewrites83.5%
Taylor expanded in t around 0
lower-/.f6448.6
Applied rewrites48.6%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma y (/ (- a z) t) y))) (if (<= t -3.9e+76) t_1 (if (<= t 1.15e+83) (fma (/ z a) y x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(y, ((a - z) / t), y);
double tmp;
if (t <= -3.9e+76) {
tmp = t_1;
} else if (t <= 1.15e+83) {
tmp = fma((z / a), y, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(y, Float64(Float64(a - z) / t), y) tmp = 0.0 if (t <= -3.9e+76) tmp = t_1; elseif (t <= 1.15e+83) tmp = fma(Float64(z / a), y, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(N[(a - z), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision]}, If[LessEqual[t, -3.9e+76], t$95$1, If[LessEqual[t, 1.15e+83], N[(N[(z / a), $MachinePrecision] * y + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, \frac{a - z}{t}, y\right)\\
\mathbf{if}\;t \leq -3.9 \cdot 10^{+76}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.15 \cdot 10^{+83}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -3.89999999999999989e76 or 1.14999999999999997e83 < t Initial program 67.7%
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.0
Applied rewrites46.0%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
lift--.f64N/A
sub-negate-revN/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-out--N/A
associate-/l*N/A
remove-double-negN/A
lower-fma.f64N/A
Applied rewrites53.2%
Taylor expanded in x around 0
Applied rewrites36.2%
if -3.89999999999999989e76 < t < 1.14999999999999997e83Initial program 67.7%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/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--.f6483.5
Applied rewrites83.5%
Taylor expanded in t around 0
lower-/.f6448.6
Applied rewrites48.6%
Taylor expanded in x around 0
Applied rewrites41.3%
(FPCore (x y z t a) :precision binary64 (if (<= t -9.5e+120) (* 1.0 y) (if (<= t 1.16e+83) (fma (/ z a) y x) (* 1.0 y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -9.5e+120) {
tmp = 1.0 * y;
} else if (t <= 1.16e+83) {
tmp = fma((z / a), y, x);
} else {
tmp = 1.0 * y;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -9.5e+120) tmp = Float64(1.0 * y); elseif (t <= 1.16e+83) tmp = fma(Float64(z / a), y, x); else tmp = Float64(1.0 * y); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -9.5e+120], N[(1.0 * y), $MachinePrecision], If[LessEqual[t, 1.16e+83], N[(N[(z / a), $MachinePrecision] * y + x), $MachinePrecision], N[(1.0 * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9.5 \cdot 10^{+120}:\\
\;\;\;\;1 \cdot y\\
\mathbf{elif}\;t \leq 1.16 \cdot 10^{+83}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;1 \cdot y\\
\end{array}
\end{array}
if t < -9.5e120 or 1.1600000000000001e83 < t Initial program 67.7%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.8
Applied rewrites39.8%
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.1
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.1
Applied rewrites52.1%
Taylor expanded in t around inf
Applied rewrites25.4%
if -9.5e120 < t < 1.1600000000000001e83Initial program 67.7%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/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--.f6483.5
Applied rewrites83.5%
Taylor expanded in t around 0
lower-/.f6448.6
Applied rewrites48.6%
Taylor expanded in x around 0
Applied rewrites41.3%
(FPCore (x y z t a) :precision binary64 (if (<= t -3.1e+17) (* 1.0 y) (if (<= t 1.25e+17) (* (/ z a) y) (* 1.0 y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -3.1e+17) {
tmp = 1.0 * y;
} else if (t <= 1.25e+17) {
tmp = (z / a) * y;
} else {
tmp = 1.0 * y;
}
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 <= (-3.1d+17)) then
tmp = 1.0d0 * y
else if (t <= 1.25d+17) then
tmp = (z / a) * y
else
tmp = 1.0d0 * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -3.1e+17) {
tmp = 1.0 * y;
} else if (t <= 1.25e+17) {
tmp = (z / a) * y;
} else {
tmp = 1.0 * y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -3.1e+17: tmp = 1.0 * y elif t <= 1.25e+17: tmp = (z / a) * y else: tmp = 1.0 * y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -3.1e+17) tmp = Float64(1.0 * y); elseif (t <= 1.25e+17) tmp = Float64(Float64(z / a) * y); else tmp = Float64(1.0 * y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -3.1e+17) tmp = 1.0 * y; elseif (t <= 1.25e+17) tmp = (z / a) * y; else tmp = 1.0 * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -3.1e+17], N[(1.0 * y), $MachinePrecision], If[LessEqual[t, 1.25e+17], N[(N[(z / a), $MachinePrecision] * y), $MachinePrecision], N[(1.0 * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.1 \cdot 10^{+17}:\\
\;\;\;\;1 \cdot y\\
\mathbf{elif}\;t \leq 1.25 \cdot 10^{+17}:\\
\;\;\;\;\frac{z}{a} \cdot y\\
\mathbf{else}:\\
\;\;\;\;1 \cdot y\\
\end{array}
\end{array}
if t < -3.1e17 or 1.25e17 < t Initial program 67.7%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.8
Applied rewrites39.8%
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.1
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.1
Applied rewrites52.1%
Taylor expanded in t around inf
Applied rewrites25.4%
if -3.1e17 < t < 1.25e17Initial program 67.7%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.8
Applied rewrites39.8%
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.1
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.1
Applied rewrites52.1%
Taylor expanded in t around 0
lower-/.f6419.5
Applied rewrites19.5%
(FPCore (x y z t a) :precision binary64 (if (<= t -2.2e+17) (* 1.0 y) (if (<= t 1.25e+17) (* z (/ y a)) (* 1.0 y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.2e+17) {
tmp = 1.0 * y;
} else if (t <= 1.25e+17) {
tmp = z * (y / a);
} else {
tmp = 1.0 * y;
}
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+17)) then
tmp = 1.0d0 * y
else if (t <= 1.25d+17) then
tmp = z * (y / a)
else
tmp = 1.0d0 * y
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+17) {
tmp = 1.0 * y;
} else if (t <= 1.25e+17) {
tmp = z * (y / a);
} else {
tmp = 1.0 * y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -2.2e+17: tmp = 1.0 * y elif t <= 1.25e+17: tmp = z * (y / a) else: tmp = 1.0 * y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -2.2e+17) tmp = Float64(1.0 * y); elseif (t <= 1.25e+17) tmp = Float64(z * Float64(y / a)); else tmp = Float64(1.0 * y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -2.2e+17) tmp = 1.0 * y; elseif (t <= 1.25e+17) tmp = z * (y / a); else tmp = 1.0 * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -2.2e+17], N[(1.0 * y), $MachinePrecision], If[LessEqual[t, 1.25e+17], N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision], N[(1.0 * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.2 \cdot 10^{+17}:\\
\;\;\;\;1 \cdot y\\
\mathbf{elif}\;t \leq 1.25 \cdot 10^{+17}:\\
\;\;\;\;z \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;1 \cdot y\\
\end{array}
\end{array}
if t < -2.2e17 or 1.25e17 < t Initial program 67.7%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.8
Applied rewrites39.8%
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.1
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.1
Applied rewrites52.1%
Taylor expanded in t around inf
Applied rewrites25.4%
if -2.2e17 < t < 1.25e17Initial program 67.7%
Taylor expanded in z around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6441.7
Applied rewrites41.7%
Taylor expanded in x around 0
lower-/.f64N/A
lower--.f6423.7
Applied rewrites23.7%
Taylor expanded in t around 0
Applied rewrites18.5%
(FPCore (x y z t a) :precision binary64 (if (<= t -3.1e+17) (* 1.0 y) (if (<= t 4e+69) (/ (* y z) a) (* 1.0 y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -3.1e+17) {
tmp = 1.0 * y;
} else if (t <= 4e+69) {
tmp = (y * z) / a;
} else {
tmp = 1.0 * y;
}
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 <= (-3.1d+17)) then
tmp = 1.0d0 * y
else if (t <= 4d+69) then
tmp = (y * z) / a
else
tmp = 1.0d0 * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -3.1e+17) {
tmp = 1.0 * y;
} else if (t <= 4e+69) {
tmp = (y * z) / a;
} else {
tmp = 1.0 * y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -3.1e+17: tmp = 1.0 * y elif t <= 4e+69: tmp = (y * z) / a else: tmp = 1.0 * y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -3.1e+17) tmp = Float64(1.0 * y); elseif (t <= 4e+69) tmp = Float64(Float64(y * z) / a); else tmp = Float64(1.0 * y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -3.1e+17) tmp = 1.0 * y; elseif (t <= 4e+69) tmp = (y * z) / a; else tmp = 1.0 * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -3.1e+17], N[(1.0 * y), $MachinePrecision], If[LessEqual[t, 4e+69], N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision], N[(1.0 * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.1 \cdot 10^{+17}:\\
\;\;\;\;1 \cdot y\\
\mathbf{elif}\;t \leq 4 \cdot 10^{+69}:\\
\;\;\;\;\frac{y \cdot z}{a}\\
\mathbf{else}:\\
\;\;\;\;1 \cdot y\\
\end{array}
\end{array}
if t < -3.1e17 or 4.0000000000000003e69 < t Initial program 67.7%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.8
Applied rewrites39.8%
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.1
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.1
Applied rewrites52.1%
Taylor expanded in t around inf
Applied rewrites25.4%
if -3.1e17 < t < 4.0000000000000003e69Initial program 67.7%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.8
Applied rewrites39.8%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6416.7
Applied rewrites16.7%
(FPCore (x y z t a) :precision binary64 (* 1.0 y))
double code(double x, double y, double z, double t, double a) {
return 1.0 * 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 = 1.0d0 * y
end function
public static double code(double x, double y, double z, double t, double a) {
return 1.0 * y;
}
def code(x, y, z, t, a): return 1.0 * y
function code(x, y, z, t, a) return Float64(1.0 * y) end
function tmp = code(x, y, z, t, a) tmp = 1.0 * y; end
code[x_, y_, z_, t_, a_] := N[(1.0 * y), $MachinePrecision]
\begin{array}{l}
\\
1 \cdot y
\end{array}
Initial program 67.7%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.8
Applied rewrites39.8%
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.1
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.1
Applied rewrites52.1%
Taylor expanded in t around inf
Applied rewrites25.4%
herbie shell --seed 2025154
(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))))