
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * sin(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 + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * sin(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 + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
(FPCore (x y z) :precision binary64 (- (cos y) (- (* (sin y) z) x)))
double code(double x, double y, double z) {
return cos(y) - ((sin(y) * z) - 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 = cos(y) - ((sin(y) * z) - x)
end function
public static double code(double x, double y, double z) {
return Math.cos(y) - ((Math.sin(y) * z) - x);
}
def code(x, y, z): return math.cos(y) - ((math.sin(y) * z) - x)
function code(x, y, z) return Float64(cos(y) - Float64(Float64(sin(y) * z) - x)) end
function tmp = code(x, y, z) tmp = cos(y) - ((sin(y) * z) - x); end
code[x_, y_, z_] := N[(N[Cos[y], $MachinePrecision] - N[(N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos y - \left(\sin y \cdot z - x\right)
\end{array}
Initial program 99.9%
lift--.f64N/A
sub-negate-revN/A
lift-+.f64N/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
lower--.f6499.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.9
Applied rewrites99.9%
(FPCore (x y z) :precision binary64 (let* ((t_0 (- 1.0 (- (* (sin y) z) x)))) (if (<= x -1.9e-11) t_0 (if (<= x 1.4e-7) (- (cos y) (* z (sin y))) t_0))))
double code(double x, double y, double z) {
double t_0 = 1.0 - ((sin(y) * z) - x);
double tmp;
if (x <= -1.9e-11) {
tmp = t_0;
} else if (x <= 1.4e-7) {
tmp = cos(y) - (z * sin(y));
} 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, 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) :: tmp
t_0 = 1.0d0 - ((sin(y) * z) - x)
if (x <= (-1.9d-11)) then
tmp = t_0
else if (x <= 1.4d-7) then
tmp = cos(y) - (z * sin(y))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 1.0 - ((Math.sin(y) * z) - x);
double tmp;
if (x <= -1.9e-11) {
tmp = t_0;
} else if (x <= 1.4e-7) {
tmp = Math.cos(y) - (z * Math.sin(y));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 - ((math.sin(y) * z) - x) tmp = 0 if x <= -1.9e-11: tmp = t_0 elif x <= 1.4e-7: tmp = math.cos(y) - (z * math.sin(y)) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(1.0 - Float64(Float64(sin(y) * z) - x)) tmp = 0.0 if (x <= -1.9e-11) tmp = t_0; elseif (x <= 1.4e-7) tmp = Float64(cos(y) - Float64(z * sin(y))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 1.0 - ((sin(y) * z) - x); tmp = 0.0; if (x <= -1.9e-11) tmp = t_0; elseif (x <= 1.4e-7) tmp = cos(y) - (z * sin(y)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 - N[(N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.9e-11], t$95$0, If[LessEqual[x, 1.4e-7], N[(N[Cos[y], $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \left(\sin y \cdot z - x\right)\\
\mathbf{if}\;x \leq -1.9 \cdot 10^{-11}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.4 \cdot 10^{-7}:\\
\;\;\;\;\cos y - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1.8999999999999999e-11 or 1.4000000000000001e-7 < x Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites88.4%
lift--.f64N/A
sub-negate-revN/A
lift-+.f64N/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
lower--.f6488.4
lift-*.f64N/A
*-commutativeN/A
lower-*.f6488.4
Applied rewrites88.4%
if -1.8999999999999999e-11 < x < 1.4000000000000001e-7Initial program 99.9%
Taylor expanded in x around 0
lower-cos.f6458.8
Applied rewrites58.8%
(FPCore (x y z) :precision binary64 (let* ((t_0 (- 1.0 (- (* (sin y) z) x)))) (if (<= z -15000000000000.0) t_0 (if (<= z 0.0007) (+ x (cos y)) t_0))))
double code(double x, double y, double z) {
double t_0 = 1.0 - ((sin(y) * z) - x);
double tmp;
if (z <= -15000000000000.0) {
tmp = t_0;
} else if (z <= 0.0007) {
tmp = x + cos(y);
} 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, 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) :: tmp
t_0 = 1.0d0 - ((sin(y) * z) - x)
if (z <= (-15000000000000.0d0)) then
tmp = t_0
else if (z <= 0.0007d0) then
tmp = x + cos(y)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 1.0 - ((Math.sin(y) * z) - x);
double tmp;
if (z <= -15000000000000.0) {
tmp = t_0;
} else if (z <= 0.0007) {
tmp = x + Math.cos(y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 - ((math.sin(y) * z) - x) tmp = 0 if z <= -15000000000000.0: tmp = t_0 elif z <= 0.0007: tmp = x + math.cos(y) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(1.0 - Float64(Float64(sin(y) * z) - x)) tmp = 0.0 if (z <= -15000000000000.0) tmp = t_0; elseif (z <= 0.0007) tmp = Float64(x + cos(y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 1.0 - ((sin(y) * z) - x); tmp = 0.0; if (z <= -15000000000000.0) tmp = t_0; elseif (z <= 0.0007) tmp = x + cos(y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 - N[(N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -15000000000000.0], t$95$0, If[LessEqual[z, 0.0007], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \left(\sin y \cdot z - x\right)\\
\mathbf{if}\;z \leq -15000000000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 0.0007:\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1.5e13 or 6.99999999999999993e-4 < z Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites88.4%
lift--.f64N/A
sub-negate-revN/A
lift-+.f64N/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
lower--.f6488.4
lift-*.f64N/A
*-commutativeN/A
lower-*.f6488.4
Applied rewrites88.4%
if -1.5e13 < z < 6.99999999999999993e-4Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites88.4%
lift--.f64N/A
sub-negate-revN/A
lift-+.f64N/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
lower--.f6488.4
lift-*.f64N/A
*-commutativeN/A
lower-*.f6488.4
Applied rewrites88.4%
Taylor expanded in z around 0
lower-+.f64N/A
lower-cos.f6473.2
Applied rewrites73.2%
(FPCore (x y z) :precision binary64 (let* ((t_0 (- 1.0 (* z (sin y))))) (if (<= z -3.4e+188) t_0 (if (<= z 2.4e+32) (+ x (cos y)) t_0))))
double code(double x, double y, double z) {
double t_0 = 1.0 - (z * sin(y));
double tmp;
if (z <= -3.4e+188) {
tmp = t_0;
} else if (z <= 2.4e+32) {
tmp = x + cos(y);
} 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, 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) :: tmp
t_0 = 1.0d0 - (z * sin(y))
if (z <= (-3.4d+188)) then
tmp = t_0
else if (z <= 2.4d+32) then
tmp = x + cos(y)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 1.0 - (z * Math.sin(y));
double tmp;
if (z <= -3.4e+188) {
tmp = t_0;
} else if (z <= 2.4e+32) {
tmp = x + Math.cos(y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 - (z * math.sin(y)) tmp = 0 if z <= -3.4e+188: tmp = t_0 elif z <= 2.4e+32: tmp = x + math.cos(y) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(1.0 - Float64(z * sin(y))) tmp = 0.0 if (z <= -3.4e+188) tmp = t_0; elseif (z <= 2.4e+32) tmp = Float64(x + cos(y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 1.0 - (z * sin(y)); tmp = 0.0; if (z <= -3.4e+188) tmp = t_0; elseif (z <= 2.4e+32) tmp = x + cos(y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.4e+188], t$95$0, If[LessEqual[z, 2.4e+32], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - z \cdot \sin y\\
\mathbf{if}\;z \leq -3.4 \cdot 10^{+188}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 2.4 \cdot 10^{+32}:\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -3.39999999999999995e188 or 2.39999999999999991e32 < z Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites88.4%
lift--.f64N/A
sub-negate-revN/A
lift-+.f64N/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
lower--.f6488.4
lift-*.f64N/A
*-commutativeN/A
lower-*.f6488.4
Applied rewrites88.4%
Taylor expanded in x around 0
lower-*.f64N/A
lower-sin.f6447.8
Applied rewrites47.8%
if -3.39999999999999995e188 < z < 2.39999999999999991e32Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites88.4%
lift--.f64N/A
sub-negate-revN/A
lift-+.f64N/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
lower--.f6488.4
lift-*.f64N/A
*-commutativeN/A
lower-*.f6488.4
Applied rewrites88.4%
Taylor expanded in z around 0
lower-+.f64N/A
lower-cos.f6473.2
Applied rewrites73.2%
(FPCore (x y z) :precision binary64 (if (<= z -4.75e+188) (* (sin y) (- z)) (if (<= z 1.65e+109) (+ x (cos y)) (- 1.0 (- (* y z) x)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -4.75e+188) {
tmp = sin(y) * -z;
} else if (z <= 1.65e+109) {
tmp = x + cos(y);
} else {
tmp = 1.0 - ((y * z) - 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 <= (-4.75d+188)) then
tmp = sin(y) * -z
else if (z <= 1.65d+109) then
tmp = x + cos(y)
else
tmp = 1.0d0 - ((y * z) - x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -4.75e+188) {
tmp = Math.sin(y) * -z;
} else if (z <= 1.65e+109) {
tmp = x + Math.cos(y);
} else {
tmp = 1.0 - ((y * z) - x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -4.75e+188: tmp = math.sin(y) * -z elif z <= 1.65e+109: tmp = x + math.cos(y) else: tmp = 1.0 - ((y * z) - x) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -4.75e+188) tmp = Float64(sin(y) * Float64(-z)); elseif (z <= 1.65e+109) tmp = Float64(x + cos(y)); else tmp = Float64(1.0 - Float64(Float64(y * z) - x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -4.75e+188) tmp = sin(y) * -z; elseif (z <= 1.65e+109) tmp = x + cos(y); else tmp = 1.0 - ((y * z) - x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -4.75e+188], N[(N[Sin[y], $MachinePrecision] * (-z)), $MachinePrecision], If[LessEqual[z, 1.65e+109], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.75 \cdot 10^{+188}:\\
\;\;\;\;\sin y \cdot \left(-z\right)\\
\mathbf{elif}\;z \leq 1.65 \cdot 10^{+109}:\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;1 - \left(y \cdot z - x\right)\\
\end{array}
\end{array}
if z < -4.7499999999999998e188Initial program 99.9%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f6428.3
Applied rewrites28.3%
lift-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-neg.f6428.3
Applied rewrites28.3%
if -4.7499999999999998e188 < z < 1.6499999999999999e109Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites88.4%
lift--.f64N/A
sub-negate-revN/A
lift-+.f64N/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
lower--.f6488.4
lift-*.f64N/A
*-commutativeN/A
lower-*.f6488.4
Applied rewrites88.4%
Taylor expanded in z around 0
lower-+.f64N/A
lower-cos.f6473.2
Applied rewrites73.2%
if 1.6499999999999999e109 < z Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites88.4%
lift--.f64N/A
sub-negate-revN/A
lift-+.f64N/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
lower--.f6488.4
lift-*.f64N/A
*-commutativeN/A
lower-*.f6488.4
Applied rewrites88.4%
Taylor expanded in y around 0
Applied rewrites63.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ x (cos y))))
(if (<= y -600.0)
t_0
(if (<= y 8.4e-8)
(+ 1.0 (+ x (* y (- (* y (- (* 0.16666666666666666 (* y z)) 0.5)) z))))
t_0))))
double code(double x, double y, double z) {
double t_0 = x + cos(y);
double tmp;
if (y <= -600.0) {
tmp = t_0;
} else if (y <= 8.4e-8) {
tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z)));
} 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, 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) :: tmp
t_0 = x + cos(y)
if (y <= (-600.0d0)) then
tmp = t_0
else if (y <= 8.4d-8) then
tmp = 1.0d0 + (x + (y * ((y * ((0.16666666666666666d0 * (y * z)) - 0.5d0)) - z)))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x + Math.cos(y);
double tmp;
if (y <= -600.0) {
tmp = t_0;
} else if (y <= 8.4e-8) {
tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z)));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x + math.cos(y) tmp = 0 if y <= -600.0: tmp = t_0 elif y <= 8.4e-8: tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z))) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x + cos(y)) tmp = 0.0 if (y <= -600.0) tmp = t_0; elseif (y <= 8.4e-8) tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * Float64(Float64(0.16666666666666666 * Float64(y * z)) - 0.5)) - z)))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x + cos(y); tmp = 0.0; if (y <= -600.0) tmp = t_0; elseif (y <= 8.4e-8) tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z))); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -600.0], t$95$0, If[LessEqual[y, 8.4e-8], N[(1.0 + N[(x + N[(y * N[(N[(y * N[(N[(0.16666666666666666 * N[(y * z), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \cos y\\
\mathbf{if}\;y \leq -600:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 8.4 \cdot 10^{-8}:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot \left(0.16666666666666666 \cdot \left(y \cdot z\right) - 0.5\right) - z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -600 or 8.39999999999999978e-8 < y Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites88.4%
lift--.f64N/A
sub-negate-revN/A
lift-+.f64N/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
lower--.f6488.4
lift-*.f64N/A
*-commutativeN/A
lower-*.f6488.4
Applied rewrites88.4%
Taylor expanded in z around 0
lower-+.f64N/A
lower-cos.f6473.2
Applied rewrites73.2%
if -600 < y < 8.39999999999999978e-8Initial program 99.9%
Taylor expanded in y around 0
lower-+.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f6455.3
Applied rewrites55.3%
(FPCore (x y z)
:precision binary64
(if (<= y -175000.0)
(- x -1.0)
(if (<= y 0.014)
(+ 1.0 (+ x (* y (- (* y (- (* 0.16666666666666666 (* y z)) 0.5)) z))))
(- x -1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -175000.0) {
tmp = x - -1.0;
} else if (y <= 0.014) {
tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z)));
} else {
tmp = x - -1.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, 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 <= (-175000.0d0)) then
tmp = x - (-1.0d0)
else if (y <= 0.014d0) then
tmp = 1.0d0 + (x + (y * ((y * ((0.16666666666666666d0 * (y * z)) - 0.5d0)) - z)))
else
tmp = x - (-1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -175000.0) {
tmp = x - -1.0;
} else if (y <= 0.014) {
tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z)));
} else {
tmp = x - -1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -175000.0: tmp = x - -1.0 elif y <= 0.014: tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z))) else: tmp = x - -1.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -175000.0) tmp = Float64(x - -1.0); elseif (y <= 0.014) tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * Float64(Float64(0.16666666666666666 * Float64(y * z)) - 0.5)) - z)))); else tmp = Float64(x - -1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -175000.0) tmp = x - -1.0; elseif (y <= 0.014) tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z))); else tmp = x - -1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -175000.0], N[(x - -1.0), $MachinePrecision], If[LessEqual[y, 0.014], N[(1.0 + N[(x + N[(y * N[(N[(y * N[(N[(0.16666666666666666 * N[(y * z), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - -1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -175000:\\
\;\;\;\;x - -1\\
\mathbf{elif}\;y \leq 0.014:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot \left(0.16666666666666666 \cdot \left(y \cdot z\right) - 0.5\right) - z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x - -1\\
\end{array}
\end{array}
if y < -175000 or 0.0140000000000000003 < y Initial program 99.9%
Taylor expanded in y around 0
lower-+.f6462.2
Applied rewrites62.2%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6462.2
Applied rewrites62.2%
if -175000 < y < 0.0140000000000000003Initial program 99.9%
Taylor expanded in y around 0
lower-+.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f6455.3
Applied rewrites55.3%
(FPCore (x y z) :precision binary64 (if (<= y -2.3e+26) (- x -1.0) (if (<= y 0.014) (+ 1.0 (+ x (* y (- (* -0.5 y) z)))) (- x -1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.3e+26) {
tmp = x - -1.0;
} else if (y <= 0.014) {
tmp = 1.0 + (x + (y * ((-0.5 * y) - z)));
} else {
tmp = x - -1.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, 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 <= (-2.3d+26)) then
tmp = x - (-1.0d0)
else if (y <= 0.014d0) then
tmp = 1.0d0 + (x + (y * (((-0.5d0) * y) - z)))
else
tmp = x - (-1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -2.3e+26) {
tmp = x - -1.0;
} else if (y <= 0.014) {
tmp = 1.0 + (x + (y * ((-0.5 * y) - z)));
} else {
tmp = x - -1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.3e+26: tmp = x - -1.0 elif y <= 0.014: tmp = 1.0 + (x + (y * ((-0.5 * y) - z))) else: tmp = x - -1.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.3e+26) tmp = Float64(x - -1.0); elseif (y <= 0.014) tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(-0.5 * y) - z)))); else tmp = Float64(x - -1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -2.3e+26) tmp = x - -1.0; elseif (y <= 0.014) tmp = 1.0 + (x + (y * ((-0.5 * y) - z))); else tmp = x - -1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.3e+26], N[(x - -1.0), $MachinePrecision], If[LessEqual[y, 0.014], N[(1.0 + N[(x + N[(y * N[(N[(-0.5 * y), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - -1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.3 \cdot 10^{+26}:\\
\;\;\;\;x - -1\\
\mathbf{elif}\;y \leq 0.014:\\
\;\;\;\;1 + \left(x + y \cdot \left(-0.5 \cdot y - z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x - -1\\
\end{array}
\end{array}
if y < -2.3000000000000001e26 or 0.0140000000000000003 < y Initial program 99.9%
Taylor expanded in y around 0
lower-+.f6462.2
Applied rewrites62.2%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6462.2
Applied rewrites62.2%
if -2.3000000000000001e26 < y < 0.0140000000000000003Initial program 99.9%
Taylor expanded in y around 0
lower-+.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6456.2
Applied rewrites56.2%
(FPCore (x y z) :precision binary64 (if (<= y -2.6e+65) (- x -1.0) (if (<= y 3.2e+124) (- 1.0 (- (* y z) x)) (- x -1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.6e+65) {
tmp = x - -1.0;
} else if (y <= 3.2e+124) {
tmp = 1.0 - ((y * z) - x);
} else {
tmp = x - -1.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, 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 <= (-2.6d+65)) then
tmp = x - (-1.0d0)
else if (y <= 3.2d+124) then
tmp = 1.0d0 - ((y * z) - x)
else
tmp = x - (-1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -2.6e+65) {
tmp = x - -1.0;
} else if (y <= 3.2e+124) {
tmp = 1.0 - ((y * z) - x);
} else {
tmp = x - -1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.6e+65: tmp = x - -1.0 elif y <= 3.2e+124: tmp = 1.0 - ((y * z) - x) else: tmp = x - -1.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.6e+65) tmp = Float64(x - -1.0); elseif (y <= 3.2e+124) tmp = Float64(1.0 - Float64(Float64(y * z) - x)); else tmp = Float64(x - -1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -2.6e+65) tmp = x - -1.0; elseif (y <= 3.2e+124) tmp = 1.0 - ((y * z) - x); else tmp = x - -1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.6e+65], N[(x - -1.0), $MachinePrecision], If[LessEqual[y, 3.2e+124], N[(1.0 - N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision], N[(x - -1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.6 \cdot 10^{+65}:\\
\;\;\;\;x - -1\\
\mathbf{elif}\;y \leq 3.2 \cdot 10^{+124}:\\
\;\;\;\;1 - \left(y \cdot z - x\right)\\
\mathbf{else}:\\
\;\;\;\;x - -1\\
\end{array}
\end{array}
if y < -2.60000000000000003e65 or 3.19999999999999993e124 < y Initial program 99.9%
Taylor expanded in y around 0
lower-+.f6462.2
Applied rewrites62.2%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6462.2
Applied rewrites62.2%
if -2.60000000000000003e65 < y < 3.19999999999999993e124Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites88.4%
lift--.f64N/A
sub-negate-revN/A
lift-+.f64N/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
lower--.f6488.4
lift-*.f64N/A
*-commutativeN/A
lower-*.f6488.4
Applied rewrites88.4%
Taylor expanded in y around 0
Applied rewrites63.9%
(FPCore (x y z) :precision binary64 (if (<= z 1.1e+241) (- x -1.0) (* y (- z))))
double code(double x, double y, double z) {
double tmp;
if (z <= 1.1e+241) {
tmp = x - -1.0;
} else {
tmp = y * -z;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= 1.1d+241) then
tmp = x - (-1.0d0)
else
tmp = y * -z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 1.1e+241) {
tmp = x - -1.0;
} else {
tmp = y * -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 1.1e+241: tmp = x - -1.0 else: tmp = y * -z return tmp
function code(x, y, z) tmp = 0.0 if (z <= 1.1e+241) tmp = Float64(x - -1.0); else tmp = Float64(y * Float64(-z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 1.1e+241) tmp = x - -1.0; else tmp = y * -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 1.1e+241], N[(x - -1.0), $MachinePrecision], N[(y * (-z)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.1 \cdot 10^{+241}:\\
\;\;\;\;x - -1\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-z\right)\\
\end{array}
\end{array}
if z < 1.1e241Initial program 99.9%
Taylor expanded in y around 0
lower-+.f6462.2
Applied rewrites62.2%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6462.2
Applied rewrites62.2%
if 1.1e241 < z Initial program 99.9%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f6428.3
Applied rewrites28.3%
lift-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-neg.f6428.3
Applied rewrites28.3%
Taylor expanded in y around 0
Applied rewrites10.8%
(FPCore (x y z) :precision binary64 (- x -1.0))
double code(double x, double y, double z) {
return x - -1.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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x - (-1.0d0)
end function
public static double code(double x, double y, double z) {
return x - -1.0;
}
def code(x, y, z): return x - -1.0
function code(x, y, z) return Float64(x - -1.0) end
function tmp = code(x, y, z) tmp = x - -1.0; end
code[x_, y_, z_] := N[(x - -1.0), $MachinePrecision]
\begin{array}{l}
\\
x - -1
\end{array}
Initial program 99.9%
Taylor expanded in y around 0
lower-+.f6462.2
Applied rewrites62.2%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6462.2
Applied rewrites62.2%
(FPCore (x y z) :precision binary64 1.0)
double code(double x, double y, double z) {
return 1.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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0
end function
public static double code(double x, double y, double z) {
return 1.0;
}
def code(x, y, z): return 1.0
function code(x, y, z) return 1.0 end
function tmp = code(x, y, z) tmp = 1.0; end
code[x_, y_, z_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 99.9%
Taylor expanded in y around 0
lower-+.f6462.2
Applied rewrites62.2%
Taylor expanded in x around 0
Applied rewrites22.2%
herbie shell --seed 2025149
(FPCore (x y z)
:name "Graphics.Rasterific.Svg.PathConverter:segmentToBezier from rasterific-svg-0.2.3.1, B"
:precision binary64
(- (+ x (cos y)) (* z (sin y))))