
(FPCore (x y z t a) :precision binary64 (/ (- x (* y z)) (- t (* a z))))
double code(double x, double y, double z, double t, double a) {
return (x - (y * z)) / (t - (a * z));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = (x - (y * z)) / (t - (a * z))
end function
public static double code(double x, double y, double z, double t, double a) {
return (x - (y * z)) / (t - (a * z));
}
def code(x, y, z, t, a): return (x - (y * z)) / (t - (a * z))
function code(x, y, z, t, a) return Float64(Float64(x - Float64(y * z)) / Float64(t - Float64(a * z))) end
function tmp = code(x, y, z, t, a) tmp = (x - (y * z)) / (t - (a * z)); end
code[x_, y_, z_, t_, a_] := N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{x - y \cdot z}{t - a \cdot z}
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (/ (- x (* y z)) (- t (* a z))))
double code(double x, double y, double z, double t, double a) {
return (x - (y * z)) / (t - (a * z));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = (x - (y * z)) / (t - (a * z))
end function
public static double code(double x, double y, double z, double t, double a) {
return (x - (y * z)) / (t - (a * z));
}
def code(x, y, z, t, a): return (x - (y * z)) / (t - (a * z))
function code(x, y, z, t, a) return Float64(Float64(x - Float64(y * z)) / Float64(t - Float64(a * z))) end
function tmp = code(x, y, z, t, a) tmp = (x - (y * z)) / (t - (a * z)); end
code[x_, y_, z_, t_, a_] := N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{x - y \cdot z}{t - a \cdot z}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (/ y (- a (/ t z))) (/ x (- (* z a) t))))
(t_2 (- x (* y z)))
(t_3 (/ t_2 (- t (* a z)))))
(if (<= t_3 -1e-5)
t_1
(if (<= t_3 2e-150) (/ 1.0 (fma a (/ z (- (* y z) x)) (/ t t_2))) t_1))))double code(double x, double y, double z, double t, double a) {
double t_1 = (y / (a - (t / z))) - (x / ((z * a) - t));
double t_2 = x - (y * z);
double t_3 = t_2 / (t - (a * z));
double tmp;
if (t_3 <= -1e-5) {
tmp = t_1;
} else if (t_3 <= 2e-150) {
tmp = 1.0 / fma(a, (z / ((y * z) - x)), (t / t_2));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(y / Float64(a - Float64(t / z))) - Float64(x / Float64(Float64(z * a) - t))) t_2 = Float64(x - Float64(y * z)) t_3 = Float64(t_2 / Float64(t - Float64(a * z))) tmp = 0.0 if (t_3 <= -1e-5) tmp = t_1; elseif (t_3 <= 2e-150) tmp = Float64(1.0 / fma(a, Float64(z / Float64(Float64(y * z) - x)), Float64(t / t_2))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / N[(N[(z * a), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 / N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -1e-5], t$95$1, If[LessEqual[t$95$3, 2e-150], N[(1.0 / N[(a * N[(z / N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] + N[(t / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
t_1 := \frac{y}{a - \frac{t}{z}} - \frac{x}{z \cdot a - t}\\
t_2 := x - y \cdot z\\
t_3 := \frac{t\_2}{t - a \cdot z}\\
\mathbf{if}\;t\_3 \leq -1 \cdot 10^{-5}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_3 \leq 2 \cdot 10^{-150}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(a, \frac{z}{y \cdot z - x}, \frac{t}{t\_2}\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -1.0000000000000001e-5 or 2e-150 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) Initial program 85.0%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
distribute-lft-inN/A
distribute-rgt-neg-outN/A
*-commutativeN/A
mult-flipN/A
distribute-neg-frac2N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
*-commutativeN/A
mult-flipN/A
lower-fma.f64N/A
Applied rewrites88.8%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6488.6%
Applied rewrites88.6%
lift-fma.f64N/A
add-flipN/A
lower--.f64N/A
*-commutativeN/A
lift-/.f64N/A
mult-flip-revN/A
lower-/.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
sub-to-fraction-revN/A
lower--.f64N/A
lower-/.f64N/A
lift-/.f64N/A
distribute-neg-frac2N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
lower-/.f6495.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6495.9%
Applied rewrites95.9%
if -1.0000000000000001e-5 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < 2e-150Initial program 85.0%
lift-/.f64N/A
frac-2negN/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
remove-double-negN/A
lift-*.f64N/A
distribute-lft-neg-outN/A
lower--.f64N/A
distribute-lft-neg-outN/A
lift-*.f64N/A
remove-double-negN/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6484.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6484.5%
Applied rewrites84.5%
lift-/.f64N/A
lift--.f64N/A
sub-flipN/A
div-addN/A
lift-*.f64N/A
associate-/l*N/A
lift--.f64N/A
sub-negate-revN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift--.f64N/A
frac-2neg-revN/A
lower-fma.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-/.f6485.7%
Applied rewrites85.7%
(FPCore (x y z t a) :precision binary64 (if (<= z -4.2e+105) (/ (- y (/ x z)) a) (if (<= z 2.7e+76) (/ (- x (* y z)) (fma (- z) a t)) (/ y (- a (/ t z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.2e+105) {
tmp = (y - (x / z)) / a;
} else if (z <= 2.7e+76) {
tmp = (x - (y * z)) / fma(-z, a, t);
} else {
tmp = y / (a - (t / z));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -4.2e+105) tmp = Float64(Float64(y - Float64(x / z)) / a); elseif (z <= 2.7e+76) tmp = Float64(Float64(x - Float64(y * z)) / fma(Float64(-z), a, t)); else tmp = Float64(y / Float64(a - Float64(t / z))); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4.2e+105], N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[z, 2.7e+76], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / N[((-z) * a + t), $MachinePrecision]), $MachinePrecision], N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \leq -4.2 \cdot 10^{+105}:\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{+76}:\\
\;\;\;\;\frac{x - y \cdot z}{\mathsf{fma}\left(-z, a, t\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a - \frac{t}{z}}\\
\end{array}
if z < -4.2000000000000002e105Initial program 85.0%
lift-/.f64N/A
frac-2negN/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
remove-double-negN/A
lift-*.f64N/A
distribute-lft-neg-outN/A
lower--.f64N/A
distribute-lft-neg-outN/A
lift-*.f64N/A
remove-double-negN/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6484.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6484.5%
Applied rewrites84.5%
Taylor expanded in t around 0
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f6440.5%
Applied rewrites40.5%
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
*-commutativeN/A
sub-to-fraction-revN/A
lower--.f64N/A
lower-/.f6451.1%
Applied rewrites51.1%
if -4.2000000000000002e105 < z < 2.6999999999999999e76Initial program 85.0%
remove-double-negN/A
lift--.f64N/A
sub-negate-revN/A
sub-flipN/A
distribute-neg-inN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
remove-double-negN/A
lower-fma.f64N/A
lower-neg.f6485.0%
Applied rewrites85.0%
if 2.6999999999999999e76 < z Initial program 85.0%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
distribute-lft-inN/A
distribute-rgt-neg-outN/A
*-commutativeN/A
mult-flipN/A
distribute-neg-frac2N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
*-commutativeN/A
mult-flipN/A
lower-fma.f64N/A
Applied rewrites88.8%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6488.6%
Applied rewrites88.6%
lift-fma.f64N/A
add-flipN/A
lower--.f64N/A
*-commutativeN/A
lift-/.f64N/A
mult-flip-revN/A
lower-/.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
sub-to-fraction-revN/A
lower--.f64N/A
lower-/.f64N/A
lift-/.f64N/A
distribute-neg-frac2N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
lower-/.f6495.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6495.9%
Applied rewrites95.9%
Taylor expanded in x around 0
lower-/.f64N/A
lower--.f64N/A
lower-/.f6453.4%
Applied rewrites53.4%
(FPCore (x y z t a) :precision binary64 (if (<= z -4.2e+105) (/ (- y (/ x z)) a) (if (<= z 2.7e+76) (/ (- x (* y z)) (- t (* a z))) (/ y (- a (/ t z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.2e+105) {
tmp = (y - (x / z)) / a;
} else if (z <= 2.7e+76) {
tmp = (x - (y * z)) / (t - (a * z));
} else {
tmp = y / (a - (t / 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 (z <= (-4.2d+105)) then
tmp = (y - (x / z)) / a
else if (z <= 2.7d+76) then
tmp = (x - (y * z)) / (t - (a * z))
else
tmp = y / (a - (t / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.2e+105) {
tmp = (y - (x / z)) / a;
} else if (z <= 2.7e+76) {
tmp = (x - (y * z)) / (t - (a * z));
} else {
tmp = y / (a - (t / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -4.2e+105: tmp = (y - (x / z)) / a elif z <= 2.7e+76: tmp = (x - (y * z)) / (t - (a * z)) else: tmp = y / (a - (t / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -4.2e+105) tmp = Float64(Float64(y - Float64(x / z)) / a); elseif (z <= 2.7e+76) tmp = Float64(Float64(x - Float64(y * z)) / Float64(t - Float64(a * z))); else tmp = Float64(y / Float64(a - Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -4.2e+105) tmp = (y - (x / z)) / a; elseif (z <= 2.7e+76) tmp = (x - (y * z)) / (t - (a * z)); else tmp = y / (a - (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4.2e+105], N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[z, 2.7e+76], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \leq -4.2 \cdot 10^{+105}:\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{+76}:\\
\;\;\;\;\frac{x - y \cdot z}{t - a \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a - \frac{t}{z}}\\
\end{array}
if z < -4.2000000000000002e105Initial program 85.0%
lift-/.f64N/A
frac-2negN/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
remove-double-negN/A
lift-*.f64N/A
distribute-lft-neg-outN/A
lower--.f64N/A
distribute-lft-neg-outN/A
lift-*.f64N/A
remove-double-negN/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6484.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6484.5%
Applied rewrites84.5%
Taylor expanded in t around 0
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f6440.5%
Applied rewrites40.5%
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
*-commutativeN/A
sub-to-fraction-revN/A
lower--.f64N/A
lower-/.f6451.1%
Applied rewrites51.1%
if -4.2000000000000002e105 < z < 2.6999999999999999e76Initial program 85.0%
if 2.6999999999999999e76 < z Initial program 85.0%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
distribute-lft-inN/A
distribute-rgt-neg-outN/A
*-commutativeN/A
mult-flipN/A
distribute-neg-frac2N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
*-commutativeN/A
mult-flipN/A
lower-fma.f64N/A
Applied rewrites88.8%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6488.6%
Applied rewrites88.6%
lift-fma.f64N/A
add-flipN/A
lower--.f64N/A
*-commutativeN/A
lift-/.f64N/A
mult-flip-revN/A
lower-/.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
sub-to-fraction-revN/A
lower--.f64N/A
lower-/.f64N/A
lift-/.f64N/A
distribute-neg-frac2N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
lower-/.f6495.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6495.9%
Applied rewrites95.9%
Taylor expanded in x around 0
lower-/.f64N/A
lower--.f64N/A
lower-/.f6453.4%
Applied rewrites53.4%
(FPCore (x y z t a) :precision binary64 (- (/ y (- a (/ t z))) (/ x (- (* z a) t))))
double code(double x, double y, double z, double t, double a) {
return (y / (a - (t / z))) - (x / ((z * a) - t));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = (y / (a - (t / z))) - (x / ((z * a) - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return (y / (a - (t / z))) - (x / ((z * a) - t));
}
def code(x, y, z, t, a): return (y / (a - (t / z))) - (x / ((z * a) - t))
function code(x, y, z, t, a) return Float64(Float64(y / Float64(a - Float64(t / z))) - Float64(x / Float64(Float64(z * a) - t))) end
function tmp = code(x, y, z, t, a) tmp = (y / (a - (t / z))) - (x / ((z * a) - t)); end
code[x_, y_, z_, t_, a_] := N[(N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / N[(N[(z * a), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{y}{a - \frac{t}{z}} - \frac{x}{z \cdot a - t}
Initial program 85.0%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
distribute-lft-inN/A
distribute-rgt-neg-outN/A
*-commutativeN/A
mult-flipN/A
distribute-neg-frac2N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
*-commutativeN/A
mult-flipN/A
lower-fma.f64N/A
Applied rewrites88.8%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6488.6%
Applied rewrites88.6%
lift-fma.f64N/A
add-flipN/A
lower--.f64N/A
*-commutativeN/A
lift-/.f64N/A
mult-flip-revN/A
lower-/.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
sub-to-fraction-revN/A
lower--.f64N/A
lower-/.f64N/A
lift-/.f64N/A
distribute-neg-frac2N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
lower-/.f6495.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6495.9%
Applied rewrites95.9%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.3e+105)
(/ (- y (/ x z)) a)
(if (<= z -1.5e-200)
(/ (- x (* y z)) t)
(if (<= z 8e-14) (/ x (fma (- z) a t)) (/ y (- a (/ t z)))))))double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.3e+105) {
tmp = (y - (x / z)) / a;
} else if (z <= -1.5e-200) {
tmp = (x - (y * z)) / t;
} else if (z <= 8e-14) {
tmp = x / fma(-z, a, t);
} else {
tmp = y / (a - (t / z));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.3e+105) tmp = Float64(Float64(y - Float64(x / z)) / a); elseif (z <= -1.5e-200) tmp = Float64(Float64(x - Float64(y * z)) / t); elseif (z <= 8e-14) tmp = Float64(x / fma(Float64(-z), a, t)); else tmp = Float64(y / Float64(a - Float64(t / z))); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.3e+105], N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[z, -1.5e-200], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 8e-14], N[(x / N[((-z) * a + t), $MachinePrecision]), $MachinePrecision], N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{+105}:\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\mathbf{elif}\;z \leq -1.5 \cdot 10^{-200}:\\
\;\;\;\;\frac{x - y \cdot z}{t}\\
\mathbf{elif}\;z \leq 8 \cdot 10^{-14}:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(-z, a, t\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a - \frac{t}{z}}\\
\end{array}
if z < -1.3000000000000001e105Initial program 85.0%
lift-/.f64N/A
frac-2negN/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
remove-double-negN/A
lift-*.f64N/A
distribute-lft-neg-outN/A
lower--.f64N/A
distribute-lft-neg-outN/A
lift-*.f64N/A
remove-double-negN/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6484.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6484.5%
Applied rewrites84.5%
Taylor expanded in t around 0
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f6440.5%
Applied rewrites40.5%
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
*-commutativeN/A
sub-to-fraction-revN/A
lower--.f64N/A
lower-/.f6451.1%
Applied rewrites51.1%
if -1.3000000000000001e105 < z < -1.5e-200Initial program 85.0%
Taylor expanded in z around 0
Applied rewrites51.0%
if -1.5e-200 < z < 8e-14Initial program 85.0%
Taylor expanded in x around inf
lower-/.f64N/A
lower--.f64N/A
lower-*.f6453.6%
Applied rewrites53.6%
lift--.f64N/A
lift-*.f64N/A
*-commutativeN/A
fp-cancel-sub-sign-invN/A
lift-neg.f64N/A
+-commutativeN/A
lift-fma.f6453.6%
Applied rewrites53.6%
if 8e-14 < z Initial program 85.0%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
distribute-lft-inN/A
distribute-rgt-neg-outN/A
*-commutativeN/A
mult-flipN/A
distribute-neg-frac2N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
*-commutativeN/A
mult-flipN/A
lower-fma.f64N/A
Applied rewrites88.8%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6488.6%
Applied rewrites88.6%
lift-fma.f64N/A
add-flipN/A
lower--.f64N/A
*-commutativeN/A
lift-/.f64N/A
mult-flip-revN/A
lower-/.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
sub-to-fraction-revN/A
lower--.f64N/A
lower-/.f64N/A
lift-/.f64N/A
distribute-neg-frac2N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
lower-/.f6495.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6495.9%
Applied rewrites95.9%
Taylor expanded in x around 0
lower-/.f64N/A
lower--.f64N/A
lower-/.f6453.4%
Applied rewrites53.4%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ y (- a (/ t z))))) (if (<= z -3.5e-52) t_1 (if (<= z 8e-14) (/ x (fma (- z) a t)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y / (a - (t / z));
double tmp;
if (z <= -3.5e-52) {
tmp = t_1;
} else if (z <= 8e-14) {
tmp = x / fma(-z, a, t);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(y / Float64(a - Float64(t / z))) tmp = 0.0 if (z <= -3.5e-52) tmp = t_1; elseif (z <= 8e-14) tmp = Float64(x / fma(Float64(-z), a, t)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.5e-52], t$95$1, If[LessEqual[z, 8e-14], N[(x / N[((-z) * a + t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \frac{y}{a - \frac{t}{z}}\\
\mathbf{if}\;z \leq -3.5 \cdot 10^{-52}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 8 \cdot 10^{-14}:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(-z, a, t\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if z < -3.5e-52 or 8e-14 < z Initial program 85.0%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
distribute-lft-inN/A
distribute-rgt-neg-outN/A
*-commutativeN/A
mult-flipN/A
distribute-neg-frac2N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
*-commutativeN/A
mult-flipN/A
lower-fma.f64N/A
Applied rewrites88.8%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6488.6%
Applied rewrites88.6%
lift-fma.f64N/A
add-flipN/A
lower--.f64N/A
*-commutativeN/A
lift-/.f64N/A
mult-flip-revN/A
lower-/.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
sub-to-fraction-revN/A
lower--.f64N/A
lower-/.f64N/A
lift-/.f64N/A
distribute-neg-frac2N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
lower-/.f6495.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6495.9%
Applied rewrites95.9%
Taylor expanded in x around 0
lower-/.f64N/A
lower--.f64N/A
lower-/.f6453.4%
Applied rewrites53.4%
if -3.5e-52 < z < 8e-14Initial program 85.0%
Taylor expanded in x around inf
lower-/.f64N/A
lower--.f64N/A
lower-*.f6453.6%
Applied rewrites53.6%
lift--.f64N/A
lift-*.f64N/A
*-commutativeN/A
fp-cancel-sub-sign-invN/A
lift-neg.f64N/A
+-commutativeN/A
lift-fma.f6453.6%
Applied rewrites53.6%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.05e+105) (/ y a) (if (<= z 1.55e+63) (/ (- x (* y z)) t) (/ y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.05e+105) {
tmp = y / a;
} else if (z <= 1.55e+63) {
tmp = (x - (y * z)) / t;
} else {
tmp = y / 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 (z <= (-1.05d+105)) then
tmp = y / a
else if (z <= 1.55d+63) then
tmp = (x - (y * z)) / t
else
tmp = y / a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.05e+105) {
tmp = y / a;
} else if (z <= 1.55e+63) {
tmp = (x - (y * z)) / t;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.05e+105: tmp = y / a elif z <= 1.55e+63: tmp = (x - (y * z)) / t else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.05e+105) tmp = Float64(y / a); elseif (z <= 1.55e+63) tmp = Float64(Float64(x - Float64(y * z)) / t); else tmp = Float64(y / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.05e+105) tmp = y / a; elseif (z <= 1.55e+63) tmp = (x - (y * z)) / t; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.05e+105], N[(y / a), $MachinePrecision], If[LessEqual[z, 1.55e+63], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \leq -1.05 \cdot 10^{+105}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 1.55 \cdot 10^{+63}:\\
\;\;\;\;\frac{x - y \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
if z < -1.05e105 or 1.55e63 < z Initial program 85.0%
Taylor expanded in z around inf
lower-/.f6435.7%
Applied rewrites35.7%
if -1.05e105 < z < 1.55e63Initial program 85.0%
Taylor expanded in z around 0
Applied rewrites51.0%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.7e+77) (/ y a) (if (<= z 2.4e+76) (/ x (- t (* a z))) (/ y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.7e+77) {
tmp = y / a;
} else if (z <= 2.4e+76) {
tmp = x / (t - (a * z));
} else {
tmp = y / 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 (z <= (-1.7d+77)) then
tmp = y / a
else if (z <= 2.4d+76) then
tmp = x / (t - (a * z))
else
tmp = y / a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.7e+77) {
tmp = y / a;
} else if (z <= 2.4e+76) {
tmp = x / (t - (a * z));
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.7e+77: tmp = y / a elif z <= 2.4e+76: tmp = x / (t - (a * z)) else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.7e+77) tmp = Float64(y / a); elseif (z <= 2.4e+76) tmp = Float64(x / Float64(t - Float64(a * z))); else tmp = Float64(y / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.7e+77) tmp = y / a; elseif (z <= 2.4e+76) tmp = x / (t - (a * z)); else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.7e+77], N[(y / a), $MachinePrecision], If[LessEqual[z, 2.4e+76], N[(x / N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / a), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \leq -1.7 \cdot 10^{+77}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 2.4 \cdot 10^{+76}:\\
\;\;\;\;\frac{x}{t - a \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
if z < -1.7e77 or 2.4e76 < z Initial program 85.0%
Taylor expanded in z around inf
lower-/.f6435.7%
Applied rewrites35.7%
if -1.7e77 < z < 2.4e76Initial program 85.0%
Taylor expanded in x around inf
lower-/.f64N/A
lower--.f64N/A
lower-*.f6453.6%
Applied rewrites53.6%
(FPCore (x y z t a) :precision binary64 (if (<= z -6e+53) (/ y a) (if (<= z 5.2e-12) (/ x t) (/ y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -6e+53) {
tmp = y / a;
} else if (z <= 5.2e-12) {
tmp = x / t;
} else {
tmp = y / 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 (z <= (-6d+53)) then
tmp = y / a
else if (z <= 5.2d-12) then
tmp = x / t
else
tmp = y / a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -6e+53) {
tmp = y / a;
} else if (z <= 5.2e-12) {
tmp = x / t;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -6e+53: tmp = y / a elif z <= 5.2e-12: tmp = x / t else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -6e+53) tmp = Float64(y / a); elseif (z <= 5.2e-12) tmp = Float64(x / t); else tmp = Float64(y / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -6e+53) tmp = y / a; elseif (z <= 5.2e-12) tmp = x / t; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -6e+53], N[(y / a), $MachinePrecision], If[LessEqual[z, 5.2e-12], N[(x / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \leq -6 \cdot 10^{+53}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{-12}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
if z < -6e53 or 5.1999999999999997e-12 < z Initial program 85.0%
Taylor expanded in z around inf
lower-/.f6435.7%
Applied rewrites35.7%
if -6e53 < z < 5.1999999999999997e-12Initial program 85.0%
Taylor expanded in z around 0
lower-/.f6435.6%
Applied rewrites35.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]
\frac{x}{t}
Initial program 85.0%
Taylor expanded in z around 0
lower-/.f6435.6%
Applied rewrites35.6%
herbie shell --seed 2025188
(FPCore (x y z t a)
:name "Diagrams.Solve.Tridiagonal:solveTriDiagonal from diagrams-solve-0.1, A"
:precision binary64
(/ (- x (* y z)) (- t (* a z))))