
(FPCore (x y) :precision binary64 (- (* (+ x 1.0) y) x))
double code(double x, double y) {
return ((x + 1.0) * y) - 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((x + 1.0d0) * y) - x
end function
public static double code(double x, double y) {
return ((x + 1.0) * y) - x;
}
def code(x, y): return ((x + 1.0) * y) - x
function code(x, y) return Float64(Float64(Float64(x + 1.0) * y) - x) end
function tmp = code(x, y) tmp = ((x + 1.0) * y) - x; end
code[x_, y_] := N[(N[(N[(x + 1.0), $MachinePrecision] * y), $MachinePrecision] - x), $MachinePrecision]
\begin{array}{l}
\\
\left(x + 1\right) \cdot y - x
\end{array}
Herbie found 7 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (- (* (+ x 1.0) y) x))
double code(double x, double y) {
return ((x + 1.0) * y) - 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((x + 1.0d0) * y) - x
end function
public static double code(double x, double y) {
return ((x + 1.0) * y) - x;
}
def code(x, y): return ((x + 1.0) * y) - x
function code(x, y) return Float64(Float64(Float64(x + 1.0) * y) - x) end
function tmp = code(x, y) tmp = ((x + 1.0) * y) - x; end
code[x_, y_] := N[(N[(N[(x + 1.0), $MachinePrecision] * y), $MachinePrecision] - x), $MachinePrecision]
\begin{array}{l}
\\
\left(x + 1\right) \cdot y - x
\end{array}
(FPCore (x y) :precision binary64 (- (* (+ x 1.0) y) x))
double code(double x, double y) {
return ((x + 1.0) * y) - 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((x + 1.0d0) * y) - x
end function
public static double code(double x, double y) {
return ((x + 1.0) * y) - x;
}
def code(x, y): return ((x + 1.0) * y) - x
function code(x, y) return Float64(Float64(Float64(x + 1.0) * y) - x) end
function tmp = code(x, y) tmp = ((x + 1.0) * y) - x; end
code[x_, y_] := N[(N[(N[(x + 1.0), $MachinePrecision] * y), $MachinePrecision] - x), $MachinePrecision]
\begin{array}{l}
\\
\left(x + 1\right) \cdot y - x
\end{array}
Initial program 100.0%
(FPCore (x y) :precision binary64 (let* ((t_0 (* (- y 1.0) x))) (if (<= x -1.0) t_0 (if (<= x 3.2e-5) (- y x) t_0))))
double code(double x, double y) {
double t_0 = (y - 1.0) * x;
double tmp;
if (x <= -1.0) {
tmp = t_0;
} else if (x <= 3.2e-5) {
tmp = y - x;
} else {
tmp = t_0;
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = (y - 1.0d0) * x
if (x <= (-1.0d0)) then
tmp = t_0
else if (x <= 3.2d-5) then
tmp = y - x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (y - 1.0) * x;
double tmp;
if (x <= -1.0) {
tmp = t_0;
} else if (x <= 3.2e-5) {
tmp = y - x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = (y - 1.0) * x tmp = 0 if x <= -1.0: tmp = t_0 elif x <= 3.2e-5: tmp = y - x else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(Float64(y - 1.0) * x) tmp = 0.0 if (x <= -1.0) tmp = t_0; elseif (x <= 3.2e-5) tmp = Float64(y - x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = (y - 1.0) * x; tmp = 0.0; if (x <= -1.0) tmp = t_0; elseif (x <= 3.2e-5) tmp = y - x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(y - 1.0), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -1.0], t$95$0, If[LessEqual[x, 3.2e-5], N[(y - x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(y - 1\right) \cdot x\\
\mathbf{if}\;x \leq -1:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 3.2 \cdot 10^{-5}:\\
\;\;\;\;y - x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1 or 3.19999999999999986e-5 < x Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6498.3
Applied rewrites98.3%
if -1 < x < 3.19999999999999986e-5Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites99.1%
(FPCore (x y) :precision binary64 (if (<= y -720000000000.0) (fma y x y) (if (<= y 1.0) (- y x) (fma y x y))))
double code(double x, double y) {
double tmp;
if (y <= -720000000000.0) {
tmp = fma(y, x, y);
} else if (y <= 1.0) {
tmp = y - x;
} else {
tmp = fma(y, x, y);
}
return tmp;
}
function code(x, y) tmp = 0.0 if (y <= -720000000000.0) tmp = fma(y, x, y); elseif (y <= 1.0) tmp = Float64(y - x); else tmp = fma(y, x, y); end return tmp end
code[x_, y_] := If[LessEqual[y, -720000000000.0], N[(y * x + y), $MachinePrecision], If[LessEqual[y, 1.0], N[(y - x), $MachinePrecision], N[(y * x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -720000000000:\\
\;\;\;\;\mathsf{fma}\left(y, x, y\right)\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;y - x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, x, y\right)\\
\end{array}
\end{array}
if y < -7.2e11 or 1 < y Initial program 100.0%
Taylor expanded in y around inf
+-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
*-lft-identityN/A
lower-fma.f6499.4
Applied rewrites99.4%
if -7.2e11 < y < 1Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites98.1%
(FPCore (x y) :precision binary64 (let* ((t_0 (- (* (+ x 1.0) y) x))) (if (<= t_0 -2e+288) (* y x) (if (<= t_0 2e+307) (- y x) (* y x)))))
double code(double x, double y) {
double t_0 = ((x + 1.0) * y) - x;
double tmp;
if (t_0 <= -2e+288) {
tmp = y * x;
} else if (t_0 <= 2e+307) {
tmp = y - x;
} 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = ((x + 1.0d0) * y) - x
if (t_0 <= (-2d+288)) then
tmp = y * x
else if (t_0 <= 2d+307) then
tmp = y - x
else
tmp = y * x
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = ((x + 1.0) * y) - x;
double tmp;
if (t_0 <= -2e+288) {
tmp = y * x;
} else if (t_0 <= 2e+307) {
tmp = y - x;
} else {
tmp = y * x;
}
return tmp;
}
def code(x, y): t_0 = ((x + 1.0) * y) - x tmp = 0 if t_0 <= -2e+288: tmp = y * x elif t_0 <= 2e+307: tmp = y - x else: tmp = y * x return tmp
function code(x, y) t_0 = Float64(Float64(Float64(x + 1.0) * y) - x) tmp = 0.0 if (t_0 <= -2e+288) tmp = Float64(y * x); elseif (t_0 <= 2e+307) tmp = Float64(y - x); else tmp = Float64(y * x); end return tmp end
function tmp_2 = code(x, y) t_0 = ((x + 1.0) * y) - x; tmp = 0.0; if (t_0 <= -2e+288) tmp = y * x; elseif (t_0 <= 2e+307) tmp = y - x; else tmp = y * x; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[(x + 1.0), $MachinePrecision] * y), $MachinePrecision] - x), $MachinePrecision]}, If[LessEqual[t$95$0, -2e+288], N[(y * x), $MachinePrecision], If[LessEqual[t$95$0, 2e+307], N[(y - x), $MachinePrecision], N[(y * x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x + 1\right) \cdot y - x\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{+288}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+307}:\\
\;\;\;\;y - x\\
\mathbf{else}:\\
\;\;\;\;y \cdot x\\
\end{array}
\end{array}
if (-.f64 (*.f64 (+.f64 x #s(literal 1 binary64)) y) x) < -2e288 or 1.99999999999999997e307 < (-.f64 (*.f64 (+.f64 x #s(literal 1 binary64)) y) x) Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6494.8
Applied rewrites94.8%
Taylor expanded in y around inf
Applied rewrites89.0%
if -2e288 < (-.f64 (*.f64 (+.f64 x #s(literal 1 binary64)) y) x) < 1.99999999999999997e307Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites85.5%
(FPCore (x y)
:precision binary64
(if (<= y -4.5e+59)
(* y x)
(if (<= y -5.6e-9)
y
(if (<= y 1.5e-36) (- x) (if (<= y 5.5e+58) y (* y x))))))
double code(double x, double y) {
double tmp;
if (y <= -4.5e+59) {
tmp = y * x;
} else if (y <= -5.6e-9) {
tmp = y;
} else if (y <= 1.5e-36) {
tmp = -x;
} else if (y <= 5.5e+58) {
tmp = y;
} 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-4.5d+59)) then
tmp = y * x
else if (y <= (-5.6d-9)) then
tmp = y
else if (y <= 1.5d-36) then
tmp = -x
else if (y <= 5.5d+58) then
tmp = y
else
tmp = y * x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -4.5e+59) {
tmp = y * x;
} else if (y <= -5.6e-9) {
tmp = y;
} else if (y <= 1.5e-36) {
tmp = -x;
} else if (y <= 5.5e+58) {
tmp = y;
} else {
tmp = y * x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -4.5e+59: tmp = y * x elif y <= -5.6e-9: tmp = y elif y <= 1.5e-36: tmp = -x elif y <= 5.5e+58: tmp = y else: tmp = y * x return tmp
function code(x, y) tmp = 0.0 if (y <= -4.5e+59) tmp = Float64(y * x); elseif (y <= -5.6e-9) tmp = y; elseif (y <= 1.5e-36) tmp = Float64(-x); elseif (y <= 5.5e+58) tmp = y; else tmp = Float64(y * x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -4.5e+59) tmp = y * x; elseif (y <= -5.6e-9) tmp = y; elseif (y <= 1.5e-36) tmp = -x; elseif (y <= 5.5e+58) tmp = y; else tmp = y * x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -4.5e+59], N[(y * x), $MachinePrecision], If[LessEqual[y, -5.6e-9], y, If[LessEqual[y, 1.5e-36], (-x), If[LessEqual[y, 5.5e+58], y, N[(y * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.5 \cdot 10^{+59}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq -5.6 \cdot 10^{-9}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 1.5 \cdot 10^{-36}:\\
\;\;\;\;-x\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{+58}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;y \cdot x\\
\end{array}
\end{array}
if y < -4.49999999999999959e59 or 5.4999999999999999e58 < y Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6451.2
Applied rewrites51.2%
Taylor expanded in y around inf
Applied rewrites51.2%
if -4.49999999999999959e59 < y < -5.59999999999999969e-9 or 1.5000000000000001e-36 < y < 5.4999999999999999e58Initial program 99.9%
Taylor expanded in x around 0
Applied rewrites49.2%
if -5.59999999999999969e-9 < y < 1.5000000000000001e-36Initial program 100.0%
Taylor expanded in y around 0
mul-1-negN/A
lower-neg.f6476.2
Applied rewrites76.2%
(FPCore (x y) :precision binary64 (if (<= x -2.1e-82) (- x) (if (<= x 5.8e-108) y (- x))))
double code(double x, double y) {
double tmp;
if (x <= -2.1e-82) {
tmp = -x;
} else if (x <= 5.8e-108) {
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-2.1d-82)) then
tmp = -x
else if (x <= 5.8d-108) then
tmp = y
else
tmp = -x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -2.1e-82) {
tmp = -x;
} else if (x <= 5.8e-108) {
tmp = y;
} else {
tmp = -x;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -2.1e-82: tmp = -x elif x <= 5.8e-108: tmp = y else: tmp = -x return tmp
function code(x, y) tmp = 0.0 if (x <= -2.1e-82) tmp = Float64(-x); elseif (x <= 5.8e-108) tmp = y; else tmp = Float64(-x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -2.1e-82) tmp = -x; elseif (x <= 5.8e-108) tmp = y; else tmp = -x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -2.1e-82], (-x), If[LessEqual[x, 5.8e-108], y, (-x)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.1 \cdot 10^{-82}:\\
\;\;\;\;-x\\
\mathbf{elif}\;x \leq 5.8 \cdot 10^{-108}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;-x\\
\end{array}
\end{array}
if x < -2.1e-82 or 5.8000000000000002e-108 < x Initial program 100.0%
Taylor expanded in y around 0
mul-1-negN/A
lower-neg.f6448.5
Applied rewrites48.5%
if -2.1e-82 < x < 5.8000000000000002e-108Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites82.4%
(FPCore (x y) :precision binary64 y)
double code(double x, double y) {
return 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = y
end function
public static double code(double x, double y) {
return y;
}
def code(x, y): return y
function code(x, y) return y end
function tmp = code(x, y) tmp = y; end
code[x_, y_] := y
\begin{array}{l}
\\
y
\end{array}
Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites38.2%
herbie shell --seed 2025101
(FPCore (x y)
:name "Data.Colour.SRGB:transferFunction from colour-2.3.3"
:precision binary64
(- (* (+ x 1.0) y) x))