
(FPCore (x y z) :precision binary64 (+ (+ x (sin y)) (* z (cos y))))
double code(double x, double y, double z) {
return (x + sin(y)) + (z * cos(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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + sin(y)) + (z * cos(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.sin(y)) + (z * Math.cos(y));
}
def code(x, y, z): return (x + math.sin(y)) + (z * math.cos(y))
function code(x, y, z) return Float64(Float64(x + sin(y)) + Float64(z * cos(y))) end
function tmp = code(x, y, z) tmp = (x + sin(y)) + (z * cos(y)); end
code[x_, y_, z_] := N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \sin y\right) + z \cdot \cos y
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ (+ x (sin y)) (* z (cos y))))
double code(double x, double y, double z) {
return (x + sin(y)) + (z * cos(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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + sin(y)) + (z * cos(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.sin(y)) + (z * Math.cos(y));
}
def code(x, y, z): return (x + math.sin(y)) + (z * math.cos(y))
function code(x, y, z) return Float64(Float64(x + sin(y)) + Float64(z * cos(y))) end
function tmp = code(x, y, z) tmp = (x + sin(y)) + (z * cos(y)); end
code[x_, y_, z_] := N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \sin y\right) + z \cdot \cos y
\end{array}
(FPCore (x y z) :precision binary64 (+ (+ x (sin y)) (* z (cos y))))
double code(double x, double y, double z) {
return (x + sin(y)) + (z * cos(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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + sin(y)) + (z * cos(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.sin(y)) + (z * Math.cos(y));
}
def code(x, y, z): return (x + math.sin(y)) + (z * math.cos(y))
function code(x, y, z) return Float64(Float64(x + sin(y)) + Float64(z * cos(y))) end
function tmp = code(x, y, z) tmp = (x + sin(y)) + (z * cos(y)); end
code[x_, y_, z_] := N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \sin y\right) + z \cdot \cos y
\end{array}
Initial program 99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ (sin y) x))
(t_1 (* z (cos y)))
(t_2 (+ (+ x (sin y)) t_1))
(t_3 (+ x t_1)))
(if (<= t_2 -10000000.0)
t_3
(if (<= t_2 -0.01)
t_0
(if (<= t_2 1e-12) (+ (+ z y) x) (if (<= t_2 1.0) t_0 t_3))))))
double code(double x, double y, double z) {
double t_0 = sin(y) + x;
double t_1 = z * cos(y);
double t_2 = (x + sin(y)) + t_1;
double t_3 = x + t_1;
double tmp;
if (t_2 <= -10000000.0) {
tmp = t_3;
} else if (t_2 <= -0.01) {
tmp = t_0;
} else if (t_2 <= 1e-12) {
tmp = (z + y) + x;
} else if (t_2 <= 1.0) {
tmp = t_0;
} else {
tmp = t_3;
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = sin(y) + x
t_1 = z * cos(y)
t_2 = (x + sin(y)) + t_1
t_3 = x + t_1
if (t_2 <= (-10000000.0d0)) then
tmp = t_3
else if (t_2 <= (-0.01d0)) then
tmp = t_0
else if (t_2 <= 1d-12) then
tmp = (z + y) + x
else if (t_2 <= 1.0d0) then
tmp = t_0
else
tmp = t_3
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.sin(y) + x;
double t_1 = z * Math.cos(y);
double t_2 = (x + Math.sin(y)) + t_1;
double t_3 = x + t_1;
double tmp;
if (t_2 <= -10000000.0) {
tmp = t_3;
} else if (t_2 <= -0.01) {
tmp = t_0;
} else if (t_2 <= 1e-12) {
tmp = (z + y) + x;
} else if (t_2 <= 1.0) {
tmp = t_0;
} else {
tmp = t_3;
}
return tmp;
}
def code(x, y, z): t_0 = math.sin(y) + x t_1 = z * math.cos(y) t_2 = (x + math.sin(y)) + t_1 t_3 = x + t_1 tmp = 0 if t_2 <= -10000000.0: tmp = t_3 elif t_2 <= -0.01: tmp = t_0 elif t_2 <= 1e-12: tmp = (z + y) + x elif t_2 <= 1.0: tmp = t_0 else: tmp = t_3 return tmp
function code(x, y, z) t_0 = Float64(sin(y) + x) t_1 = Float64(z * cos(y)) t_2 = Float64(Float64(x + sin(y)) + t_1) t_3 = Float64(x + t_1) tmp = 0.0 if (t_2 <= -10000000.0) tmp = t_3; elseif (t_2 <= -0.01) tmp = t_0; elseif (t_2 <= 1e-12) tmp = Float64(Float64(z + y) + x); elseif (t_2 <= 1.0) tmp = t_0; else tmp = t_3; end return tmp end
function tmp_2 = code(x, y, z) t_0 = sin(y) + x; t_1 = z * cos(y); t_2 = (x + sin(y)) + t_1; t_3 = x + t_1; tmp = 0.0; if (t_2 <= -10000000.0) tmp = t_3; elseif (t_2 <= -0.01) tmp = t_0; elseif (t_2 <= 1e-12) tmp = (z + y) + x; elseif (t_2 <= 1.0) tmp = t_0; else tmp = t_3; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Sin[y], $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$1 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(x + t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, -10000000.0], t$95$3, If[LessEqual[t$95$2, -0.01], t$95$0, If[LessEqual[t$95$2, 1e-12], N[(N[(z + y), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$2, 1.0], t$95$0, t$95$3]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin y + x\\
t_1 := z \cdot \cos y\\
t_2 := \left(x + \sin y\right) + t\_1\\
t_3 := x + t\_1\\
\mathbf{if}\;t\_2 \leq -10000000:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq -0.01:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_2 \leq 10^{-12}:\\
\;\;\;\;\left(z + y\right) + x\\
\mathbf{elif}\;t\_2 \leq 1:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < -1e7 or 1 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites99.7%
if -1e7 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < -0.0100000000000000002 or 9.9999999999999998e-13 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 1Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lift-sin.f64100.0
Applied rewrites100.0%
if -0.0100000000000000002 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 9.9999999999999998e-13Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
(FPCore (x y z) :precision binary64 (if (or (<= x -155.0) (not (<= x 2.9e-29))) (+ x (* z (cos y))) (fma (cos y) z (sin y))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -155.0) || !(x <= 2.9e-29)) {
tmp = x + (z * cos(y));
} else {
tmp = fma(cos(y), z, sin(y));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((x <= -155.0) || !(x <= 2.9e-29)) tmp = Float64(x + Float64(z * cos(y))); else tmp = fma(cos(y), z, sin(y)); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[x, -155.0], N[Not[LessEqual[x, 2.9e-29]], $MachinePrecision]], N[(x + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[y], $MachinePrecision] * z + N[Sin[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -155 \lor \neg \left(x \leq 2.9 \cdot 10^{-29}\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\cos y, z, \sin y\right)\\
\end{array}
\end{array}
if x < -155 or 2.90000000000000024e-29 < x Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites99.8%
if -155 < x < 2.90000000000000024e-29Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-cos.f64N/A
lift-sin.f6495.3
Applied rewrites95.3%
Final simplification97.7%
(FPCore (x y z) :precision binary64 (if (or (<= z -5.5e+24) (not (<= z 1.25e+28))) (* (cos y) z) (+ (sin y) x)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -5.5e+24) || !(z <= 1.25e+28)) {
tmp = cos(y) * z;
} else {
tmp = sin(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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-5.5d+24)) .or. (.not. (z <= 1.25d+28))) then
tmp = cos(y) * z
else
tmp = sin(y) + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -5.5e+24) || !(z <= 1.25e+28)) {
tmp = Math.cos(y) * z;
} else {
tmp = Math.sin(y) + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -5.5e+24) or not (z <= 1.25e+28): tmp = math.cos(y) * z else: tmp = math.sin(y) + x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -5.5e+24) || !(z <= 1.25e+28)) tmp = Float64(cos(y) * z); else tmp = Float64(sin(y) + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -5.5e+24) || ~((z <= 1.25e+28))) tmp = cos(y) * z; else tmp = sin(y) + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -5.5e+24], N[Not[LessEqual[z, 1.25e+28]], $MachinePrecision]], N[(N[Cos[y], $MachinePrecision] * z), $MachinePrecision], N[(N[Sin[y], $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \cdot 10^{+24} \lor \neg \left(z \leq 1.25 \cdot 10^{+28}\right):\\
\;\;\;\;\cos y \cdot z\\
\mathbf{else}:\\
\;\;\;\;\sin y + x\\
\end{array}
\end{array}
if z < -5.5000000000000002e24 or 1.24999999999999989e28 < z Initial program 99.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lift-cos.f6479.7
Applied rewrites79.7%
if -5.5000000000000002e24 < z < 1.24999999999999989e28Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lift-sin.f6489.7
Applied rewrites89.7%
Final simplification85.3%
(FPCore (x y z) :precision binary64 (if (or (<= y -8.8e+17) (not (<= y 1.5e+36))) (+ (sin y) x) (+ (+ z y) x)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -8.8e+17) || !(y <= 1.5e+36)) {
tmp = sin(y) + x;
} else {
tmp = (z + 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-8.8d+17)) .or. (.not. (y <= 1.5d+36))) then
tmp = sin(y) + x
else
tmp = (z + y) + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -8.8e+17) || !(y <= 1.5e+36)) {
tmp = Math.sin(y) + x;
} else {
tmp = (z + y) + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -8.8e+17) or not (y <= 1.5e+36): tmp = math.sin(y) + x else: tmp = (z + y) + x return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -8.8e+17) || !(y <= 1.5e+36)) tmp = Float64(sin(y) + x); else tmp = Float64(Float64(z + y) + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -8.8e+17) || ~((y <= 1.5e+36))) tmp = sin(y) + x; else tmp = (z + y) + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -8.8e+17], N[Not[LessEqual[y, 1.5e+36]], $MachinePrecision]], N[(N[Sin[y], $MachinePrecision] + x), $MachinePrecision], N[(N[(z + y), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.8 \cdot 10^{+17} \lor \neg \left(y \leq 1.5 \cdot 10^{+36}\right):\\
\;\;\;\;\sin y + x\\
\mathbf{else}:\\
\;\;\;\;\left(z + y\right) + x\\
\end{array}
\end{array}
if y < -8.8e17 or 1.5e36 < y Initial program 99.8%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lift-sin.f6463.4
Applied rewrites63.4%
if -8.8e17 < y < 1.5e36Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6497.8
Applied rewrites97.8%
Final simplification79.4%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.5e+57) (not (<= y 3600000.0))) (+ z x) (fma (fma (fma -0.16666666666666666 y (* -0.5 z)) y 1.0) y (+ z x))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.5e+57) || !(y <= 3600000.0)) {
tmp = z + x;
} else {
tmp = fma(fma(fma(-0.16666666666666666, y, (-0.5 * z)), y, 1.0), y, (z + x));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((y <= -1.5e+57) || !(y <= 3600000.0)) tmp = Float64(z + x); else tmp = fma(fma(fma(-0.16666666666666666, y, Float64(-0.5 * z)), y, 1.0), y, Float64(z + x)); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.5e+57], N[Not[LessEqual[y, 3600000.0]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(N[(N[(-0.16666666666666666 * y + N[(-0.5 * z), $MachinePrecision]), $MachinePrecision] * y + 1.0), $MachinePrecision] * y + N[(z + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.5 \cdot 10^{+57} \lor \neg \left(y \leq 3600000\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, y, -0.5 \cdot z\right), y, 1\right), y, z + x\right)\\
\end{array}
\end{array}
if y < -1.5e57 or 3.6e6 < y Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6443.2
Applied rewrites43.2%
if -1.5e57 < y < 3.6e6Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f6494.1
Applied rewrites94.1%
Final simplification67.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.5e+57) (not (<= y 170000000.0))) (+ z x) (fma (fma (* z y) -0.5 1.0) y (+ z x))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.5e+57) || !(y <= 170000000.0)) {
tmp = z + x;
} else {
tmp = fma(fma((z * y), -0.5, 1.0), y, (z + x));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((y <= -1.5e+57) || !(y <= 170000000.0)) tmp = Float64(z + x); else tmp = fma(fma(Float64(z * y), -0.5, 1.0), y, Float64(z + x)); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.5e+57], N[Not[LessEqual[y, 170000000.0]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(N[(N[(z * y), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] * y + N[(z + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.5 \cdot 10^{+57} \lor \neg \left(y \leq 170000000\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(z \cdot y, -0.5, 1\right), y, z + x\right)\\
\end{array}
\end{array}
if y < -1.5e57 or 1.7e8 < y Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6443.2
Applied rewrites43.2%
if -1.5e57 < y < 1.7e8Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f6493.8
Applied rewrites93.8%
Final simplification67.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -5.9e+19) (not (<= y 4.8e+39))) (+ z x) (+ (+ z y) x)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -5.9e+19) || !(y <= 4.8e+39)) {
tmp = z + x;
} else {
tmp = (z + 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-5.9d+19)) .or. (.not. (y <= 4.8d+39))) then
tmp = z + x
else
tmp = (z + y) + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -5.9e+19) || !(y <= 4.8e+39)) {
tmp = z + x;
} else {
tmp = (z + y) + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -5.9e+19) or not (y <= 4.8e+39): tmp = z + x else: tmp = (z + y) + x return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -5.9e+19) || !(y <= 4.8e+39)) tmp = Float64(z + x); else tmp = Float64(Float64(z + y) + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -5.9e+19) || ~((y <= 4.8e+39))) tmp = z + x; else tmp = (z + y) + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -5.9e+19], N[Not[LessEqual[y, 4.8e+39]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(N[(z + y), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.9 \cdot 10^{+19} \lor \neg \left(y \leq 4.8 \cdot 10^{+39}\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;\left(z + y\right) + x\\
\end{array}
\end{array}
if y < -5.9e19 or 4.8000000000000002e39 < y Initial program 99.8%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6441.6
Applied rewrites41.6%
if -5.9e19 < y < 4.8000000000000002e39Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6497.0
Applied rewrites97.0%
Final simplification67.6%
(FPCore (x y z) :precision binary64 (if (or (<= x -2.75e-161) (not (<= x 1.2e-82))) (+ z x) (+ z y)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -2.75e-161) || !(x <= 1.2e-82)) {
tmp = z + x;
} else {
tmp = z + 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= (-2.75d-161)) .or. (.not. (x <= 1.2d-82))) then
tmp = z + x
else
tmp = z + y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -2.75e-161) || !(x <= 1.2e-82)) {
tmp = z + x;
} else {
tmp = z + y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -2.75e-161) or not (x <= 1.2e-82): tmp = z + x else: tmp = z + y return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -2.75e-161) || !(x <= 1.2e-82)) tmp = Float64(z + x); else tmp = Float64(z + y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -2.75e-161) || ~((x <= 1.2e-82))) tmp = z + x; else tmp = z + y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -2.75e-161], N[Not[LessEqual[x, 1.2e-82]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(z + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.75 \cdot 10^{-161} \lor \neg \left(x \leq 1.2 \cdot 10^{-82}\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;z + y\\
\end{array}
\end{array}
if x < -2.75e-161 or 1.20000000000000004e-82 < x Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6475.0
Applied rewrites75.0%
if -2.75e-161 < x < 1.20000000000000004e-82Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6449.3
Applied rewrites49.3%
Taylor expanded in x around 0
+-commutativeN/A
lift-+.f6446.4
Applied rewrites46.4%
Final simplification66.0%
(FPCore (x y z) :precision binary64 (if (or (<= x -200.0) (not (<= x 1.45e-43))) x (+ z y)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -200.0) || !(x <= 1.45e-43)) {
tmp = x;
} else {
tmp = z + 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= (-200.0d0)) .or. (.not. (x <= 1.45d-43))) then
tmp = x
else
tmp = z + y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -200.0) || !(x <= 1.45e-43)) {
tmp = x;
} else {
tmp = z + y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -200.0) or not (x <= 1.45e-43): tmp = x else: tmp = z + y return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -200.0) || !(x <= 1.45e-43)) tmp = x; else tmp = Float64(z + y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -200.0) || ~((x <= 1.45e-43))) tmp = x; else tmp = z + y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -200.0], N[Not[LessEqual[x, 1.45e-43]], $MachinePrecision]], x, N[(z + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -200 \lor \neg \left(x \leq 1.45 \cdot 10^{-43}\right):\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z + y\\
\end{array}
\end{array}
if x < -200 or 1.4500000000000001e-43 < x Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites75.7%
if -200 < x < 1.4500000000000001e-43Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6447.7
Applied rewrites47.7%
Taylor expanded in x around 0
+-commutativeN/A
lift-+.f6444.7
Applied rewrites44.7%
Final simplification61.2%
(FPCore (x y z) :precision binary64 (if (<= x -200.0) x (if (<= x 2.9e-46) z x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -200.0) {
tmp = x;
} else if (x <= 2.9e-46) {
tmp = z;
} 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-200.0d0)) then
tmp = x
else if (x <= 2.9d-46) then
tmp = z
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -200.0) {
tmp = x;
} else if (x <= 2.9e-46) {
tmp = z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -200.0: tmp = x elif x <= 2.9e-46: tmp = z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -200.0) tmp = x; elseif (x <= 2.9e-46) tmp = z; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -200.0) tmp = x; elseif (x <= 2.9e-46) tmp = z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -200.0], x, If[LessEqual[x, 2.9e-46], z, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -200:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.9 \cdot 10^{-46}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -200 or 2.90000000000000005e-46 < x Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites75.2%
if -200 < x < 2.90000000000000005e-46Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6448.0
Applied rewrites48.0%
Taylor expanded in z around inf
Applied rewrites36.4%
(FPCore (x y z) :precision binary64 (if (<= x -2.75e-161) x (if (<= x 1.45e-82) y x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -2.75e-161) {
tmp = x;
} else if (x <= 1.45e-82) {
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-2.75d-161)) then
tmp = x
else if (x <= 1.45d-82) then
tmp = y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -2.75e-161) {
tmp = x;
} else if (x <= 1.45e-82) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -2.75e-161: tmp = x elif x <= 1.45e-82: tmp = y else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -2.75e-161) tmp = x; elseif (x <= 1.45e-82) tmp = y; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -2.75e-161) tmp = x; elseif (x <= 1.45e-82) tmp = y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -2.75e-161], x, If[LessEqual[x, 1.45e-82], y, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.75 \cdot 10^{-161}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.45 \cdot 10^{-82}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -2.75e-161 or 1.44999999999999989e-82 < x Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites59.9%
if -2.75e-161 < x < 1.44999999999999989e-82Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6449.3
Applied rewrites49.3%
Taylor expanded in y around inf
Applied rewrites15.9%
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x
end function
public static double code(double x, double y, double z) {
return x;
}
def code(x, y, z): return x
function code(x, y, z) return x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 99.9%
Taylor expanded in x around inf
Applied rewrites42.7%
herbie shell --seed 2025043
(FPCore (x y z)
:name "Graphics.Rasterific.Svg.PathConverter:segmentToBezier from rasterific-svg-0.2.3.1, C"
:precision binary64
(+ (+ x (sin y)) (* z (cos y))))