
(FPCore (x y z t a) :precision binary64 (- (+ x y) (/ (* (- z t) y) (- a t))))
double code(double x, double y, double z, double t, double a) {
return (x + y) - (((z - t) * y) / (a - t));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = (x + y) - (((z - t) * y) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return (x + y) - (((z - t) * y) / (a - t));
}
def code(x, y, z, t, a): return (x + y) - (((z - t) * y) / (a - t))
function code(x, y, z, t, a) return Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = (x + y) - (((z - t) * y) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (- (+ x y) (/ (* (- z t) y) (- a t))))
double code(double x, double y, double z, double t, double a) {
return (x + y) - (((z - t) * y) / (a - t));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = (x + y) - (((z - t) * y) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return (x + y) - (((z - t) * y) / (a - t));
}
def code(x, y, z, t, a): return (x + y) - (((z - t) * y) / (a - t))
function code(x, y, z, t, a) return Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = (x + y) - (((z - t) * y) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ z (- a t))) (t_2 (/ t (- a t))) (t_3 (- t_2 1.0)))
(if (<= y -1.6e+17)
(* (- (+ (- t_2 -1.0) (/ x y)) t_1) y)
(if (<= y 1.2e-87)
(- (+ x y) (/ (* (- z t) y) (- a t)))
(* (- (+ (- (/ (pow t_2 2.0) t_3) (/ 1.0 t_3)) (/ x y)) t_1) y)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = z / (a - t);
double t_2 = t / (a - t);
double t_3 = t_2 - 1.0;
double tmp;
if (y <= -1.6e+17) {
tmp = (((t_2 - -1.0) + (x / y)) - t_1) * y;
} else if (y <= 1.2e-87) {
tmp = (x + y) - (((z - t) * y) / (a - t));
} else {
tmp = ((((pow(t_2, 2.0) / t_3) - (1.0 / t_3)) + (x / y)) - t_1) * y;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = z / (a - t)
t_2 = t / (a - t)
t_3 = t_2 - 1.0d0
if (y <= (-1.6d+17)) then
tmp = (((t_2 - (-1.0d0)) + (x / y)) - t_1) * y
else if (y <= 1.2d-87) then
tmp = (x + y) - (((z - t) * y) / (a - t))
else
tmp = (((((t_2 ** 2.0d0) / t_3) - (1.0d0 / t_3)) + (x / y)) - t_1) * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = z / (a - t);
double t_2 = t / (a - t);
double t_3 = t_2 - 1.0;
double tmp;
if (y <= -1.6e+17) {
tmp = (((t_2 - -1.0) + (x / y)) - t_1) * y;
} else if (y <= 1.2e-87) {
tmp = (x + y) - (((z - t) * y) / (a - t));
} else {
tmp = ((((Math.pow(t_2, 2.0) / t_3) - (1.0 / t_3)) + (x / y)) - t_1) * y;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = z / (a - t) t_2 = t / (a - t) t_3 = t_2 - 1.0 tmp = 0 if y <= -1.6e+17: tmp = (((t_2 - -1.0) + (x / y)) - t_1) * y elif y <= 1.2e-87: tmp = (x + y) - (((z - t) * y) / (a - t)) else: tmp = ((((math.pow(t_2, 2.0) / t_3) - (1.0 / t_3)) + (x / y)) - t_1) * y return tmp
function code(x, y, z, t, a) t_1 = Float64(z / Float64(a - t)) t_2 = Float64(t / Float64(a - t)) t_3 = Float64(t_2 - 1.0) tmp = 0.0 if (y <= -1.6e+17) tmp = Float64(Float64(Float64(Float64(t_2 - -1.0) + Float64(x / y)) - t_1) * y); elseif (y <= 1.2e-87) tmp = Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))); else tmp = Float64(Float64(Float64(Float64(Float64((t_2 ^ 2.0) / t_3) - Float64(1.0 / t_3)) + Float64(x / y)) - t_1) * y); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = z / (a - t); t_2 = t / (a - t); t_3 = t_2 - 1.0; tmp = 0.0; if (y <= -1.6e+17) tmp = (((t_2 - -1.0) + (x / y)) - t_1) * y; elseif (y <= 1.2e-87) tmp = (x + y) - (((z - t) * y) / (a - t)); else tmp = (((((t_2 ^ 2.0) / t_3) - (1.0 / t_3)) + (x / y)) - t_1) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t / N[(a - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 - 1.0), $MachinePrecision]}, If[LessEqual[y, -1.6e+17], N[(N[(N[(N[(t$95$2 - -1.0), $MachinePrecision] + N[(x / y), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[y, 1.2e-87], N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(N[Power[t$95$2, 2.0], $MachinePrecision] / t$95$3), $MachinePrecision] - N[(1.0 / t$95$3), $MachinePrecision]), $MachinePrecision] + N[(x / y), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision] * y), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z}{a - t}\\
t_2 := \frac{t}{a - t}\\
t_3 := t\_2 - 1\\
\mathbf{if}\;y \leq -1.6 \cdot 10^{+17}:\\
\;\;\;\;\left(\left(\left(t\_2 - -1\right) + \frac{x}{y}\right) - t\_1\right) \cdot y\\
\mathbf{elif}\;y \leq 1.2 \cdot 10^{-87}:\\
\;\;\;\;\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(\frac{{t\_2}^{2}}{t\_3} - \frac{1}{t\_3}\right) + \frac{x}{y}\right) - t\_1\right) \cdot y\\
\end{array}
\end{array}
if y < -1.6e17Initial program 49.2%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
associate-+r+N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lift--.f6488.6
Applied rewrites88.6%
if -1.6e17 < y < 1.2e-87Initial program 97.5%
if 1.2e-87 < y Initial program 71.1%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
associate-+r+N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lift--.f6496.8
Applied rewrites96.8%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
flip-+N/A
lower-/.f64N/A
metadata-evalN/A
lower--.f64N/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lower--.f64N/A
lift-/.f64N/A
lift--.f6496.8
Applied rewrites96.8%
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-/.f64N/A
div-subN/A
lower--.f64N/A
Applied rewrites96.9%
lift-pow.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-/.f64N/A
inv-powN/A
lower-/.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f6496.9
Applied rewrites96.9%
Final simplification95.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -1.6e+17) (not (<= y 1.2e-87))) (* (- (+ (- (/ t (- a t)) -1.0) (/ x y)) (/ z (- a t))) y) (- (+ x y) (/ (* (- z t) y) (- a t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -1.6e+17) || !(y <= 1.2e-87)) {
tmp = ((((t / (a - t)) - -1.0) + (x / y)) - (z / (a - t))) * y;
} else {
tmp = (x + y) - (((z - t) * y) / (a - t));
}
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.6d+17)) .or. (.not. (y <= 1.2d-87))) then
tmp = ((((t / (a - t)) - (-1.0d0)) + (x / y)) - (z / (a - t))) * y
else
tmp = (x + y) - (((z - t) * y) / (a - t))
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.6e+17) || !(y <= 1.2e-87)) {
tmp = ((((t / (a - t)) - -1.0) + (x / y)) - (z / (a - t))) * y;
} else {
tmp = (x + y) - (((z - t) * y) / (a - t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -1.6e+17) or not (y <= 1.2e-87): tmp = ((((t / (a - t)) - -1.0) + (x / y)) - (z / (a - t))) * y else: tmp = (x + y) - (((z - t) * y) / (a - t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -1.6e+17) || !(y <= 1.2e-87)) tmp = Float64(Float64(Float64(Float64(Float64(t / Float64(a - t)) - -1.0) + Float64(x / y)) - Float64(z / Float64(a - t))) * y); else tmp = Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -1.6e+17) || ~((y <= 1.2e-87))) tmp = ((((t / (a - t)) - -1.0) + (x / y)) - (z / (a - t))) * y; else tmp = (x + y) - (((z - t) * y) / (a - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -1.6e+17], N[Not[LessEqual[y, 1.2e-87]], $MachinePrecision]], N[(N[(N[(N[(N[(t / N[(a - t), $MachinePrecision]), $MachinePrecision] - -1.0), $MachinePrecision] + N[(x / y), $MachinePrecision]), $MachinePrecision] - N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.6 \cdot 10^{+17} \lor \neg \left(y \leq 1.2 \cdot 10^{-87}\right):\\
\;\;\;\;\left(\left(\left(\frac{t}{a - t} - -1\right) + \frac{x}{y}\right) - \frac{z}{a - t}\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\\
\end{array}
\end{array}
if y < -1.6e17 or 1.2e-87 < y Initial program 60.9%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
associate-+r+N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lift--.f6493.0
Applied rewrites93.0%
if -1.6e17 < y < 1.2e-87Initial program 97.5%
Final simplification95.1%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* y (/ z (- a t))))) (if (or (<= a -1.8e+99) (not (<= a 45.0))) (- (+ x y) t_1) (- x t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * (z / (a - t));
double tmp;
if ((a <= -1.8e+99) || !(a <= 45.0)) {
tmp = (x + y) - t_1;
} else {
tmp = x - t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = y * (z / (a - t))
if ((a <= (-1.8d+99)) .or. (.not. (a <= 45.0d0))) then
tmp = (x + y) - t_1
else
tmp = x - t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = y * (z / (a - t));
double tmp;
if ((a <= -1.8e+99) || !(a <= 45.0)) {
tmp = (x + y) - t_1;
} else {
tmp = x - t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y * (z / (a - t)) tmp = 0 if (a <= -1.8e+99) or not (a <= 45.0): tmp = (x + y) - t_1 else: tmp = x - t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(y * Float64(z / Float64(a - t))) tmp = 0.0 if ((a <= -1.8e+99) || !(a <= 45.0)) tmp = Float64(Float64(x + y) - t_1); else tmp = Float64(x - t_1); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y * (z / (a - t)); tmp = 0.0; if ((a <= -1.8e+99) || ~((a <= 45.0))) tmp = (x + y) - t_1; else tmp = x - t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[a, -1.8e+99], N[Not[LessEqual[a, 45.0]], $MachinePrecision]], N[(N[(x + y), $MachinePrecision] - t$95$1), $MachinePrecision], N[(x - t$95$1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z}{a - t}\\
\mathbf{if}\;a \leq -1.8 \cdot 10^{+99} \lor \neg \left(a \leq 45\right):\\
\;\;\;\;\left(x + y\right) - t\_1\\
\mathbf{else}:\\
\;\;\;\;x - t\_1\\
\end{array}
\end{array}
if a < -1.8000000000000001e99 or 45 < a Initial program 79.2%
Taylor expanded in z around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6494.1
Applied rewrites94.1%
if -1.8000000000000001e99 < a < 45Initial program 76.7%
Taylor expanded in z around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6478.7
Applied rewrites78.7%
Taylor expanded in x around inf
Applied rewrites89.7%
Final simplification91.8%
(FPCore (x y z t a)
:precision binary64
(if (<= a -2e+126)
(+ y x)
(if (<= a -4.2e-76)
(- x (* y (/ z a)))
(if (<= a 42.0) (+ x (/ (* y z) t)) (+ y x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2e+126) {
tmp = y + x;
} else if (a <= -4.2e-76) {
tmp = x - (y * (z / a));
} else if (a <= 42.0) {
tmp = x + ((y * z) / t);
} else {
tmp = y + x;
}
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 (a <= (-2d+126)) then
tmp = y + x
else if (a <= (-4.2d-76)) then
tmp = x - (y * (z / a))
else if (a <= 42.0d0) then
tmp = x + ((y * z) / t)
else
tmp = y + x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2e+126) {
tmp = y + x;
} else if (a <= -4.2e-76) {
tmp = x - (y * (z / a));
} else if (a <= 42.0) {
tmp = x + ((y * z) / t);
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -2e+126: tmp = y + x elif a <= -4.2e-76: tmp = x - (y * (z / a)) elif a <= 42.0: tmp = x + ((y * z) / t) else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -2e+126) tmp = Float64(y + x); elseif (a <= -4.2e-76) tmp = Float64(x - Float64(y * Float64(z / a))); elseif (a <= 42.0) tmp = Float64(x + Float64(Float64(y * z) / t)); else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -2e+126) tmp = y + x; elseif (a <= -4.2e-76) tmp = x - (y * (z / a)); elseif (a <= 42.0) tmp = x + ((y * z) / t); else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -2e+126], N[(y + x), $MachinePrecision], If[LessEqual[a, -4.2e-76], N[(x - N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 42.0], N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(y + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2 \cdot 10^{+126}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;a \leq -4.2 \cdot 10^{-76}:\\
\;\;\;\;x - y \cdot \frac{z}{a}\\
\mathbf{elif}\;a \leq 42:\\
\;\;\;\;x + \frac{y \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if a < -1.99999999999999985e126 or 42 < a Initial program 79.3%
Taylor expanded in a around inf
+-commutativeN/A
lower-+.f6487.9
Applied rewrites87.9%
if -1.99999999999999985e126 < a < -4.19999999999999985e-76Initial program 71.9%
Taylor expanded in z around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6478.8
Applied rewrites78.8%
Taylor expanded in x around inf
Applied rewrites77.7%
Taylor expanded in t around 0
Applied rewrites62.5%
if -4.19999999999999985e-76 < a < 42Initial program 78.8%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
associate-+r+N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lift--.f6483.8
Applied rewrites83.8%
Taylor expanded in t around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower--.f6481.6
Applied rewrites81.6%
Taylor expanded in z around inf
lift-/.f64N/A
lift-*.f6480.7
Applied rewrites80.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -2e+126) (not (<= a 1.55e+73))) (+ y x) (- x (* y (/ z (- a t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -2e+126) || !(a <= 1.55e+73)) {
tmp = y + x;
} else {
tmp = x - (y * (z / (a - t)));
}
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 ((a <= (-2d+126)) .or. (.not. (a <= 1.55d+73))) then
tmp = y + x
else
tmp = x - (y * (z / (a - t)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -2e+126) || !(a <= 1.55e+73)) {
tmp = y + x;
} else {
tmp = x - (y * (z / (a - t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -2e+126) or not (a <= 1.55e+73): tmp = y + x else: tmp = x - (y * (z / (a - t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -2e+126) || !(a <= 1.55e+73)) tmp = Float64(y + x); else tmp = Float64(x - Float64(y * Float64(z / Float64(a - t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -2e+126) || ~((a <= 1.55e+73))) tmp = y + x; else tmp = x - (y * (z / (a - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -2e+126], N[Not[LessEqual[a, 1.55e+73]], $MachinePrecision]], N[(y + x), $MachinePrecision], N[(x - N[(y * N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2 \cdot 10^{+126} \lor \neg \left(a \leq 1.55 \cdot 10^{+73}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot \frac{z}{a - t}\\
\end{array}
\end{array}
if a < -1.99999999999999985e126 or 1.55e73 < a Initial program 79.9%
Taylor expanded in a around inf
+-commutativeN/A
lower-+.f6489.1
Applied rewrites89.1%
if -1.99999999999999985e126 < a < 1.55e73Initial program 76.6%
Taylor expanded in z around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6480.0
Applied rewrites80.0%
Taylor expanded in x around inf
Applied rewrites88.6%
Final simplification88.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -2.8e-33) (not (<= a 42.0))) (+ y x) (+ x (/ (* y z) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -2.8e-33) || !(a <= 42.0)) {
tmp = y + x;
} else {
tmp = x + ((y * z) / t);
}
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 ((a <= (-2.8d-33)) .or. (.not. (a <= 42.0d0))) then
tmp = y + x
else
tmp = x + ((y * z) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -2.8e-33) || !(a <= 42.0)) {
tmp = y + x;
} else {
tmp = x + ((y * z) / t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -2.8e-33) or not (a <= 42.0): tmp = y + x else: tmp = x + ((y * z) / t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -2.8e-33) || !(a <= 42.0)) tmp = Float64(y + x); else tmp = Float64(x + Float64(Float64(y * z) / t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -2.8e-33) || ~((a <= 42.0))) tmp = y + x; else tmp = x + ((y * z) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -2.8e-33], N[Not[LessEqual[a, 42.0]], $MachinePrecision]], N[(y + x), $MachinePrecision], N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.8 \cdot 10^{-33} \lor \neg \left(a \leq 42\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot z}{t}\\
\end{array}
\end{array}
if a < -2.8e-33 or 42 < a Initial program 78.2%
Taylor expanded in a around inf
+-commutativeN/A
lower-+.f6479.7
Applied rewrites79.7%
if -2.8e-33 < a < 42Initial program 77.6%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
associate-+r+N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift--.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lift--.f6481.7
Applied rewrites81.7%
Taylor expanded in t around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower--.f6480.1
Applied rewrites80.1%
Taylor expanded in z around inf
lift-/.f64N/A
lift-*.f6476.4
Applied rewrites76.4%
Final simplification78.3%
(FPCore (x y z t a) :precision binary64 (if (<= x -5500000000000.0) x (if (<= x 7.5e-94) y x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -5500000000000.0) {
tmp = x;
} else if (x <= 7.5e-94) {
tmp = y;
} else {
tmp = x;
}
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 (x <= (-5500000000000.0d0)) then
tmp = x
else if (x <= 7.5d-94) then
tmp = y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -5500000000000.0) {
tmp = x;
} else if (x <= 7.5e-94) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -5500000000000.0: tmp = x elif x <= 7.5e-94: tmp = y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -5500000000000.0) tmp = x; elseif (x <= 7.5e-94) tmp = y; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -5500000000000.0) tmp = x; elseif (x <= 7.5e-94) tmp = y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -5500000000000.0], x, If[LessEqual[x, 7.5e-94], y, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5500000000000:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{-94}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -5.5e12 or 7.5000000000000003e-94 < x Initial program 82.4%
Taylor expanded in x around inf
Applied rewrites74.8%
if -5.5e12 < x < 7.5000000000000003e-94Initial program 71.4%
Taylor expanded in x around 0
*-commutativeN/A
lower--.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6465.4
Applied rewrites65.4%
Taylor expanded in a around inf
Applied rewrites38.4%
(FPCore (x y z t a) :precision binary64 (if (<= t 1.85e+200) (+ y x) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 1.85e+200) {
tmp = y + x;
} else {
tmp = x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (t <= 1.85d+200) then
tmp = y + x
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 1.85e+200) {
tmp = y + x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 1.85e+200: tmp = y + x else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 1.85e+200) tmp = Float64(y + x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 1.85e+200) tmp = y + x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 1.85e+200], N[(y + x), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.85 \cdot 10^{+200}:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < 1.8500000000000001e200Initial program 81.0%
Taylor expanded in a around inf
+-commutativeN/A
lower-+.f6468.4
Applied rewrites68.4%
if 1.8500000000000001e200 < t Initial program 39.3%
Taylor expanded in x around inf
Applied rewrites69.2%
(FPCore (x y z t a) :precision binary64 x)
double code(double x, double y, double z, double t, double a) {
return 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
end function
public static double code(double x, double y, double z, double t, double a) {
return x;
}
def code(x, y, z, t, a): return x
function code(x, y, z, t, a) return x end
function tmp = code(x, y, z, t, a) tmp = x; end
code[x_, y_, z_, t_, a_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 77.9%
Taylor expanded in x around inf
Applied rewrites51.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (+ y x) (* (* (- z t) (/ 1.0 (- a t))) y)))
(t_2 (- (+ x y) (/ (* (- z t) y) (- a t)))))
(if (< t_2 -1.3664970889390727e-7)
t_1
(if (< t_2 1.4754293444577233e-239)
(/ (- (* y (- a z)) (* x t)) (- a t))
t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y + x) - (((z - t) * (1.0 / (a - t))) * y);
double t_2 = (x + y) - (((z - t) * y) / (a - t));
double tmp;
if (t_2 < -1.3664970889390727e-7) {
tmp = t_1;
} else if (t_2 < 1.4754293444577233e-239) {
tmp = ((y * (a - z)) - (x * t)) / (a - 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) :: t_2
real(8) :: tmp
t_1 = (y + x) - (((z - t) * (1.0d0 / (a - t))) * y)
t_2 = (x + y) - (((z - t) * y) / (a - t))
if (t_2 < (-1.3664970889390727d-7)) then
tmp = t_1
else if (t_2 < 1.4754293444577233d-239) then
tmp = ((y * (a - z)) - (x * t)) / (a - 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) - (((z - t) * (1.0 / (a - t))) * y);
double t_2 = (x + y) - (((z - t) * y) / (a - t));
double tmp;
if (t_2 < -1.3664970889390727e-7) {
tmp = t_1;
} else if (t_2 < 1.4754293444577233e-239) {
tmp = ((y * (a - z)) - (x * t)) / (a - t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y + x) - (((z - t) * (1.0 / (a - t))) * y) t_2 = (x + y) - (((z - t) * y) / (a - t)) tmp = 0 if t_2 < -1.3664970889390727e-7: tmp = t_1 elif t_2 < 1.4754293444577233e-239: tmp = ((y * (a - z)) - (x * t)) / (a - t) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y + x) - Float64(Float64(Float64(z - t) * Float64(1.0 / Float64(a - t))) * y)) t_2 = Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))) tmp = 0.0 if (t_2 < -1.3664970889390727e-7) tmp = t_1; elseif (t_2 < 1.4754293444577233e-239) tmp = Float64(Float64(Float64(y * Float64(a - z)) - Float64(x * t)) / Float64(a - t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y + x) - (((z - t) * (1.0 / (a - t))) * y); t_2 = (x + y) - (((z - t) * y) / (a - t)); tmp = 0.0; if (t_2 < -1.3664970889390727e-7) tmp = t_1; elseif (t_2 < 1.4754293444577233e-239) tmp = ((y * (a - z)) - (x * t)) / (a - t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y + x), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * N[(1.0 / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$2, -1.3664970889390727e-7], t$95$1, If[Less[t$95$2, 1.4754293444577233e-239], N[(N[(N[(y * N[(a - z), $MachinePrecision]), $MachinePrecision] - N[(x * t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y + x\right) - \left(\left(z - t\right) \cdot \frac{1}{a - t}\right) \cdot y\\
t_2 := \left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\\
\mathbf{if}\;t\_2 < -1.3664970889390727 \cdot 10^{-7}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 < 1.4754293444577233 \cdot 10^{-239}:\\
\;\;\;\;\frac{y \cdot \left(a - z\right) - x \cdot t}{a - t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2025064
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, B"
:precision binary64
:alt
(! :herbie-platform default (if (< (- (+ x y) (/ (* (- z t) y) (- a t))) -13664970889390727/100000000000000000000000) (- (+ y x) (* (* (- z t) (/ 1 (- a t))) y)) (if (< (- (+ x y) (/ (* (- z t) y) (- a t))) 14754293444577233/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (/ (- (* y (- a z)) (* x t)) (- a t)) (- (+ y x) (* (* (- z t) (/ 1 (- a t))) y)))))
(- (+ x y) (/ (* (- z t) y) (- a t))))