
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y z) (- t x)) (- a z))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * (t - x)) / (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 - x)) / (a - z))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * (t - x)) / (a - z));
}
def code(x, y, z, t, a): return x + (((y - z) * (t - x)) / (a - z))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - z) * Float64(t - x)) / Float64(a - z))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - z) * (t - x)) / (a - z)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\end{array}
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y z) (- t x)) (- a z))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * (t - x)) / (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 - x)) / (a - z))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * (t - x)) / (a - z));
}
def code(x, y, z, t, a): return x + (((y - z) * (t - x)) / (a - z))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - z) * Float64(t - x)) / Float64(a - z))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - z) * (t - x)) / (a - z)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\end{array}
(FPCore (x y z t a)
:precision binary64
(if (<= a -4e-11)
(+ x (/ (- x t) (/ (- a z) (- z y))))
(if (<= a 9e-32)
(+ t (* -1.0 (/ (- (* y (- t x)) (* a (- t x))) z)))
(fma (/ (- x t) (- z a)) (- y z) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -4e-11) {
tmp = x + ((x - t) / ((a - z) / (z - y)));
} else if (a <= 9e-32) {
tmp = t + (-1.0 * (((y * (t - x)) - (a * (t - x))) / z));
} else {
tmp = fma(((x - t) / (z - a)), (y - z), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -4e-11) tmp = Float64(x + Float64(Float64(x - t) / Float64(Float64(a - z) / Float64(z - y)))); elseif (a <= 9e-32) tmp = Float64(t + Float64(-1.0 * Float64(Float64(Float64(y * Float64(t - x)) - Float64(a * Float64(t - x))) / z))); else tmp = fma(Float64(Float64(x - t) / Float64(z - a)), Float64(y - z), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -4e-11], N[(x + N[(N[(x - t), $MachinePrecision] / N[(N[(a - z), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 9e-32], N[(t + N[(-1.0 * N[(N[(N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision] - N[(a * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -4 \cdot 10^{-11}:\\
\;\;\;\;x + \frac{x - t}{\frac{a - z}{z - y}}\\
\mathbf{elif}\;a \leq 9 \cdot 10^{-32}:\\
\;\;\;\;t + -1 \cdot \frac{y \cdot \left(t - x\right) - a \cdot \left(t - x\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - t}{z - a}, y - z, x\right)\\
\end{array}
\end{array}
if a < -3.99999999999999976e-11Initial program 68.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.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--.f6479.1
Applied rewrites79.1%
lift-*.f64N/A
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
associate-*l/N/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
lift-/.f64N/A
div-flipN/A
mult-flip-revN/A
Applied rewrites83.4%
if -3.99999999999999976e-11 < a < 9.00000000000000009e-32Initial program 68.3%
Taylor expanded in z 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.3
Applied rewrites46.3%
if 9.00000000000000009e-32 < a Initial program 68.3%
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--.f6479.2
Applied rewrites79.2%
(FPCore (x y z t a) :precision binary64 (if (<= z -4e+166) (* t (- (/ y (- a z)) (/ z (- a z)))) (+ x (/ (- x t) (/ (- a z) (- z y))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4e+166) {
tmp = t * ((y / (a - z)) - (z / (a - z)));
} else {
tmp = x + ((x - t) / ((a - z) / (z - 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 (z <= (-4d+166)) then
tmp = t * ((y / (a - z)) - (z / (a - z)))
else
tmp = x + ((x - t) / ((a - z) / (z - y)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4e+166) {
tmp = t * ((y / (a - z)) - (z / (a - z)));
} else {
tmp = x + ((x - t) / ((a - z) / (z - y)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -4e+166: tmp = t * ((y / (a - z)) - (z / (a - z))) else: tmp = x + ((x - t) / ((a - z) / (z - y))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -4e+166) tmp = Float64(t * Float64(Float64(y / Float64(a - z)) - Float64(z / Float64(a - z)))); else tmp = Float64(x + Float64(Float64(x - t) / Float64(Float64(a - z) / Float64(z - y)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -4e+166) tmp = t * ((y / (a - z)) - (z / (a - z))); else tmp = x + ((x - t) / ((a - z) / (z - y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4e+166], N[(t * N[(N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision] - N[(z / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(x - t), $MachinePrecision] / N[(N[(a - z), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4 \cdot 10^{+166}:\\
\;\;\;\;t \cdot \left(\frac{y}{a - z} - \frac{z}{a - z}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{x - t}{\frac{a - z}{z - y}}\\
\end{array}
\end{array}
if z < -3.99999999999999976e166Initial 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--.f6451.4
Applied rewrites51.4%
if -3.99999999999999976e166 < z Initial program 68.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.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--.f6479.1
Applied rewrites79.1%
lift-*.f64N/A
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
associate-*l/N/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
lift-/.f64N/A
div-flipN/A
mult-flip-revN/A
Applied rewrites83.4%
(FPCore (x y z t a) :precision binary64 (+ x (/ (- x t) (/ (- a z) (- z y)))))
double code(double x, double y, double z, double t, double a) {
return x + ((x - t) / ((a - z) / (z - 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 = x + ((x - t) / ((a - z) / (z - y)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((x - t) / ((a - z) / (z - y)));
}
def code(x, y, z, t, a): return x + ((x - t) / ((a - z) / (z - y)))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(x - t) / Float64(Float64(a - z) / Float64(z - y)))) end
function tmp = code(x, y, z, t, a) tmp = x + ((x - t) / ((a - z) / (z - y))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(x - t), $MachinePrecision] / N[(N[(a - z), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{x - t}{\frac{a - z}{z - y}}
\end{array}
Initial program 68.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.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--.f6479.1
Applied rewrites79.1%
lift-*.f64N/A
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
associate-*l/N/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
lift-/.f64N/A
div-flipN/A
mult-flip-revN/A
Applied rewrites83.4%
(FPCore (x y z t a) :precision binary64 (fma (- t x) (/ (- z y) (- z a)) x))
double code(double x, double y, double z, double t, double a) {
return fma((t - x), ((z - y) / (z - a)), x);
}
function code(x, y, z, t, a) return fma(Float64(t - x), Float64(Float64(z - y) / Float64(z - a)), x) end
code[x_, y_, z_, t_, a_] := N[(N[(t - x), $MachinePrecision] * N[(N[(z - y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(t - x, \frac{z - y}{z - a}, x\right)
\end{array}
Initial program 68.3%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/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.3
Applied rewrites83.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ t (- a z)) (- y z) x)))
(if (<= t -4.5e-60)
t_1
(if (<= t 6.6e-140) (fma (/ x (- z a)) (- y z) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((t / (a - z)), (y - z), x);
double tmp;
if (t <= -4.5e-60) {
tmp = t_1;
} else if (t <= 6.6e-140) {
tmp = fma((x / (z - a)), (y - z), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(t / Float64(a - z)), Float64(y - z), x) tmp = 0.0 if (t <= -4.5e-60) tmp = t_1; elseif (t <= 6.6e-140) tmp = fma(Float64(x / Float64(z - a)), Float64(y - z), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t, -4.5e-60], t$95$1, If[LessEqual[t, 6.6e-140], N[(N[(x / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{t}{a - z}, y - z, x\right)\\
\mathbf{if}\;t \leq -4.5 \cdot 10^{-60}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 6.6 \cdot 10^{-140}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{z - a}, y - z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -4.50000000000000001e-60 or 6.59999999999999975e-140 < t Initial program 68.3%
Taylor expanded in x around 0
Applied rewrites55.7%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6463.4
Applied rewrites63.4%
if -4.50000000000000001e-60 < t < 6.59999999999999975e-140Initial program 68.3%
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--.f6479.2
Applied rewrites79.2%
Taylor expanded in x around inf
lower-/.f64N/A
lower--.f6441.1
Applied rewrites41.1%
(FPCore (x y z t a)
:precision binary64
(if (<= a -9200000000.0)
(fma (- t x) (/ z (- z a)) x)
(if (<= a -8.6e-96)
(fma (- t x) (- 1.0 (/ y z)) x)
(if (<= a 7.6e-16) (/ (* t (- y z)) (- a z)) (fma (- t x) (/ y a) x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -9200000000.0) {
tmp = fma((t - x), (z / (z - a)), x);
} else if (a <= -8.6e-96) {
tmp = fma((t - x), (1.0 - (y / z)), x);
} else if (a <= 7.6e-16) {
tmp = (t * (y - z)) / (a - z);
} else {
tmp = fma((t - x), (y / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -9200000000.0) tmp = fma(Float64(t - x), Float64(z / Float64(z - a)), x); elseif (a <= -8.6e-96) tmp = fma(Float64(t - x), Float64(1.0 - Float64(y / z)), x); elseif (a <= 7.6e-16) tmp = Float64(Float64(t * Float64(y - z)) / Float64(a - z)); else tmp = fma(Float64(t - x), Float64(y / a), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -9200000000.0], N[(N[(t - x), $MachinePrecision] * N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[a, -8.6e-96], N[(N[(t - x), $MachinePrecision] * N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[a, 7.6e-16], N[(N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision], N[(N[(t - x), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -9200000000:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{z}{z - a}, x\right)\\
\mathbf{elif}\;a \leq -8.6 \cdot 10^{-96}:\\
\;\;\;\;\mathsf{fma}\left(t - x, 1 - \frac{y}{z}, x\right)\\
\mathbf{elif}\;a \leq 7.6 \cdot 10^{-16}:\\
\;\;\;\;\frac{t \cdot \left(y - z\right)}{a - z}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y}{a}, x\right)\\
\end{array}
\end{array}
if a < -9.2e9Initial program 68.3%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/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.3
Applied rewrites83.3%
Taylor expanded in y around 0
Applied rewrites46.1%
if -9.2e9 < a < -8.59999999999999961e-96Initial program 68.3%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/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.3
Applied rewrites83.3%
Taylor expanded in a around 0
lower-/.f64N/A
lower--.f6438.0
Applied rewrites38.0%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
sub-flipN/A
*-inversesN/A
sub-flipN/A
lower--.f64N/A
lower-/.f6438.0
Applied rewrites38.0%
if -8.59999999999999961e-96 < a < 7.60000000000000024e-16Initial program 68.3%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.3
Applied rewrites39.3%
if 7.60000000000000024e-16 < a Initial program 68.3%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/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.3
Applied rewrites83.3%
Taylor expanded in z around 0
lower-/.f6448.8
Applied rewrites48.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- t x) (/ y a) x)))
(if (<= a -2500000000.0)
t_1
(if (<= a -8.6e-96)
(fma (- t x) (- 1.0 (/ y z)) x)
(if (<= a 7.6e-16) (/ (* t (- y z)) (- a z)) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((t - x), (y / a), x);
double tmp;
if (a <= -2500000000.0) {
tmp = t_1;
} else if (a <= -8.6e-96) {
tmp = fma((t - x), (1.0 - (y / z)), x);
} else if (a <= 7.6e-16) {
tmp = (t * (y - z)) / (a - z);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(t - x), Float64(y / a), x) tmp = 0.0 if (a <= -2500000000.0) tmp = t_1; elseif (a <= -8.6e-96) tmp = fma(Float64(t - x), Float64(1.0 - Float64(y / z)), x); elseif (a <= 7.6e-16) tmp = Float64(Float64(t * Float64(y - z)) / Float64(a - z)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -2500000000.0], t$95$1, If[LessEqual[a, -8.6e-96], N[(N[(t - x), $MachinePrecision] * N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[a, 7.6e-16], N[(N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(t - x, \frac{y}{a}, x\right)\\
\mathbf{if}\;a \leq -2500000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq -8.6 \cdot 10^{-96}:\\
\;\;\;\;\mathsf{fma}\left(t - x, 1 - \frac{y}{z}, x\right)\\
\mathbf{elif}\;a \leq 7.6 \cdot 10^{-16}:\\
\;\;\;\;\frac{t \cdot \left(y - z\right)}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -2.5e9 or 7.60000000000000024e-16 < a Initial program 68.3%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/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.3
Applied rewrites83.3%
Taylor expanded in z around 0
lower-/.f6448.8
Applied rewrites48.8%
if -2.5e9 < a < -8.59999999999999961e-96Initial program 68.3%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/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.3
Applied rewrites83.3%
Taylor expanded in a around 0
lower-/.f64N/A
lower--.f6438.0
Applied rewrites38.0%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
sub-flipN/A
*-inversesN/A
sub-flipN/A
lower--.f64N/A
lower-/.f6438.0
Applied rewrites38.0%
if -8.59999999999999961e-96 < a < 7.60000000000000024e-16Initial program 68.3%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.3
Applied rewrites39.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- t x) (/ y a) x)))
(if (<= a -3000000000.0)
t_1
(if (<= a 7.6e-16) (/ (* t (- y z)) (- a z)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((t - x), (y / a), x);
double tmp;
if (a <= -3000000000.0) {
tmp = t_1;
} else if (a <= 7.6e-16) {
tmp = (t * (y - z)) / (a - z);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(t - x), Float64(y / a), x) tmp = 0.0 if (a <= -3000000000.0) tmp = t_1; elseif (a <= 7.6e-16) tmp = Float64(Float64(t * Float64(y - z)) / Float64(a - z)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -3000000000.0], t$95$1, If[LessEqual[a, 7.6e-16], N[(N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(t - x, \frac{y}{a}, x\right)\\
\mathbf{if}\;a \leq -3000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 7.6 \cdot 10^{-16}:\\
\;\;\;\;\frac{t \cdot \left(y - z\right)}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -3e9 or 7.60000000000000024e-16 < a Initial program 68.3%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/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.3
Applied rewrites83.3%
Taylor expanded in z around 0
lower-/.f6448.8
Applied rewrites48.8%
if -3e9 < a < 7.60000000000000024e-16Initial program 68.3%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.3
Applied rewrites39.3%
(FPCore (x y z t a) :precision binary64 (if (<= z -5.8e+36) (+ x t) (if (<= z 2.3e+33) (fma (- t x) (/ y a) x) (+ x t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5.8e+36) {
tmp = x + t;
} else if (z <= 2.3e+33) {
tmp = fma((t - x), (y / a), x);
} else {
tmp = x + t;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -5.8e+36) tmp = Float64(x + t); elseif (z <= 2.3e+33) tmp = fma(Float64(t - x), Float64(y / a), x); else tmp = Float64(x + t); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5.8e+36], N[(x + t), $MachinePrecision], If[LessEqual[z, 2.3e+33], N[(N[(t - x), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision], N[(x + t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{+36}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;z \leq 2.3 \cdot 10^{+33}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + t\\
\end{array}
\end{array}
if z < -5.8e36 or 2.30000000000000011e33 < z Initial program 68.3%
Taylor expanded in z around inf
lower--.f6419.1
Applied rewrites19.1%
Taylor expanded in x around inf
lower-*.f642.8
Applied rewrites2.8%
Taylor expanded in x around 0
Applied rewrites33.9%
if -5.8e36 < z < 2.30000000000000011e33Initial program 68.3%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/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.3
Applied rewrites83.3%
Taylor expanded in z around 0
lower-/.f6448.8
Applied rewrites48.8%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.15e+55)
(+ x t)
(if (<= z -1.9e+14)
(* (/ y (- z a)) x)
(if (<= z 1.82e+21) (fma t (/ (- y z) a) x) (+ x t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.15e+55) {
tmp = x + t;
} else if (z <= -1.9e+14) {
tmp = (y / (z - a)) * x;
} else if (z <= 1.82e+21) {
tmp = fma(t, ((y - z) / a), x);
} else {
tmp = x + t;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.15e+55) tmp = Float64(x + t); elseif (z <= -1.9e+14) tmp = Float64(Float64(y / Float64(z - a)) * x); elseif (z <= 1.82e+21) tmp = fma(t, Float64(Float64(y - z) / a), x); else tmp = Float64(x + t); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.15e+55], N[(x + t), $MachinePrecision], If[LessEqual[z, -1.9e+14], N[(N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, 1.82e+21], N[(t * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], N[(x + t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \cdot 10^{+55}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;z \leq -1.9 \cdot 10^{+14}:\\
\;\;\;\;\frac{y}{z - a} \cdot x\\
\mathbf{elif}\;z \leq 1.82 \cdot 10^{+21}:\\
\;\;\;\;\mathsf{fma}\left(t, \frac{y - z}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + t\\
\end{array}
\end{array}
if z < -1.14999999999999994e55 or 1.82e21 < z Initial program 68.3%
Taylor expanded in z around inf
lower--.f6419.1
Applied rewrites19.1%
Taylor expanded in x around inf
lower-*.f642.8
Applied rewrites2.8%
Taylor expanded in x around 0
Applied rewrites33.9%
if -1.14999999999999994e55 < z < -1.9e14Initial program 68.3%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/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.3
Applied rewrites83.3%
lift-fma.f64N/A
+-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
lift-*.f64N/A
div-flip-revN/A
lift-/.f64N/A
lift-/.f64N/A
sum-to-multN/A
lower-*.f64N/A
Applied rewrites62.9%
Taylor expanded in y around -inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f6431.6
Applied rewrites31.6%
Taylor expanded in x around inf
lower-/.f64N/A
lower--.f6424.5
Applied rewrites24.5%
if -1.9e14 < z < 1.82e21Initial program 68.3%
Taylor expanded in x around 0
Applied rewrites55.7%
Taylor expanded in z around 0
Applied rewrites41.2%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6445.3
Applied rewrites45.3%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (/ y (- z a)) x))) (if (<= y -1.1e+63) t_1 (if (<= y 3.25e+136) (+ x t) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y / (z - a)) * x;
double tmp;
if (y <= -1.1e+63) {
tmp = t_1;
} else if (y <= 3.25e+136) {
tmp = x + t;
} 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 / (z - a)) * x
if (y <= (-1.1d+63)) then
tmp = t_1
else if (y <= 3.25d+136) then
tmp = x + t
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 / (z - a)) * x;
double tmp;
if (y <= -1.1e+63) {
tmp = t_1;
} else if (y <= 3.25e+136) {
tmp = x + t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y / (z - a)) * x tmp = 0 if y <= -1.1e+63: tmp = t_1 elif y <= 3.25e+136: tmp = x + t else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y / Float64(z - a)) * x) tmp = 0.0 if (y <= -1.1e+63) tmp = t_1; elseif (y <= 3.25e+136) tmp = Float64(x + t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y / (z - a)) * x; tmp = 0.0; if (y <= -1.1e+63) tmp = t_1; elseif (y <= 3.25e+136) tmp = x + t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[y, -1.1e+63], t$95$1, If[LessEqual[y, 3.25e+136], N[(x + t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{z - a} \cdot x\\
\mathbf{if}\;y \leq -1.1 \cdot 10^{+63}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 3.25 \cdot 10^{+136}:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.0999999999999999e63 or 3.2499999999999999e136 < y Initial program 68.3%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/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.3
Applied rewrites83.3%
lift-fma.f64N/A
+-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
lift-*.f64N/A
div-flip-revN/A
lift-/.f64N/A
lift-/.f64N/A
sum-to-multN/A
lower-*.f64N/A
Applied rewrites62.9%
Taylor expanded in y around -inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f6431.6
Applied rewrites31.6%
Taylor expanded in x around inf
lower-/.f64N/A
lower--.f6424.5
Applied rewrites24.5%
if -1.0999999999999999e63 < y < 3.2499999999999999e136Initial program 68.3%
Taylor expanded in z around inf
lower--.f6419.1
Applied rewrites19.1%
Taylor expanded in x around inf
lower-*.f642.8
Applied rewrites2.8%
Taylor expanded in x around 0
Applied rewrites33.9%
(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 68.3%
Taylor expanded in z around inf
lower--.f6419.1
Applied rewrites19.1%
Taylor expanded in x around inf
lower-*.f642.8
Applied rewrites2.8%
Taylor expanded in x around 0
Applied rewrites33.9%
herbie shell --seed 2025142
(FPCore (x y z t a)
:name "Graphics.Rendering.Chart.Axis.Types:invLinMap from Chart-1.5.3"
:precision binary64
(+ x (/ (* (- y z) (- t x)) (- a z))))