
(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]
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
Herbie found 19 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]
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (/ (* (- y z) (- t x)) (- a z)))))
(if (<= t_1 -1e-302)
(fma (/ (- z y) (- z a)) (- t x) x)
(if (<= t_1 0.0)
(- (+ t (* -1.0 (/ (* y (- t x)) z))) (* -1.0 (/ (* a (- t x)) z)))
(- x (* (/ (- z y) (- a z)) (- t x)))))))double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - z) * (t - x)) / (a - z));
double tmp;
if (t_1 <= -1e-302) {
tmp = fma(((z - y) / (z - a)), (t - x), x);
} else if (t_1 <= 0.0) {
tmp = (t + (-1.0 * ((y * (t - x)) / z))) - (-1.0 * ((a * (t - x)) / z));
} else {
tmp = x - (((z - y) / (a - z)) * (t - x));
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(Float64(y - z) * Float64(t - x)) / Float64(a - z))) tmp = 0.0 if (t_1 <= -1e-302) tmp = fma(Float64(Float64(z - y) / Float64(z - a)), Float64(t - x), x); elseif (t_1 <= 0.0) tmp = Float64(Float64(t + Float64(-1.0 * Float64(Float64(y * Float64(t - x)) / z))) - Float64(-1.0 * Float64(Float64(a * Float64(t - x)) / z))); else tmp = Float64(x - Float64(Float64(Float64(z - y) / Float64(a - z)) * Float64(t - x))); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-302], N[(N[(N[(z - y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(N[(t + N[(-1.0 * N[(N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(-1.0 * N[(N[(a * N[(t - x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(N[(z - y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-302}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{z - a}, t - x, x\right)\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\left(t + -1 \cdot \frac{y \cdot \left(t - x\right)}{z}\right) - -1 \cdot \frac{a \cdot \left(t - x\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{z - y}{a - z} \cdot \left(t - x\right)\\
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -9.9999999999999996e-303Initial program 68.2%
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--.f6483.7
Applied rewrites83.7%
if -9.9999999999999996e-303 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 0.0Initial program 68.2%
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-/.f64N/A
lower-*.f64N/A
lower--.f6445.9
Applied rewrites45.9%
if 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) Initial program 68.2%
lift-+.f64N/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
mult-flip-revN/A
lift--.f64N/A
div-subN/A
sub-negateN/A
div-subN/A
frac-2neg-revN/A
sub-negate-revN/A
lift--.f64N/A
lower-*.f64N/A
Applied rewrites83.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (/ (* (- y z) (- t x)) (- a z)))))
(if (<= t_1 -1e-302)
(fma (/ (- z y) (- z a)) (- t x) x)
(if (<= t_1 0.0)
(+ t (* -1.0 (/ (- (* y (- t x)) (* a (- t x))) z)))
(- x (* (/ (- z y) (- a z)) (- t x)))))))double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - z) * (t - x)) / (a - z));
double tmp;
if (t_1 <= -1e-302) {
tmp = fma(((z - y) / (z - a)), (t - x), x);
} else if (t_1 <= 0.0) {
tmp = t + (-1.0 * (((y * (t - x)) - (a * (t - x))) / z));
} else {
tmp = x - (((z - y) / (a - z)) * (t - x));
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(Float64(y - z) * Float64(t - x)) / Float64(a - z))) tmp = 0.0 if (t_1 <= -1e-302) tmp = fma(Float64(Float64(z - y) / Float64(z - a)), Float64(t - x), x); elseif (t_1 <= 0.0) tmp = Float64(t + Float64(-1.0 * Float64(Float64(Float64(y * Float64(t - x)) - Float64(a * Float64(t - x))) / z))); else tmp = Float64(x - Float64(Float64(Float64(z - y) / Float64(a - z)) * Float64(t - x))); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-302], N[(N[(N[(z - y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 0.0], 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[(x - N[(N[(N[(z - y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-302}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{z - a}, t - x, x\right)\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;t + -1 \cdot \frac{y \cdot \left(t - x\right) - a \cdot \left(t - x\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{z - y}{a - z} \cdot \left(t - x\right)\\
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -9.9999999999999996e-303Initial program 68.2%
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--.f6483.7
Applied rewrites83.7%
if -9.9999999999999996e-303 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 0.0Initial program 68.2%
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.5
Applied rewrites46.5%
if 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) Initial program 68.2%
lift-+.f64N/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
mult-flip-revN/A
lift--.f64N/A
div-subN/A
sub-negateN/A
div-subN/A
frac-2neg-revN/A
sub-negate-revN/A
lift--.f64N/A
lower-*.f64N/A
Applied rewrites83.7%
(FPCore (x y z t a) :precision binary64 (- x (* (/ (- z y) (- a z)) (- t x))))
double code(double x, double y, double z, double t, double a) {
return x - (((z - y) / (a - z)) * (t - x));
}
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 - (((z - y) / (a - z)) * (t - x))
end function
public static double code(double x, double y, double z, double t, double a) {
return x - (((z - y) / (a - z)) * (t - x));
}
def code(x, y, z, t, a): return x - (((z - y) / (a - z)) * (t - x))
function code(x, y, z, t, a) return Float64(x - Float64(Float64(Float64(z - y) / Float64(a - z)) * Float64(t - x))) end
function tmp = code(x, y, z, t, a) tmp = x - (((z - y) / (a - z)) * (t - x)); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(N[(z - y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x - \frac{z - y}{a - z} \cdot \left(t - x\right)
Initial program 68.2%
lift-+.f64N/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
mult-flip-revN/A
lift--.f64N/A
div-subN/A
sub-negateN/A
div-subN/A
frac-2neg-revN/A
sub-negate-revN/A
lift--.f64N/A
lower-*.f64N/A
Applied rewrites83.7%
(FPCore (x y z t a) :precision binary64 (fma (/ (- z y) (- z a)) (- t x) x))
double code(double x, double y, double z, double t, double a) {
return fma(((z - y) / (z - a)), (t - x), x);
}
function code(x, y, z, t, a) return fma(Float64(Float64(z - y) / Float64(z - a)), Float64(t - x), x) end
code[x_, y_, z_, t_, a_] := N[(N[(N[(z - y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision]
\mathsf{fma}\left(\frac{z - y}{z - a}, t - x, x\right)
Initial program 68.2%
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--.f6483.7
Applied rewrites83.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- x t) (- z a)) (- y z) x)))
(if (<= y -3e-62)
t_1
(if (<= y 1.45e-206) (- x (* (/ z (- a z)) (- t x))) t_1))))double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((x - t) / (z - a)), (y - z), x);
double tmp;
if (y <= -3e-62) {
tmp = t_1;
} else if (y <= 1.45e-206) {
tmp = x - ((z / (a - z)) * (t - x));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(x - t) / Float64(z - a)), Float64(y - z), x) tmp = 0.0 if (y <= -3e-62) tmp = t_1; elseif (y <= 1.45e-206) tmp = Float64(x - Float64(Float64(z / Float64(a - z)) * Float64(t - x))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(x - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[y, -3e-62], t$95$1, If[LessEqual[y, 1.45e-206], N[(x - N[(N[(z / N[(a - z), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{x - t}{z - a}, y - z, x\right)\\
\mathbf{if}\;y \leq -3 \cdot 10^{-62}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.45 \cdot 10^{-206}:\\
\;\;\;\;x - \frac{z}{a - z} \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if y < -3.0000000000000001e-62 or 1.4500000000000001e-206 < y Initial program 68.2%
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--.f6480.0
Applied rewrites80.0%
if -3.0000000000000001e-62 < y < 1.4500000000000001e-206Initial program 68.2%
lift-+.f64N/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
mult-flip-revN/A
lift--.f64N/A
div-subN/A
sub-negateN/A
div-subN/A
frac-2neg-revN/A
sub-negate-revN/A
lift--.f64N/A
lower-*.f64N/A
Applied rewrites83.7%
Taylor expanded in y around 0
Applied rewrites46.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- z y) (/ t (- z a)) x)) (t_2 (* (- x t) (/ y (- z a)))))
(if (<= y -6.5e+129)
t_2
(if (<= y -3.6e-26)
t_1
(if (<= y 2.35e-206)
(- x (* (/ z (- a z)) (- t x)))
(if (<= y 2.5e+147) t_1 t_2))))))double code(double x, double y, double z, double t, double a) {
double t_1 = fma((z - y), (t / (z - a)), x);
double t_2 = (x - t) * (y / (z - a));
double tmp;
if (y <= -6.5e+129) {
tmp = t_2;
} else if (y <= -3.6e-26) {
tmp = t_1;
} else if (y <= 2.35e-206) {
tmp = x - ((z / (a - z)) * (t - x));
} else if (y <= 2.5e+147) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(z - y), Float64(t / Float64(z - a)), x) t_2 = Float64(Float64(x - t) * Float64(y / Float64(z - a))) tmp = 0.0 if (y <= -6.5e+129) tmp = t_2; elseif (y <= -3.6e-26) tmp = t_1; elseif (y <= 2.35e-206) tmp = Float64(x - Float64(Float64(z / Float64(a - z)) * Float64(t - x))); elseif (y <= 2.5e+147) tmp = t_1; else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - y), $MachinePrecision] * N[(t / N[(z - a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x - t), $MachinePrecision] * N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -6.5e+129], t$95$2, If[LessEqual[y, -3.6e-26], t$95$1, If[LessEqual[y, 2.35e-206], N[(x - N[(N[(z / N[(a - z), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.5e+147], t$95$1, t$95$2]]]]]]
\begin{array}{l}
t_1 := \mathsf{fma}\left(z - y, \frac{t}{z - a}, x\right)\\
t_2 := \left(x - t\right) \cdot \frac{y}{z - a}\\
\mathbf{if}\;y \leq -6.5 \cdot 10^{+129}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq -3.6 \cdot 10^{-26}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.35 \cdot 10^{-206}:\\
\;\;\;\;x - \frac{z}{a - z} \cdot \left(t - x\right)\\
\mathbf{elif}\;y \leq 2.5 \cdot 10^{+147}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if y < -6.4999999999999995e129 or 2.5000000000000001e147 < y Initial program 68.2%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6442.2
Applied rewrites42.2%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
sub-divN/A
lift--.f64N/A
associate-*l/N/A
lift--.f64N/A
sub-to-mult-revN/A
lift-/.f64N/A
lift--.f64N/A
times-fracN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
sub-negate-revN/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f64N/A
lower-/.f6437.8
Applied rewrites37.8%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
associate-/l*N/A
lift--.f64N/A
sub-negate-revN/A
sub-negate-revN/A
lift--.f64N/A
distribute-lft-neg-outN/A
lift--.f64N/A
sub-negate-revN/A
lift-/.f64N/A
sub-to-mult-revN/A
sub-negate-revN/A
lift--.f64N/A
lower-*.f64N/A
Applied rewrites44.0%
if -6.4999999999999995e129 < y < -3.6000000000000001e-26 or 2.3499999999999999e-206 < y < 2.5000000000000001e147Initial program 68.2%
lift-+.f64N/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
mult-flip-revN/A
lift--.f64N/A
div-subN/A
sub-negateN/A
div-subN/A
frac-2neg-revN/A
sub-negate-revN/A
lift--.f64N/A
lower-*.f64N/A
Applied rewrites83.7%
Taylor expanded in x around 0
Applied rewrites67.2%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
distribute-neg-frac2N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6464.2
Applied rewrites64.2%
if -3.6000000000000001e-26 < y < 2.3499999999999999e-206Initial program 68.2%
lift-+.f64N/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
mult-flip-revN/A
lift--.f64N/A
div-subN/A
sub-negateN/A
div-subN/A
frac-2neg-revN/A
sub-negate-revN/A
lift--.f64N/A
lower-*.f64N/A
Applied rewrites83.7%
Taylor expanded in y around 0
Applied rewrites46.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- z y) (/ t (- z a)) x)) (t_2 (* (- x t) (/ y (- z a)))))
(if (<= y -6.5e+129)
t_2
(if (<= y -3.6e-26)
t_1
(if (<= y 2.35e-206)
(fma (/ z (- z a)) (- t x) x)
(if (<= y 2.5e+147) t_1 t_2))))))double code(double x, double y, double z, double t, double a) {
double t_1 = fma((z - y), (t / (z - a)), x);
double t_2 = (x - t) * (y / (z - a));
double tmp;
if (y <= -6.5e+129) {
tmp = t_2;
} else if (y <= -3.6e-26) {
tmp = t_1;
} else if (y <= 2.35e-206) {
tmp = fma((z / (z - a)), (t - x), x);
} else if (y <= 2.5e+147) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(z - y), Float64(t / Float64(z - a)), x) t_2 = Float64(Float64(x - t) * Float64(y / Float64(z - a))) tmp = 0.0 if (y <= -6.5e+129) tmp = t_2; elseif (y <= -3.6e-26) tmp = t_1; elseif (y <= 2.35e-206) tmp = fma(Float64(z / Float64(z - a)), Float64(t - x), x); elseif (y <= 2.5e+147) tmp = t_1; else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - y), $MachinePrecision] * N[(t / N[(z - a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x - t), $MachinePrecision] * N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -6.5e+129], t$95$2, If[LessEqual[y, -3.6e-26], t$95$1, If[LessEqual[y, 2.35e-206], N[(N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[y, 2.5e+147], t$95$1, t$95$2]]]]]]
\begin{array}{l}
t_1 := \mathsf{fma}\left(z - y, \frac{t}{z - a}, x\right)\\
t_2 := \left(x - t\right) \cdot \frac{y}{z - a}\\
\mathbf{if}\;y \leq -6.5 \cdot 10^{+129}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq -3.6 \cdot 10^{-26}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.35 \cdot 10^{-206}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{z - a}, t - x, x\right)\\
\mathbf{elif}\;y \leq 2.5 \cdot 10^{+147}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if y < -6.4999999999999995e129 or 2.5000000000000001e147 < y Initial program 68.2%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6442.2
Applied rewrites42.2%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
sub-divN/A
lift--.f64N/A
associate-*l/N/A
lift--.f64N/A
sub-to-mult-revN/A
lift-/.f64N/A
lift--.f64N/A
times-fracN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
sub-negate-revN/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f64N/A
lower-/.f6437.8
Applied rewrites37.8%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
associate-/l*N/A
lift--.f64N/A
sub-negate-revN/A
sub-negate-revN/A
lift--.f64N/A
distribute-lft-neg-outN/A
lift--.f64N/A
sub-negate-revN/A
lift-/.f64N/A
sub-to-mult-revN/A
sub-negate-revN/A
lift--.f64N/A
lower-*.f64N/A
Applied rewrites44.0%
if -6.4999999999999995e129 < y < -3.6000000000000001e-26 or 2.3499999999999999e-206 < y < 2.5000000000000001e147Initial program 68.2%
lift-+.f64N/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
mult-flip-revN/A
lift--.f64N/A
div-subN/A
sub-negateN/A
div-subN/A
frac-2neg-revN/A
sub-negate-revN/A
lift--.f64N/A
lower-*.f64N/A
Applied rewrites83.7%
Taylor expanded in x around 0
Applied rewrites67.2%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
distribute-neg-frac2N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6464.2
Applied rewrites64.2%
if -3.6000000000000001e-26 < y < 2.3499999999999999e-206Initial program 68.2%
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--.f6483.7
Applied rewrites83.7%
Taylor expanded in y around 0
Applied rewrites46.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (- x t) (/ y (- z a)))))
(if (<= y -6.5e+129)
t_1
(if (<= y 2.4e+84) (- x (* (/ (- z y) (- a z)) t)) t_1))))double code(double x, double y, double z, double t, double a) {
double t_1 = (x - t) * (y / (z - a));
double tmp;
if (y <= -6.5e+129) {
tmp = t_1;
} else if (y <= 2.4e+84) {
tmp = x - (((z - y) / (a - z)) * 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 = (x - t) * (y / (z - a))
if (y <= (-6.5d+129)) then
tmp = t_1
else if (y <= 2.4d+84) then
tmp = x - (((z - y) / (a - z)) * 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 = (x - t) * (y / (z - a));
double tmp;
if (y <= -6.5e+129) {
tmp = t_1;
} else if (y <= 2.4e+84) {
tmp = x - (((z - y) / (a - z)) * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (x - t) * (y / (z - a)) tmp = 0 if y <= -6.5e+129: tmp = t_1 elif y <= 2.4e+84: tmp = x - (((z - y) / (a - z)) * t) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(x - t) * Float64(y / Float64(z - a))) tmp = 0.0 if (y <= -6.5e+129) tmp = t_1; elseif (y <= 2.4e+84) tmp = Float64(x - Float64(Float64(Float64(z - y) / Float64(a - z)) * t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (x - t) * (y / (z - a)); tmp = 0.0; if (y <= -6.5e+129) tmp = t_1; elseif (y <= 2.4e+84) tmp = x - (((z - y) / (a - z)) * t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x - t), $MachinePrecision] * N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -6.5e+129], t$95$1, If[LessEqual[y, 2.4e+84], N[(x - N[(N[(N[(z - y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \left(x - t\right) \cdot \frac{y}{z - a}\\
\mathbf{if}\;y \leq -6.5 \cdot 10^{+129}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.4 \cdot 10^{+84}:\\
\;\;\;\;x - \frac{z - y}{a - z} \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if y < -6.4999999999999995e129 or 2.4e84 < y Initial program 68.2%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6442.2
Applied rewrites42.2%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
sub-divN/A
lift--.f64N/A
associate-*l/N/A
lift--.f64N/A
sub-to-mult-revN/A
lift-/.f64N/A
lift--.f64N/A
times-fracN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
sub-negate-revN/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f64N/A
lower-/.f6437.8
Applied rewrites37.8%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
associate-/l*N/A
lift--.f64N/A
sub-negate-revN/A
sub-negate-revN/A
lift--.f64N/A
distribute-lft-neg-outN/A
lift--.f64N/A
sub-negate-revN/A
lift-/.f64N/A
sub-to-mult-revN/A
sub-negate-revN/A
lift--.f64N/A
lower-*.f64N/A
Applied rewrites44.0%
if -6.4999999999999995e129 < y < 2.4e84Initial program 68.2%
lift-+.f64N/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
mult-flip-revN/A
lift--.f64N/A
div-subN/A
sub-negateN/A
div-subN/A
frac-2neg-revN/A
sub-negate-revN/A
lift--.f64N/A
lower-*.f64N/A
Applied rewrites83.7%
Taylor expanded in x around 0
Applied rewrites67.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (- x t) (/ y (- z a)))))
(if (<= y -6.5e+129)
t_1
(if (<= y 2.5e+147) (fma (- z y) (/ t (- z a)) x) t_1))))double code(double x, double y, double z, double t, double a) {
double t_1 = (x - t) * (y / (z - a));
double tmp;
if (y <= -6.5e+129) {
tmp = t_1;
} else if (y <= 2.5e+147) {
tmp = fma((z - y), (t / (z - a)), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(x - t) * Float64(y / Float64(z - a))) tmp = 0.0 if (y <= -6.5e+129) tmp = t_1; elseif (y <= 2.5e+147) tmp = fma(Float64(z - y), Float64(t / Float64(z - a)), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x - t), $MachinePrecision] * N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -6.5e+129], t$95$1, If[LessEqual[y, 2.5e+147], N[(N[(z - y), $MachinePrecision] * N[(t / N[(z - a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \left(x - t\right) \cdot \frac{y}{z - a}\\
\mathbf{if}\;y \leq -6.5 \cdot 10^{+129}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.5 \cdot 10^{+147}:\\
\;\;\;\;\mathsf{fma}\left(z - y, \frac{t}{z - a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if y < -6.4999999999999995e129 or 2.5000000000000001e147 < y Initial program 68.2%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6442.2
Applied rewrites42.2%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
sub-divN/A
lift--.f64N/A
associate-*l/N/A
lift--.f64N/A
sub-to-mult-revN/A
lift-/.f64N/A
lift--.f64N/A
times-fracN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
sub-negate-revN/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f64N/A
lower-/.f6437.8
Applied rewrites37.8%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
associate-/l*N/A
lift--.f64N/A
sub-negate-revN/A
sub-negate-revN/A
lift--.f64N/A
distribute-lft-neg-outN/A
lift--.f64N/A
sub-negate-revN/A
lift-/.f64N/A
sub-to-mult-revN/A
sub-negate-revN/A
lift--.f64N/A
lower-*.f64N/A
Applied rewrites44.0%
if -6.4999999999999995e129 < y < 2.5000000000000001e147Initial program 68.2%
lift-+.f64N/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
mult-flip-revN/A
lift--.f64N/A
div-subN/A
sub-negateN/A
div-subN/A
frac-2neg-revN/A
sub-negate-revN/A
lift--.f64N/A
lower-*.f64N/A
Applied rewrites83.7%
Taylor expanded in x around 0
Applied rewrites67.2%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
distribute-neg-frac2N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6464.2
Applied rewrites64.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ (- z y) (- z a)) t)))
(if (<= z -1.55)
t_1
(if (<= z 2.4e+82) (fma (- t x) (/ (- y z) a) x) t_1))))double code(double x, double y, double z, double t, double a) {
double t_1 = ((z - y) / (z - a)) * t;
double tmp;
if (z <= -1.55) {
tmp = t_1;
} else if (z <= 2.4e+82) {
tmp = fma((t - x), ((y - z) / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(z - y) / Float64(z - a)) * t) tmp = 0.0 if (z <= -1.55) tmp = t_1; elseif (z <= 2.4e+82) tmp = fma(Float64(t - x), Float64(Float64(y - z) / a), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(z - y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[z, -1.55], t$95$1, If[LessEqual[z, 2.4e+82], N[(N[(t - x), $MachinePrecision] * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \frac{z - y}{z - a} \cdot t\\
\mathbf{if}\;z \leq -1.55:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.4 \cdot 10^{+82}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y - z}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if z < -1.55000000000000004 or 2.39999999999999998e82 < z Initial program 68.2%
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--.f6483.7
Applied rewrites83.7%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.7
Applied rewrites39.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
mul-1-negN/A
associate-*l/N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6451.4
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
mul-1-negN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
lower-/.f6451.5
Applied rewrites51.5%
if -1.55000000000000004 < z < 2.39999999999999998e82Initial program 68.2%
Taylor expanded in z around 0
Applied rewrites46.1%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6452.6
Applied rewrites52.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (- x t) (/ y (- z a)))))
(if (<= y -6.7e+125)
t_1
(if (<= y 1.76e+78) (- x (* (/ z (- a z)) t)) t_1))))double code(double x, double y, double z, double t, double a) {
double t_1 = (x - t) * (y / (z - a));
double tmp;
if (y <= -6.7e+125) {
tmp = t_1;
} else if (y <= 1.76e+78) {
tmp = x - ((z / (a - z)) * 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 = (x - t) * (y / (z - a))
if (y <= (-6.7d+125)) then
tmp = t_1
else if (y <= 1.76d+78) then
tmp = x - ((z / (a - z)) * 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 = (x - t) * (y / (z - a));
double tmp;
if (y <= -6.7e+125) {
tmp = t_1;
} else if (y <= 1.76e+78) {
tmp = x - ((z / (a - z)) * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (x - t) * (y / (z - a)) tmp = 0 if y <= -6.7e+125: tmp = t_1 elif y <= 1.76e+78: tmp = x - ((z / (a - z)) * t) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(x - t) * Float64(y / Float64(z - a))) tmp = 0.0 if (y <= -6.7e+125) tmp = t_1; elseif (y <= 1.76e+78) tmp = Float64(x - Float64(Float64(z / Float64(a - z)) * t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (x - t) * (y / (z - a)); tmp = 0.0; if (y <= -6.7e+125) tmp = t_1; elseif (y <= 1.76e+78) tmp = x - ((z / (a - z)) * t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x - t), $MachinePrecision] * N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -6.7e+125], t$95$1, If[LessEqual[y, 1.76e+78], N[(x - N[(N[(z / N[(a - z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \left(x - t\right) \cdot \frac{y}{z - a}\\
\mathbf{if}\;y \leq -6.7 \cdot 10^{+125}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.76 \cdot 10^{+78}:\\
\;\;\;\;x - \frac{z}{a - z} \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if y < -6.7000000000000003e125 or 1.76e78 < y Initial program 68.2%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6442.2
Applied rewrites42.2%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
sub-divN/A
lift--.f64N/A
associate-*l/N/A
lift--.f64N/A
sub-to-mult-revN/A
lift-/.f64N/A
lift--.f64N/A
times-fracN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
sub-negate-revN/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f64N/A
lower-/.f6437.8
Applied rewrites37.8%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
associate-/l*N/A
lift--.f64N/A
sub-negate-revN/A
sub-negate-revN/A
lift--.f64N/A
distribute-lft-neg-outN/A
lift--.f64N/A
sub-negate-revN/A
lift-/.f64N/A
sub-to-mult-revN/A
sub-negate-revN/A
lift--.f64N/A
lower-*.f64N/A
Applied rewrites44.0%
if -6.7000000000000003e125 < y < 1.76e78Initial program 68.2%
lift-+.f64N/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
mult-flip-revN/A
lift--.f64N/A
div-subN/A
sub-negateN/A
div-subN/A
frac-2neg-revN/A
sub-negate-revN/A
lift--.f64N/A
lower-*.f64N/A
Applied rewrites83.7%
Taylor expanded in x around 0
Applied rewrites67.2%
Taylor expanded in y around 0
Applied rewrites45.1%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (/ (- z y) (- z a)) t))) (if (<= z -1550.0) t_1 (if (<= z 4.6e+75) (fma (/ y a) (- t x) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((z - y) / (z - a)) * t;
double tmp;
if (z <= -1550.0) {
tmp = t_1;
} else if (z <= 4.6e+75) {
tmp = fma((y / a), (t - x), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(z - y) / Float64(z - a)) * t) tmp = 0.0 if (z <= -1550.0) tmp = t_1; elseif (z <= 4.6e+75) tmp = fma(Float64(y / a), Float64(t - x), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(z - y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[z, -1550.0], t$95$1, If[LessEqual[z, 4.6e+75], N[(N[(y / a), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \frac{z - y}{z - a} \cdot t\\
\mathbf{if}\;z \leq -1550:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4.6 \cdot 10^{+75}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if z < -1550 or 4.5999999999999997e75 < z Initial program 68.2%
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--.f6483.7
Applied rewrites83.7%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.7
Applied rewrites39.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
mul-1-negN/A
associate-*l/N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6451.4
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
mul-1-negN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
lower-/.f6451.5
Applied rewrites51.5%
if -1550 < z < 4.5999999999999997e75Initial program 68.2%
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--.f6483.7
Applied rewrites83.7%
Taylor expanded in z around 0
lower-/.f6448.0
Applied rewrites48.0%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (- z y) (/ t (- z a))))) (if (<= z -1550.0) t_1 (if (<= z 4.6e+75) (fma (/ y a) (- t x) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - y) * (t / (z - a));
double tmp;
if (z <= -1550.0) {
tmp = t_1;
} else if (z <= 4.6e+75) {
tmp = fma((y / a), (t - x), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - y) * Float64(t / Float64(z - a))) tmp = 0.0 if (z <= -1550.0) tmp = t_1; elseif (z <= 4.6e+75) tmp = fma(Float64(y / a), Float64(t - x), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - y), $MachinePrecision] * N[(t / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1550.0], t$95$1, If[LessEqual[z, 4.6e+75], N[(N[(y / a), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \left(z - y\right) \cdot \frac{t}{z - a}\\
\mathbf{if}\;z \leq -1550:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4.6 \cdot 10^{+75}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if z < -1550 or 4.5999999999999997e75 < z Initial program 68.2%
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--.f6483.7
Applied rewrites83.7%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.7
Applied rewrites39.7%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6446.4
Applied rewrites46.4%
if -1550 < z < 4.5999999999999997e75Initial program 68.2%
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--.f6483.7
Applied rewrites83.7%
Taylor expanded in z around 0
lower-/.f6448.0
Applied rewrites48.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* t (- y z)) (- a z))))
(if (<= z -3.9e+81)
(+ x t)
(if (<= z -1600.0) t_1 (if (<= z 6e+82) (fma (/ y a) (- t x) x) t_1)))))double code(double x, double y, double z, double t, double a) {
double t_1 = (t * (y - z)) / (a - z);
double tmp;
if (z <= -3.9e+81) {
tmp = x + t;
} else if (z <= -1600.0) {
tmp = t_1;
} else if (z <= 6e+82) {
tmp = fma((y / a), (t - x), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(t * Float64(y - z)) / Float64(a - z)) tmp = 0.0 if (z <= -3.9e+81) tmp = Float64(x + t); elseif (z <= -1600.0) tmp = t_1; elseif (z <= 6e+82) tmp = fma(Float64(y / a), Float64(t - x), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.9e+81], N[(x + t), $MachinePrecision], If[LessEqual[z, -1600.0], t$95$1, If[LessEqual[z, 6e+82], N[(N[(y / a), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_1 := \frac{t \cdot \left(y - z\right)}{a - z}\\
\mathbf{if}\;z \leq -3.9 \cdot 10^{+81}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;z \leq -1600:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 6 \cdot 10^{+82}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if z < -3.9000000000000001e81Initial program 68.2%
Taylor expanded in z around inf
lower--.f6419.1
Applied rewrites19.1%
Taylor expanded in x around 0
Applied rewrites33.3%
if -3.9000000000000001e81 < z < -1600 or 5.99999999999999978e82 < z Initial program 68.2%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.7
Applied rewrites39.7%
if -1600 < z < 5.99999999999999978e82Initial program 68.2%
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--.f6483.7
Applied rewrites83.7%
Taylor expanded in z around 0
lower-/.f6448.0
Applied rewrites48.0%
(FPCore (x y z t a)
:precision binary64
(if (<= z -3.9e+81)
(+ x t)
(if (<= z -1.75)
(/ (* t (- z y)) z)
(if (<= z 6e+82) (fma (/ y a) (- t x) x) (/ (* t z) (- z a))))))double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.9e+81) {
tmp = x + t;
} else if (z <= -1.75) {
tmp = (t * (z - y)) / z;
} else if (z <= 6e+82) {
tmp = fma((y / a), (t - x), x);
} else {
tmp = (t * z) / (z - a);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.9e+81) tmp = Float64(x + t); elseif (z <= -1.75) tmp = Float64(Float64(t * Float64(z - y)) / z); elseif (z <= 6e+82) tmp = fma(Float64(y / a), Float64(t - x), x); else tmp = Float64(Float64(t * z) / Float64(z - a)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.9e+81], N[(x + t), $MachinePrecision], If[LessEqual[z, -1.75], N[(N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[z, 6e+82], N[(N[(y / a), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision], N[(N[(t * z), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\mathbf{if}\;z \leq -3.9 \cdot 10^{+81}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;z \leq -1.75:\\
\;\;\;\;\frac{t \cdot \left(z - y\right)}{z}\\
\mathbf{elif}\;z \leq 6 \cdot 10^{+82}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t \cdot z}{z - a}\\
\end{array}
if z < -3.9000000000000001e81Initial program 68.2%
Taylor expanded in z around inf
lower--.f6419.1
Applied rewrites19.1%
Taylor expanded in x around 0
Applied rewrites33.3%
if -3.9000000000000001e81 < z < -1.75Initial program 68.2%
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--.f6483.7
Applied rewrites83.7%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.7
Applied rewrites39.7%
Taylor expanded in a around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f6426.8
Applied rewrites26.8%
if -1.75 < z < 5.99999999999999978e82Initial program 68.2%
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--.f6483.7
Applied rewrites83.7%
Taylor expanded in z around 0
lower-/.f6448.0
Applied rewrites48.0%
if 5.99999999999999978e82 < z Initial program 68.2%
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--.f6483.7
Applied rewrites83.7%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.7
Applied rewrites39.7%
Taylor expanded in y around 0
lower-*.f6421.2
Applied rewrites21.2%
(FPCore (x y z t a) :precision binary64 (if (<= y -6.5e+129) (/ (* y (- x t)) z) (if (<= y 2.4e+84) (+ x t) (* y (/ (- t x) a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -6.5e+129) {
tmp = (y * (x - t)) / z;
} else if (y <= 2.4e+84) {
tmp = x + t;
} else {
tmp = y * ((t - x) / a);
}
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 (y <= (-6.5d+129)) then
tmp = (y * (x - t)) / z
else if (y <= 2.4d+84) then
tmp = x + t
else
tmp = y * ((t - x) / a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -6.5e+129) {
tmp = (y * (x - t)) / z;
} else if (y <= 2.4e+84) {
tmp = x + t;
} else {
tmp = y * ((t - x) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -6.5e+129: tmp = (y * (x - t)) / z elif y <= 2.4e+84: tmp = x + t else: tmp = y * ((t - x) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -6.5e+129) tmp = Float64(Float64(y * Float64(x - t)) / z); elseif (y <= 2.4e+84) tmp = Float64(x + t); else tmp = Float64(y * Float64(Float64(t - x) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -6.5e+129) tmp = (y * (x - t)) / z; elseif (y <= 2.4e+84) tmp = x + t; else tmp = y * ((t - x) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -6.5e+129], N[(N[(y * N[(x - t), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[y, 2.4e+84], N[(x + t), $MachinePrecision], N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;y \leq -6.5 \cdot 10^{+129}:\\
\;\;\;\;\frac{y \cdot \left(x - t\right)}{z}\\
\mathbf{elif}\;y \leq 2.4 \cdot 10^{+84}:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{t - x}{a}\\
\end{array}
if y < -6.4999999999999995e129Initial program 68.2%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6442.2
Applied rewrites42.2%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
sub-divN/A
lift--.f64N/A
associate-*l/N/A
lift--.f64N/A
sub-to-mult-revN/A
lift-/.f64N/A
lift--.f64N/A
times-fracN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
sub-negate-revN/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f64N/A
lower-/.f6437.8
Applied rewrites37.8%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6424.4
Applied rewrites24.4%
if -6.4999999999999995e129 < y < 2.4e84Initial program 68.2%
Taylor expanded in z around inf
lower--.f6419.1
Applied rewrites19.1%
Taylor expanded in x around 0
Applied rewrites33.3%
if 2.4e84 < y Initial program 68.2%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6442.2
Applied rewrites42.2%
Taylor expanded in a around inf
lower-/.f64N/A
lower--.f6425.5
Applied rewrites25.5%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (* y (- x t)) z))) (if (<= y -6.5e+129) t_1 (if (<= y 1.76e+78) (+ x t) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y * (x - t)) / z;
double tmp;
if (y <= -6.5e+129) {
tmp = t_1;
} else if (y <= 1.76e+78) {
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 * (x - t)) / z
if (y <= (-6.5d+129)) then
tmp = t_1
else if (y <= 1.76d+78) 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 * (x - t)) / z;
double tmp;
if (y <= -6.5e+129) {
tmp = t_1;
} else if (y <= 1.76e+78) {
tmp = x + t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y * (x - t)) / z tmp = 0 if y <= -6.5e+129: tmp = t_1 elif y <= 1.76e+78: tmp = x + t else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y * Float64(x - t)) / z) tmp = 0.0 if (y <= -6.5e+129) tmp = t_1; elseif (y <= 1.76e+78) tmp = Float64(x + t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y * (x - t)) / z; tmp = 0.0; if (y <= -6.5e+129) tmp = t_1; elseif (y <= 1.76e+78) 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[(x - t), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]}, If[LessEqual[y, -6.5e+129], t$95$1, If[LessEqual[y, 1.76e+78], N[(x + t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \frac{y \cdot \left(x - t\right)}{z}\\
\mathbf{if}\;y \leq -6.5 \cdot 10^{+129}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.76 \cdot 10^{+78}:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if y < -6.4999999999999995e129 or 1.76e78 < y Initial program 68.2%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6442.2
Applied rewrites42.2%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
sub-divN/A
lift--.f64N/A
associate-*l/N/A
lift--.f64N/A
sub-to-mult-revN/A
lift-/.f64N/A
lift--.f64N/A
times-fracN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
sub-negate-revN/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f64N/A
lower-/.f6437.8
Applied rewrites37.8%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6424.4
Applied rewrites24.4%
if -6.4999999999999995e129 < y < 1.76e78Initial program 68.2%
Taylor expanded in z around inf
lower--.f6419.1
Applied rewrites19.1%
Taylor expanded in x around 0
Applied rewrites33.3%
(FPCore (x y z t a) :precision binary64 (if (<= y 1.76e+78) (+ x t) (/ (* t y) (- a z))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= 1.76e+78) {
tmp = x + t;
} else {
tmp = (t * y) / (a - z);
}
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 (y <= 1.76d+78) then
tmp = x + t
else
tmp = (t * y) / (a - z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= 1.76e+78) {
tmp = x + t;
} else {
tmp = (t * y) / (a - z);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= 1.76e+78: tmp = x + t else: tmp = (t * y) / (a - z) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= 1.76e+78) tmp = Float64(x + t); else tmp = Float64(Float64(t * y) / Float64(a - z)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= 1.76e+78) tmp = x + t; else tmp = (t * y) / (a - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, 1.76e+78], N[(x + t), $MachinePrecision], N[(N[(t * y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;y \leq 1.76 \cdot 10^{+78}:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;\frac{t \cdot y}{a - z}\\
\end{array}
if y < 1.76e78Initial program 68.2%
Taylor expanded in z around inf
lower--.f6419.1
Applied rewrites19.1%
Taylor expanded in x around 0
Applied rewrites33.3%
if 1.76e78 < y Initial program 68.2%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6442.2
Applied rewrites42.2%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f6421.6
Applied rewrites21.6%
(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]
x + t
Initial program 68.2%
Taylor expanded in z around inf
lower--.f6419.1
Applied rewrites19.1%
Taylor expanded in x around 0
Applied rewrites33.3%
herbie shell --seed 2025172
(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))))