
(FPCore (x y z t) :precision binary64 (+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5)))
double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * ((((y + z) + z) + y) + t)) + (y * 5.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
def code(x, y, z, t): return (x * ((((y + z) + z) + y) + t)) + (y * 5.0)
function code(x, y, z, t) return Float64(Float64(x * Float64(Float64(Float64(Float64(y + z) + z) + y) + t)) + Float64(y * 5.0)) end
function tmp = code(x, y, z, t) tmp = (x * ((((y + z) + z) + y) + t)) + (y * 5.0); end
code[x_, y_, z_, t_] := N[(N[(x * N[(N[(N[(N[(y + z), $MachinePrecision] + z), $MachinePrecision] + y), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] + N[(y * 5), $MachinePrecision]), $MachinePrecision]
x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5)))
double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * ((((y + z) + z) + y) + t)) + (y * 5.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
def code(x, y, z, t): return (x * ((((y + z) + z) + y) + t)) + (y * 5.0)
function code(x, y, z, t) return Float64(Float64(x * Float64(Float64(Float64(Float64(y + z) + z) + y) + t)) + Float64(y * 5.0)) end
function tmp = code(x, y, z, t) tmp = (x * ((((y + z) + z) + y) + t)) + (y * 5.0); end
code[x_, y_, z_, t_] := N[(N[(x * N[(N[(N[(N[(y + z), $MachinePrecision] + z), $MachinePrecision] + y), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] + N[(y * 5), $MachinePrecision]), $MachinePrecision]
x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5
(FPCore (x y z t) :precision binary64 (+ (* x (+ (+ (+ (+ z y) y) z) t)) (* y 5)))
double code(double x, double y, double z, double t) {
return (x * ((((z + y) + y) + z) + t)) + (y * 5.0);
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * ((((z + y) + y) + z) + t)) + (y * 5.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x * ((((z + y) + y) + z) + t)) + (y * 5.0);
}
def code(x, y, z, t): return (x * ((((z + y) + y) + z) + t)) + (y * 5.0)
function code(x, y, z, t) return Float64(Float64(x * Float64(Float64(Float64(Float64(z + y) + y) + z) + t)) + Float64(y * 5.0)) end
function tmp = code(x, y, z, t) tmp = (x * ((((z + y) + y) + z) + t)) + (y * 5.0); end
code[x_, y_, z_, t_] := N[(N[(x * N[(N[(N[(N[(z + y), $MachinePrecision] + y), $MachinePrecision] + z), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] + N[(y * 5), $MachinePrecision]), $MachinePrecision]
x \cdot \left(\left(\left(\left(z + y\right) + y\right) + z\right) + t\right) + y \cdot 5
Initial program 99.9%
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
associate-+r+N/A
lower-+.f64N/A
lower-+.f6499.9%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9%
Applied rewrites99.9%
(FPCore (x y z t) :precision binary64 (- (* (+ t (* 2 (+ z y))) x) (* -5 y)))
double code(double x, double y, double z, double t) {
return ((t + (2.0 * (z + y))) * x) - (-5.0 * y);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((t + (2.0d0 * (z + y))) * x) - ((-5.0d0) * y)
end function
public static double code(double x, double y, double z, double t) {
return ((t + (2.0 * (z + y))) * x) - (-5.0 * y);
}
def code(x, y, z, t): return ((t + (2.0 * (z + y))) * x) - (-5.0 * y)
function code(x, y, z, t) return Float64(Float64(Float64(t + Float64(2.0 * Float64(z + y))) * x) - Float64(-5.0 * y)) end
function tmp = code(x, y, z, t) tmp = ((t + (2.0 * (z + y))) * x) - (-5.0 * y); end
code[x_, y_, z_, t_] := N[(N[(N[(t + N[(2 * N[(z + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] - N[(-5 * y), $MachinePrecision]), $MachinePrecision]
\left(t + 2 \cdot \left(z + y\right)\right) \cdot x - -5 \cdot y
Initial program 99.9%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
count-2N/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
Applied rewrites99.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (+ t (* 2 (+ y z))))))
(if (<= x -5)
t_1
(if (<= x 360) (+ (* x (+ (+ (+ z z) y) t)) (* y 5)) t_1))))double code(double x, double y, double z, double t) {
double t_1 = x * (t + (2.0 * (y + z)));
double tmp;
if (x <= -5.0) {
tmp = t_1;
} else if (x <= 360.0) {
tmp = (x * (((z + z) + y) + t)) + (y * 5.0);
} 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)
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) :: t_1
real(8) :: tmp
t_1 = x * (t + (2.0d0 * (y + z)))
if (x <= (-5.0d0)) then
tmp = t_1
else if (x <= 360.0d0) then
tmp = (x * (((z + z) + y) + t)) + (y * 5.0d0)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (t + (2.0 * (y + z)));
double tmp;
if (x <= -5.0) {
tmp = t_1;
} else if (x <= 360.0) {
tmp = (x * (((z + z) + y) + t)) + (y * 5.0);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t + (2.0 * (y + z))) tmp = 0 if x <= -5.0: tmp = t_1 elif x <= 360.0: tmp = (x * (((z + z) + y) + t)) + (y * 5.0) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t + Float64(2.0 * Float64(y + z)))) tmp = 0.0 if (x <= -5.0) tmp = t_1; elseif (x <= 360.0) tmp = Float64(Float64(x * Float64(Float64(Float64(z + z) + y) + t)) + Float64(y * 5.0)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t + (2.0 * (y + z))); tmp = 0.0; if (x <= -5.0) tmp = t_1; elseif (x <= 360.0) tmp = (x * (((z + z) + y) + t)) + (y * 5.0); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t + N[(2 * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -5], t$95$1, If[LessEqual[x, 360], N[(N[(x * N[(N[(N[(z + z), $MachinePrecision] + y), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] + N[(y * 5), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := x \cdot \left(t + 2 \cdot \left(y + z\right)\right)\\
\mathbf{if}\;x \leq -5:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 360:\\
\;\;\;\;x \cdot \left(\left(\left(z + z\right) + y\right) + t\right) + y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if x < -5 or 360 < x Initial program 99.9%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
count-2N/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
Applied rewrites99.9%
Taylor expanded in x around inf
lower-*.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f6488.8%
Applied rewrites88.8%
Taylor expanded in x around inf
lower-*.f64N/A
lower-+.f6472.7%
Applied rewrites72.7%
if -5 < x < 360Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites93.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (+ t (* 2 (+ y z))))))
(if (<= x -1600000000)
t_1
(if (<= x 370) (+ (* x (+ t (* 2 z))) (* y 5)) t_1))))double code(double x, double y, double z, double t) {
double t_1 = x * (t + (2.0 * (y + z)));
double tmp;
if (x <= -1600000000.0) {
tmp = t_1;
} else if (x <= 370.0) {
tmp = (x * (t + (2.0 * z))) + (y * 5.0);
} 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)
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) :: t_1
real(8) :: tmp
t_1 = x * (t + (2.0d0 * (y + z)))
if (x <= (-1600000000.0d0)) then
tmp = t_1
else if (x <= 370.0d0) then
tmp = (x * (t + (2.0d0 * z))) + (y * 5.0d0)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (t + (2.0 * (y + z)));
double tmp;
if (x <= -1600000000.0) {
tmp = t_1;
} else if (x <= 370.0) {
tmp = (x * (t + (2.0 * z))) + (y * 5.0);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t + (2.0 * (y + z))) tmp = 0 if x <= -1600000000.0: tmp = t_1 elif x <= 370.0: tmp = (x * (t + (2.0 * z))) + (y * 5.0) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t + Float64(2.0 * Float64(y + z)))) tmp = 0.0 if (x <= -1600000000.0) tmp = t_1; elseif (x <= 370.0) tmp = Float64(Float64(x * Float64(t + Float64(2.0 * z))) + Float64(y * 5.0)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t + (2.0 * (y + z))); tmp = 0.0; if (x <= -1600000000.0) tmp = t_1; elseif (x <= 370.0) tmp = (x * (t + (2.0 * z))) + (y * 5.0); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t + N[(2 * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1600000000], t$95$1, If[LessEqual[x, 370], N[(N[(x * N[(t + N[(2 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * 5), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := x \cdot \left(t + 2 \cdot \left(y + z\right)\right)\\
\mathbf{if}\;x \leq -1600000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 370:\\
\;\;\;\;x \cdot \left(t + 2 \cdot z\right) + y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if x < -1.6e9 or 370 < x Initial program 99.9%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
count-2N/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
Applied rewrites99.9%
Taylor expanded in x around inf
lower-*.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f6488.8%
Applied rewrites88.8%
Taylor expanded in x around inf
lower-*.f64N/A
lower-+.f6472.7%
Applied rewrites72.7%
if -1.6e9 < x < 370Initial program 99.9%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f6484.6%
Applied rewrites84.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (+ t (* 2 (+ y z))))))
(if (<=
x
-7716728645107167/5846006549323611672814739330865132078623730171904)
t_1
(if (<= x 6600000000) (- (* (+ (+ y y) t) x) (* -5 y)) t_1))))double code(double x, double y, double z, double t) {
double t_1 = x * (t + (2.0 * (y + z)));
double tmp;
if (x <= -1.32e-33) {
tmp = t_1;
} else if (x <= 6600000000.0) {
tmp = (((y + y) + t) * x) - (-5.0 * y);
} 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)
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) :: t_1
real(8) :: tmp
t_1 = x * (t + (2.0d0 * (y + z)))
if (x <= (-1.32d-33)) then
tmp = t_1
else if (x <= 6600000000.0d0) then
tmp = (((y + y) + t) * x) - ((-5.0d0) * y)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (t + (2.0 * (y + z)));
double tmp;
if (x <= -1.32e-33) {
tmp = t_1;
} else if (x <= 6600000000.0) {
tmp = (((y + y) + t) * x) - (-5.0 * y);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t + (2.0 * (y + z))) tmp = 0 if x <= -1.32e-33: tmp = t_1 elif x <= 6600000000.0: tmp = (((y + y) + t) * x) - (-5.0 * y) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t + Float64(2.0 * Float64(y + z)))) tmp = 0.0 if (x <= -1.32e-33) tmp = t_1; elseif (x <= 6600000000.0) tmp = Float64(Float64(Float64(Float64(y + y) + t) * x) - Float64(-5.0 * y)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t + (2.0 * (y + z))); tmp = 0.0; if (x <= -1.32e-33) tmp = t_1; elseif (x <= 6600000000.0) tmp = (((y + y) + t) * x) - (-5.0 * y); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t + N[(2 * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -7716728645107167/5846006549323611672814739330865132078623730171904], t$95$1, If[LessEqual[x, 6600000000], N[(N[(N[(N[(y + y), $MachinePrecision] + t), $MachinePrecision] * x), $MachinePrecision] - N[(-5 * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := x \cdot \left(t + 2 \cdot \left(y + z\right)\right)\\
\mathbf{if}\;x \leq \frac{-7716728645107167}{5846006549323611672814739330865132078623730171904}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 6600000000:\\
\;\;\;\;\left(\left(y + y\right) + t\right) \cdot x - -5 \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if x < -1.3199999999999999e-33 or 6.6e9 < x Initial program 99.9%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
count-2N/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
Applied rewrites99.9%
Taylor expanded in x around inf
lower-*.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f6488.8%
Applied rewrites88.8%
Taylor expanded in x around inf
lower-*.f64N/A
lower-+.f6472.7%
Applied rewrites72.7%
if -1.3199999999999999e-33 < x < 6.6e9Initial program 99.9%
Taylor expanded in y around inf
lower-*.f6473.3%
Applied rewrites73.3%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
lift-*.f64N/A
lower--.f6473.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6473.3%
lift-*.f64N/A
count-2-revN/A
lower-+.f6473.3%
Applied rewrites73.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (+ t (* 2 (+ y z))))))
(if (<=
x
-7716728645107167/5846006549323611672814739330865132078623730171904)
t_1
(if (<= x 3400) (+ (* t x) (* y 5)) t_1))))double code(double x, double y, double z, double t) {
double t_1 = x * (t + (2.0 * (y + z)));
double tmp;
if (x <= -1.32e-33) {
tmp = t_1;
} else if (x <= 3400.0) {
tmp = (t * x) + (y * 5.0);
} 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)
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) :: t_1
real(8) :: tmp
t_1 = x * (t + (2.0d0 * (y + z)))
if (x <= (-1.32d-33)) then
tmp = t_1
else if (x <= 3400.0d0) then
tmp = (t * x) + (y * 5.0d0)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (t + (2.0 * (y + z)));
double tmp;
if (x <= -1.32e-33) {
tmp = t_1;
} else if (x <= 3400.0) {
tmp = (t * x) + (y * 5.0);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t + (2.0 * (y + z))) tmp = 0 if x <= -1.32e-33: tmp = t_1 elif x <= 3400.0: tmp = (t * x) + (y * 5.0) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t + Float64(2.0 * Float64(y + z)))) tmp = 0.0 if (x <= -1.32e-33) tmp = t_1; elseif (x <= 3400.0) tmp = Float64(Float64(t * x) + Float64(y * 5.0)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t + (2.0 * (y + z))); tmp = 0.0; if (x <= -1.32e-33) tmp = t_1; elseif (x <= 3400.0) tmp = (t * x) + (y * 5.0); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t + N[(2 * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -7716728645107167/5846006549323611672814739330865132078623730171904], t$95$1, If[LessEqual[x, 3400], N[(N[(t * x), $MachinePrecision] + N[(y * 5), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := x \cdot \left(t + 2 \cdot \left(y + z\right)\right)\\
\mathbf{if}\;x \leq \frac{-7716728645107167}{5846006549323611672814739330865132078623730171904}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 3400:\\
\;\;\;\;t \cdot x + y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if x < -1.3199999999999999e-33 or 3400 < x Initial program 99.9%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
count-2N/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
Applied rewrites99.9%
Taylor expanded in x around inf
lower-*.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f6488.8%
Applied rewrites88.8%
Taylor expanded in x around inf
lower-*.f64N/A
lower-+.f6472.7%
Applied rewrites72.7%
if -1.3199999999999999e-33 < x < 3400Initial program 99.9%
Taylor expanded in t around inf
lower-*.f6457.2%
Applied rewrites57.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- (+ x x) -5) y)))
(if (<= y -3984496719921263/147573952589676412928)
t_1
(if (<=
y
135000000000000004850604486226195539359797635277641641055901100892353001764058090011880924581106113590851534848)
(* x (+ t (* 2 z)))
t_1))))double code(double x, double y, double z, double t) {
double t_1 = ((x + x) - -5.0) * y;
double tmp;
if (y <= -2.7e-5) {
tmp = t_1;
} else if (y <= 1.35e+110) {
tmp = x * (t + (2.0 * z));
} 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)
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) :: t_1
real(8) :: tmp
t_1 = ((x + x) - (-5.0d0)) * y
if (y <= (-2.7d-5)) then
tmp = t_1
else if (y <= 1.35d+110) then
tmp = x * (t + (2.0d0 * z))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = ((x + x) - -5.0) * y;
double tmp;
if (y <= -2.7e-5) {
tmp = t_1;
} else if (y <= 1.35e+110) {
tmp = x * (t + (2.0 * z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = ((x + x) - -5.0) * y tmp = 0 if y <= -2.7e-5: tmp = t_1 elif y <= 1.35e+110: tmp = x * (t + (2.0 * z)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(Float64(x + x) - -5.0) * y) tmp = 0.0 if (y <= -2.7e-5) tmp = t_1; elseif (y <= 1.35e+110) tmp = Float64(x * Float64(t + Float64(2.0 * z))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = ((x + x) - -5.0) * y; tmp = 0.0; if (y <= -2.7e-5) tmp = t_1; elseif (y <= 1.35e+110) tmp = x * (t + (2.0 * z)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(x + x), $MachinePrecision] - -5), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -3984496719921263/147573952589676412928], t$95$1, If[LessEqual[y, 135000000000000004850604486226195539359797635277641641055901100892353001764058090011880924581106113590851534848], N[(x * N[(t + N[(2 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \left(\left(x + x\right) - -5\right) \cdot y\\
\mathbf{if}\;y \leq \frac{-3984496719921263}{147573952589676412928}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 135000000000000004850604486226195539359797635277641641055901100892353001764058090011880924581106113590851534848:\\
\;\;\;\;x \cdot \left(t + 2 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if y < -2.6999999999999999e-5 or 1.35e110 < y Initial program 99.9%
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
associate-+r+N/A
lower-+.f64N/A
lower-+.f6499.9%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9%
Applied rewrites99.9%
Taylor expanded in y around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6447.0%
Applied rewrites47.0%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6447.0%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6447.0%
lift-*.f64N/A
count-2-revN/A
lower-+.f6447.0%
Applied rewrites47.0%
if -2.6999999999999999e-5 < y < 1.35e110Initial program 99.9%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
count-2N/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
Applied rewrites99.9%
Taylor expanded in x around inf
lower-*.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f6488.8%
Applied rewrites88.8%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f6457.9%
Applied rewrites57.9%
(FPCore (x y z t) :precision binary64 (* (- (+ x x) -5) y))
double code(double x, double y, double z, double t) {
return ((x + x) - -5.0) * y;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x + x) - (-5.0d0)) * y
end function
public static double code(double x, double y, double z, double t) {
return ((x + x) - -5.0) * y;
}
def code(x, y, z, t): return ((x + x) - -5.0) * y
function code(x, y, z, t) return Float64(Float64(Float64(x + x) - -5.0) * y) end
function tmp = code(x, y, z, t) tmp = ((x + x) - -5.0) * y; end
code[x_, y_, z_, t_] := N[(N[(N[(x + x), $MachinePrecision] - -5), $MachinePrecision] * y), $MachinePrecision]
\left(\left(x + x\right) - -5\right) \cdot y
Initial program 99.9%
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
associate-+r+N/A
lower-+.f64N/A
lower-+.f6499.9%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9%
Applied rewrites99.9%
Taylor expanded in y around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6447.0%
Applied rewrites47.0%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6447.0%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6447.0%
lift-*.f64N/A
count-2-revN/A
lower-+.f6447.0%
Applied rewrites47.0%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (+ y y) x))) (if (<= x -1850000000) t_1 (if (<= x 3400) (* 5 y) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (y + y) * x;
double tmp;
if (x <= -1850000000.0) {
tmp = t_1;
} else if (x <= 3400.0) {
tmp = 5.0 * y;
} 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)
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) :: t_1
real(8) :: tmp
t_1 = (y + y) * x
if (x <= (-1850000000.0d0)) then
tmp = t_1
else if (x <= 3400.0d0) then
tmp = 5.0d0 * y
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (y + y) * x;
double tmp;
if (x <= -1850000000.0) {
tmp = t_1;
} else if (x <= 3400.0) {
tmp = 5.0 * y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y + y) * x tmp = 0 if x <= -1850000000.0: tmp = t_1 elif x <= 3400.0: tmp = 5.0 * y else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y + y) * x) tmp = 0.0 if (x <= -1850000000.0) tmp = t_1; elseif (x <= 3400.0) tmp = Float64(5.0 * y); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y + y) * x; tmp = 0.0; if (x <= -1850000000.0) tmp = t_1; elseif (x <= 3400.0) tmp = 5.0 * y; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y + y), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -1850000000], t$95$1, If[LessEqual[x, 3400], N[(5 * y), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \left(y + y\right) \cdot x\\
\mathbf{if}\;x \leq -1850000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 3400:\\
\;\;\;\;5 \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if x < -1.85e9 or 3400 < x Initial program 99.9%
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
associate-+r+N/A
lower-+.f64N/A
lower-+.f6499.9%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9%
Applied rewrites99.9%
Taylor expanded in y around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6447.0%
Applied rewrites47.0%
Taylor expanded in x around inf
lower-*.f64N/A
lower-*.f6420.5%
Applied rewrites20.5%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lower-+.f6420.5%
Applied rewrites20.5%
if -1.85e9 < x < 3400Initial program 99.9%
Taylor expanded in x around 0
lower-*.f6428.8%
Applied rewrites28.8%
(FPCore (x y z t) :precision binary64 (* 5 y))
double code(double x, double y, double z, double t) {
return 5.0 * y;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 5.0d0 * y
end function
public static double code(double x, double y, double z, double t) {
return 5.0 * y;
}
def code(x, y, z, t): return 5.0 * y
function code(x, y, z, t) return Float64(5.0 * y) end
function tmp = code(x, y, z, t) tmp = 5.0 * y; end
code[x_, y_, z_, t_] := N[(5 * y), $MachinePrecision]
5 \cdot y
Initial program 99.9%
Taylor expanded in x around 0
lower-*.f6428.8%
Applied rewrites28.8%
herbie shell --seed 2025271 -o generate:evaluate
(FPCore (x y z t)
:name "Graphics.Rendering.Plot.Render.Plot.Legend:renderLegendOutside from plot-0.2.3.4, B"
:precision binary64
(+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5)))