
(FPCore (x y) :precision binary64 (exp (* (* x y) y)))
double code(double x, double y) {
return exp(((x * y) * y));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = exp(((x * y) * y))
end function
public static double code(double x, double y) {
return Math.exp(((x * y) * y));
}
def code(x, y): return math.exp(((x * y) * y))
function code(x, y) return exp(Float64(Float64(x * y) * y)) end
function tmp = code(x, y) tmp = exp(((x * y) * y)); end
code[x_, y_] := N[Exp[N[(N[(x * y), $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision]
e^{\left(x \cdot y\right) \cdot y}
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (exp (* (* x y) y)))
double code(double x, double y) {
return exp(((x * y) * y));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = exp(((x * y) * y))
end function
public static double code(double x, double y) {
return Math.exp(((x * y) * y));
}
def code(x, y): return math.exp(((x * y) * y))
function code(x, y) return exp(Float64(Float64(x * y) * y)) end
function tmp = code(x, y) tmp = exp(((x * y) * y)); end
code[x_, y_] := N[Exp[N[(N[(x * y), $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision]
e^{\left(x \cdot y\right) \cdot y}
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (* x y) y))
(t_1 (* (* y x) y))
(t_2 (* (* (* y y) y) y)))
(if (<= t_0 (- INFINITY))
(/ -1.0 (- t_1 1.0))
(if (<= t_0 4e-23)
(/ -1.0 (/ (- (* (* (* t_1 y) x) y) 1.0) (- t_1 -1.0)))
(+ 1.0 (* x (sqrt (sqrt (* t_2 t_2)))))))))double code(double x, double y) {
double t_0 = (x * y) * y;
double t_1 = (y * x) * y;
double t_2 = ((y * y) * y) * y;
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = -1.0 / (t_1 - 1.0);
} else if (t_0 <= 4e-23) {
tmp = -1.0 / (((((t_1 * y) * x) * y) - 1.0) / (t_1 - -1.0));
} else {
tmp = 1.0 + (x * sqrt(sqrt((t_2 * t_2))));
}
return tmp;
}
public static double code(double x, double y) {
double t_0 = (x * y) * y;
double t_1 = (y * x) * y;
double t_2 = ((y * y) * y) * y;
double tmp;
if (t_0 <= -Double.POSITIVE_INFINITY) {
tmp = -1.0 / (t_1 - 1.0);
} else if (t_0 <= 4e-23) {
tmp = -1.0 / (((((t_1 * y) * x) * y) - 1.0) / (t_1 - -1.0));
} else {
tmp = 1.0 + (x * Math.sqrt(Math.sqrt((t_2 * t_2))));
}
return tmp;
}
def code(x, y): t_0 = (x * y) * y t_1 = (y * x) * y t_2 = ((y * y) * y) * y tmp = 0 if t_0 <= -math.inf: tmp = -1.0 / (t_1 - 1.0) elif t_0 <= 4e-23: tmp = -1.0 / (((((t_1 * y) * x) * y) - 1.0) / (t_1 - -1.0)) else: tmp = 1.0 + (x * math.sqrt(math.sqrt((t_2 * t_2)))) return tmp
function code(x, y) t_0 = Float64(Float64(x * y) * y) t_1 = Float64(Float64(y * x) * y) t_2 = Float64(Float64(Float64(y * y) * y) * y) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(-1.0 / Float64(t_1 - 1.0)); elseif (t_0 <= 4e-23) tmp = Float64(-1.0 / Float64(Float64(Float64(Float64(Float64(t_1 * y) * x) * y) - 1.0) / Float64(t_1 - -1.0))); else tmp = Float64(1.0 + Float64(x * sqrt(sqrt(Float64(t_2 * t_2))))); end return tmp end
function tmp_2 = code(x, y) t_0 = (x * y) * y; t_1 = (y * x) * y; t_2 = ((y * y) * y) * y; tmp = 0.0; if (t_0 <= -Inf) tmp = -1.0 / (t_1 - 1.0); elseif (t_0 <= 4e-23) tmp = -1.0 / (((((t_1 * y) * x) * y) - 1.0) / (t_1 - -1.0)); else tmp = 1.0 + (x * sqrt(sqrt((t_2 * t_2)))); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(x * y), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$1 = N[(N[(y * x), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(y * y), $MachinePrecision] * y), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(-1.0 / N[(t$95$1 - 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 4e-23], N[(-1.0 / N[(N[(N[(N[(N[(t$95$1 * y), $MachinePrecision] * x), $MachinePrecision] * y), $MachinePrecision] - 1.0), $MachinePrecision] / N[(t$95$1 - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x * N[Sqrt[N[Sqrt[N[(t$95$2 * t$95$2), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_0 := \left(x \cdot y\right) \cdot y\\
t_1 := \left(y \cdot x\right) \cdot y\\
t_2 := \left(\left(y \cdot y\right) \cdot y\right) \cdot y\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\frac{-1}{t\_1 - 1}\\
\mathbf{elif}\;t\_0 \leq 4 \cdot 10^{-23}:\\
\;\;\;\;\frac{-1}{\frac{\left(\left(t\_1 \cdot y\right) \cdot x\right) \cdot y - 1}{t\_1 - -1}}\\
\mathbf{else}:\\
\;\;\;\;1 + x \cdot \sqrt{\sqrt{t\_2 \cdot t\_2}}\\
\end{array}
if (*.f64 (*.f64 x y) y) < -inf.0Initial program 100.0%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6466.1%
Applied rewrites66.1%
lift-+.f64N/A
+-commutativeN/A
flip-+N/A
lower-unsound-/.f64N/A
Applied rewrites54.1%
Taylor expanded in x around 0
Applied rewrites66.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f6463.3%
Applied rewrites63.3%
if -inf.0 < (*.f64 (*.f64 x y) y) < 3.9999999999999998e-23Initial program 100.0%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6466.1%
Applied rewrites66.1%
lift-+.f64N/A
+-commutativeN/A
flip-+N/A
lower-unsound-/.f64N/A
Applied rewrites54.1%
Taylor expanded in x around 0
Applied rewrites66.7%
lift--.f64N/A
flip--N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-unsound-+.f32N/A
lower-+.f32N/A
metadata-evalN/A
sub-flipN/A
lift--.f64N/A
lower-unsound-/.f64N/A
Applied rewrites57.4%
if 3.9999999999999998e-23 < (*.f64 (*.f64 x y) y) Initial program 100.0%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6466.1%
Applied rewrites66.1%
rem-square-sqrtN/A
sqrt-unprodN/A
lower-*.f32N/A
lower-unsound-*.f32N/A
lower-sqrt.f64N/A
lower-unsound-*.f6467.6%
lift-pow.f64N/A
unpow2N/A
lower-*.f6467.6%
lift-pow.f64N/A
unpow2N/A
lower-*.f6467.6%
Applied rewrites67.6%
rem-square-sqrtN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6467.3%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6467.3%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6467.3%
Applied rewrites67.3%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (* x y) y)) (t_1 (* (* y y) x)) (t_2 (* (* y x) y)))
(if (<= t_0 -500000000.0)
(/ -1.0 (- (* (sqrt (* (* (* y y) y) y)) x) 1.0))
(if (<= t_0 5e+263)
(/ (- (* t_1 t_1) (* 1.0 1.0)) (- t_2 1.0))
(+ 1.0 t_2)))))double code(double x, double y) {
double t_0 = (x * y) * y;
double t_1 = (y * y) * x;
double t_2 = (y * x) * y;
double tmp;
if (t_0 <= -500000000.0) {
tmp = -1.0 / ((sqrt((((y * y) * y) * y)) * x) - 1.0);
} else if (t_0 <= 5e+263) {
tmp = ((t_1 * t_1) - (1.0 * 1.0)) / (t_2 - 1.0);
} else {
tmp = 1.0 + t_2;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (x * y) * y
t_1 = (y * y) * x
t_2 = (y * x) * y
if (t_0 <= (-500000000.0d0)) then
tmp = (-1.0d0) / ((sqrt((((y * y) * y) * y)) * x) - 1.0d0)
else if (t_0 <= 5d+263) then
tmp = ((t_1 * t_1) - (1.0d0 * 1.0d0)) / (t_2 - 1.0d0)
else
tmp = 1.0d0 + t_2
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (x * y) * y;
double t_1 = (y * y) * x;
double t_2 = (y * x) * y;
double tmp;
if (t_0 <= -500000000.0) {
tmp = -1.0 / ((Math.sqrt((((y * y) * y) * y)) * x) - 1.0);
} else if (t_0 <= 5e+263) {
tmp = ((t_1 * t_1) - (1.0 * 1.0)) / (t_2 - 1.0);
} else {
tmp = 1.0 + t_2;
}
return tmp;
}
def code(x, y): t_0 = (x * y) * y t_1 = (y * y) * x t_2 = (y * x) * y tmp = 0 if t_0 <= -500000000.0: tmp = -1.0 / ((math.sqrt((((y * y) * y) * y)) * x) - 1.0) elif t_0 <= 5e+263: tmp = ((t_1 * t_1) - (1.0 * 1.0)) / (t_2 - 1.0) else: tmp = 1.0 + t_2 return tmp
function code(x, y) t_0 = Float64(Float64(x * y) * y) t_1 = Float64(Float64(y * y) * x) t_2 = Float64(Float64(y * x) * y) tmp = 0.0 if (t_0 <= -500000000.0) tmp = Float64(-1.0 / Float64(Float64(sqrt(Float64(Float64(Float64(y * y) * y) * y)) * x) - 1.0)); elseif (t_0 <= 5e+263) tmp = Float64(Float64(Float64(t_1 * t_1) - Float64(1.0 * 1.0)) / Float64(t_2 - 1.0)); else tmp = Float64(1.0 + t_2); end return tmp end
function tmp_2 = code(x, y) t_0 = (x * y) * y; t_1 = (y * y) * x; t_2 = (y * x) * y; tmp = 0.0; if (t_0 <= -500000000.0) tmp = -1.0 / ((sqrt((((y * y) * y) * y)) * x) - 1.0); elseif (t_0 <= 5e+263) tmp = ((t_1 * t_1) - (1.0 * 1.0)) / (t_2 - 1.0); else tmp = 1.0 + t_2; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(x * y), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$1 = N[(N[(y * y), $MachinePrecision] * x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y * x), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[t$95$0, -500000000.0], N[(-1.0 / N[(N[(N[Sqrt[N[(N[(N[(y * y), $MachinePrecision] * y), $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+263], N[(N[(N[(t$95$1 * t$95$1), $MachinePrecision] - N[(1.0 * 1.0), $MachinePrecision]), $MachinePrecision] / N[(t$95$2 - 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 + t$95$2), $MachinePrecision]]]]]]
\begin{array}{l}
t_0 := \left(x \cdot y\right) \cdot y\\
t_1 := \left(y \cdot y\right) \cdot x\\
t_2 := \left(y \cdot x\right) \cdot y\\
\mathbf{if}\;t\_0 \leq -500000000:\\
\;\;\;\;\frac{-1}{\sqrt{\left(\left(y \cdot y\right) \cdot y\right) \cdot y} \cdot x - 1}\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+263}:\\
\;\;\;\;\frac{t\_1 \cdot t\_1 - 1 \cdot 1}{t\_2 - 1}\\
\mathbf{else}:\\
\;\;\;\;1 + t\_2\\
\end{array}
if (*.f64 (*.f64 x y) y) < -5e8Initial program 100.0%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6466.1%
Applied rewrites66.1%
lift-+.f64N/A
+-commutativeN/A
flip-+N/A
lower-unsound-/.f64N/A
Applied rewrites54.1%
Taylor expanded in x around 0
Applied rewrites66.7%
rem-square-sqrtN/A
sqrt-unprodN/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
rem-square-sqrtN/A
sqrt-unprodN/A
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f6467.4%
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-unprodN/A
rem-square-sqrt68.0%
Applied rewrites68.0%
if -5e8 < (*.f64 (*.f64 x y) y) < 5.0000000000000002e263Initial program 100.0%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6466.1%
Applied rewrites66.1%
lift-+.f64N/A
+-commutativeN/A
flip-+N/A
lower-unsound-/.f64N/A
Applied rewrites54.1%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f6457.1%
Applied rewrites57.1%
if 5.0000000000000002e263 < (*.f64 (*.f64 x y) y) Initial program 100.0%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6466.1%
Applied rewrites66.1%
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6463.4%
Applied rewrites63.4%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (* (* y y) y) y)))
(if (<= (* (* x y) y) 4e-23)
(/ -1.0 (- (* (sqrt t_0) x) 1.0))
(+ 1.0 (* x (sqrt (sqrt (* t_0 t_0))))))))double code(double x, double y) {
double t_0 = ((y * y) * y) * y;
double tmp;
if (((x * y) * y) <= 4e-23) {
tmp = -1.0 / ((sqrt(t_0) * x) - 1.0);
} else {
tmp = 1.0 + (x * sqrt(sqrt((t_0 * t_0))));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = ((y * y) * y) * y
if (((x * y) * y) <= 4d-23) then
tmp = (-1.0d0) / ((sqrt(t_0) * x) - 1.0d0)
else
tmp = 1.0d0 + (x * sqrt(sqrt((t_0 * t_0))))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = ((y * y) * y) * y;
double tmp;
if (((x * y) * y) <= 4e-23) {
tmp = -1.0 / ((Math.sqrt(t_0) * x) - 1.0);
} else {
tmp = 1.0 + (x * Math.sqrt(Math.sqrt((t_0 * t_0))));
}
return tmp;
}
def code(x, y): t_0 = ((y * y) * y) * y tmp = 0 if ((x * y) * y) <= 4e-23: tmp = -1.0 / ((math.sqrt(t_0) * x) - 1.0) else: tmp = 1.0 + (x * math.sqrt(math.sqrt((t_0 * t_0)))) return tmp
function code(x, y) t_0 = Float64(Float64(Float64(y * y) * y) * y) tmp = 0.0 if (Float64(Float64(x * y) * y) <= 4e-23) tmp = Float64(-1.0 / Float64(Float64(sqrt(t_0) * x) - 1.0)); else tmp = Float64(1.0 + Float64(x * sqrt(sqrt(Float64(t_0 * t_0))))); end return tmp end
function tmp_2 = code(x, y) t_0 = ((y * y) * y) * y; tmp = 0.0; if (((x * y) * y) <= 4e-23) tmp = -1.0 / ((sqrt(t_0) * x) - 1.0); else tmp = 1.0 + (x * sqrt(sqrt((t_0 * t_0)))); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[(y * y), $MachinePrecision] * y), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[N[(N[(x * y), $MachinePrecision] * y), $MachinePrecision], 4e-23], N[(-1.0 / N[(N[(N[Sqrt[t$95$0], $MachinePrecision] * x), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x * N[Sqrt[N[Sqrt[N[(t$95$0 * t$95$0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \left(\left(y \cdot y\right) \cdot y\right) \cdot y\\
\mathbf{if}\;\left(x \cdot y\right) \cdot y \leq 4 \cdot 10^{-23}:\\
\;\;\;\;\frac{-1}{\sqrt{t\_0} \cdot x - 1}\\
\mathbf{else}:\\
\;\;\;\;1 + x \cdot \sqrt{\sqrt{t\_0 \cdot t\_0}}\\
\end{array}
if (*.f64 (*.f64 x y) y) < 3.9999999999999998e-23Initial program 100.0%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6466.1%
Applied rewrites66.1%
lift-+.f64N/A
+-commutativeN/A
flip-+N/A
lower-unsound-/.f64N/A
Applied rewrites54.1%
Taylor expanded in x around 0
Applied rewrites66.7%
rem-square-sqrtN/A
sqrt-unprodN/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
rem-square-sqrtN/A
sqrt-unprodN/A
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f6467.4%
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-unprodN/A
rem-square-sqrt68.0%
Applied rewrites68.0%
if 3.9999999999999998e-23 < (*.f64 (*.f64 x y) y) Initial program 100.0%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6466.1%
Applied rewrites66.1%
rem-square-sqrtN/A
sqrt-unprodN/A
lower-*.f32N/A
lower-unsound-*.f32N/A
lower-sqrt.f64N/A
lower-unsound-*.f6467.6%
lift-pow.f64N/A
unpow2N/A
lower-*.f6467.6%
lift-pow.f64N/A
unpow2N/A
lower-*.f6467.6%
Applied rewrites67.6%
rem-square-sqrtN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6467.3%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6467.3%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6467.3%
Applied rewrites67.3%
(FPCore (x y) :precision binary64 (if (<= (* (* x y) y) 4e-23) (/ -1.0 (- (* (sqrt (* (* (* y y) y) y)) x) 1.0)) (+ 1.0 (* x (sqrt (* (* y y) (* y y)))))))
double code(double x, double y) {
double tmp;
if (((x * y) * y) <= 4e-23) {
tmp = -1.0 / ((sqrt((((y * y) * y) * y)) * x) - 1.0);
} else {
tmp = 1.0 + (x * sqrt(((y * y) * (y * 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (((x * y) * y) <= 4d-23) then
tmp = (-1.0d0) / ((sqrt((((y * y) * y) * y)) * x) - 1.0d0)
else
tmp = 1.0d0 + (x * sqrt(((y * y) * (y * y))))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (((x * y) * y) <= 4e-23) {
tmp = -1.0 / ((Math.sqrt((((y * y) * y) * y)) * x) - 1.0);
} else {
tmp = 1.0 + (x * Math.sqrt(((y * y) * (y * y))));
}
return tmp;
}
def code(x, y): tmp = 0 if ((x * y) * y) <= 4e-23: tmp = -1.0 / ((math.sqrt((((y * y) * y) * y)) * x) - 1.0) else: tmp = 1.0 + (x * math.sqrt(((y * y) * (y * y)))) return tmp
function code(x, y) tmp = 0.0 if (Float64(Float64(x * y) * y) <= 4e-23) tmp = Float64(-1.0 / Float64(Float64(sqrt(Float64(Float64(Float64(y * y) * y) * y)) * x) - 1.0)); else tmp = Float64(1.0 + Float64(x * sqrt(Float64(Float64(y * y) * Float64(y * y))))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (((x * y) * y) <= 4e-23) tmp = -1.0 / ((sqrt((((y * y) * y) * y)) * x) - 1.0); else tmp = 1.0 + (x * sqrt(((y * y) * (y * y)))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[(N[(x * y), $MachinePrecision] * y), $MachinePrecision], 4e-23], N[(-1.0 / N[(N[(N[Sqrt[N[(N[(N[(y * y), $MachinePrecision] * y), $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x * N[Sqrt[N[(N[(y * y), $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left(x \cdot y\right) \cdot y \leq 4 \cdot 10^{-23}:\\
\;\;\;\;\frac{-1}{\sqrt{\left(\left(y \cdot y\right) \cdot y\right) \cdot y} \cdot x - 1}\\
\mathbf{else}:\\
\;\;\;\;1 + x \cdot \sqrt{\left(y \cdot y\right) \cdot \left(y \cdot y\right)}\\
\end{array}
if (*.f64 (*.f64 x y) y) < 3.9999999999999998e-23Initial program 100.0%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6466.1%
Applied rewrites66.1%
lift-+.f64N/A
+-commutativeN/A
flip-+N/A
lower-unsound-/.f64N/A
Applied rewrites54.1%
Taylor expanded in x around 0
Applied rewrites66.7%
rem-square-sqrtN/A
sqrt-unprodN/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
rem-square-sqrtN/A
sqrt-unprodN/A
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f6467.4%
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-unprodN/A
rem-square-sqrt68.0%
Applied rewrites68.0%
if 3.9999999999999998e-23 < (*.f64 (*.f64 x y) y) Initial program 100.0%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6466.1%
Applied rewrites66.1%
rem-square-sqrtN/A
sqrt-unprodN/A
lower-*.f32N/A
lower-unsound-*.f32N/A
lower-sqrt.f64N/A
lower-unsound-*.f6467.6%
lift-pow.f64N/A
unpow2N/A
lower-*.f6467.6%
lift-pow.f64N/A
unpow2N/A
lower-*.f6467.6%
Applied rewrites67.6%
(FPCore (x y) :precision binary64 (if (<= (exp (* (* x y) y)) 2.0) (/ -1.0 (- (* (* y y) x) 1.0)) (+ 1.0 (* x (sqrt (* (* y y) (* y y)))))))
double code(double x, double y) {
double tmp;
if (exp(((x * y) * y)) <= 2.0) {
tmp = -1.0 / (((y * y) * x) - 1.0);
} else {
tmp = 1.0 + (x * sqrt(((y * y) * (y * 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (exp(((x * y) * y)) <= 2.0d0) then
tmp = (-1.0d0) / (((y * y) * x) - 1.0d0)
else
tmp = 1.0d0 + (x * sqrt(((y * y) * (y * y))))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (Math.exp(((x * y) * y)) <= 2.0) {
tmp = -1.0 / (((y * y) * x) - 1.0);
} else {
tmp = 1.0 + (x * Math.sqrt(((y * y) * (y * y))));
}
return tmp;
}
def code(x, y): tmp = 0 if math.exp(((x * y) * y)) <= 2.0: tmp = -1.0 / (((y * y) * x) - 1.0) else: tmp = 1.0 + (x * math.sqrt(((y * y) * (y * y)))) return tmp
function code(x, y) tmp = 0.0 if (exp(Float64(Float64(x * y) * y)) <= 2.0) tmp = Float64(-1.0 / Float64(Float64(Float64(y * y) * x) - 1.0)); else tmp = Float64(1.0 + Float64(x * sqrt(Float64(Float64(y * y) * Float64(y * y))))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (exp(((x * y) * y)) <= 2.0) tmp = -1.0 / (((y * y) * x) - 1.0); else tmp = 1.0 + (x * sqrt(((y * y) * (y * y)))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[Exp[N[(N[(x * y), $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision], 2.0], N[(-1.0 / N[(N[(N[(y * y), $MachinePrecision] * x), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x * N[Sqrt[N[(N[(y * y), $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;e^{\left(x \cdot y\right) \cdot y} \leq 2:\\
\;\;\;\;\frac{-1}{\left(y \cdot y\right) \cdot x - 1}\\
\mathbf{else}:\\
\;\;\;\;1 + x \cdot \sqrt{\left(y \cdot y\right) \cdot \left(y \cdot y\right)}\\
\end{array}
if (exp.f64 (*.f64 (*.f64 x y) y)) < 2Initial program 100.0%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6466.1%
Applied rewrites66.1%
lift-+.f64N/A
+-commutativeN/A
flip-+N/A
lower-unsound-/.f64N/A
Applied rewrites54.1%
Taylor expanded in x around 0
Applied rewrites66.7%
if 2 < (exp.f64 (*.f64 (*.f64 x y) y)) Initial program 100.0%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6466.1%
Applied rewrites66.1%
rem-square-sqrtN/A
sqrt-unprodN/A
lower-*.f32N/A
lower-unsound-*.f32N/A
lower-sqrt.f64N/A
lower-unsound-*.f6467.6%
lift-pow.f64N/A
unpow2N/A
lower-*.f6467.6%
lift-pow.f64N/A
unpow2N/A
lower-*.f6467.6%
Applied rewrites67.6%
(FPCore (x y) :precision binary64 (let* ((t_0 (* (* y y) x))) (if (<= x -5.6e-295) (/ -1.0 (- t_0 1.0)) (- t_0 -1.0))))
double code(double x, double y) {
double t_0 = (y * y) * x;
double tmp;
if (x <= -5.6e-295) {
tmp = -1.0 / (t_0 - 1.0);
} else {
tmp = t_0 - -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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = (y * y) * x
if (x <= (-5.6d-295)) then
tmp = (-1.0d0) / (t_0 - 1.0d0)
else
tmp = t_0 - (-1.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (y * y) * x;
double tmp;
if (x <= -5.6e-295) {
tmp = -1.0 / (t_0 - 1.0);
} else {
tmp = t_0 - -1.0;
}
return tmp;
}
def code(x, y): t_0 = (y * y) * x tmp = 0 if x <= -5.6e-295: tmp = -1.0 / (t_0 - 1.0) else: tmp = t_0 - -1.0 return tmp
function code(x, y) t_0 = Float64(Float64(y * y) * x) tmp = 0.0 if (x <= -5.6e-295) tmp = Float64(-1.0 / Float64(t_0 - 1.0)); else tmp = Float64(t_0 - -1.0); end return tmp end
function tmp_2 = code(x, y) t_0 = (y * y) * x; tmp = 0.0; if (x <= -5.6e-295) tmp = -1.0 / (t_0 - 1.0); else tmp = t_0 - -1.0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(y * y), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -5.6e-295], N[(-1.0 / N[(t$95$0 - 1.0), $MachinePrecision]), $MachinePrecision], N[(t$95$0 - -1.0), $MachinePrecision]]]
\begin{array}{l}
t_0 := \left(y \cdot y\right) \cdot x\\
\mathbf{if}\;x \leq -5.6 \cdot 10^{-295}:\\
\;\;\;\;\frac{-1}{t\_0 - 1}\\
\mathbf{else}:\\
\;\;\;\;t\_0 - -1\\
\end{array}
if x < -5.5999999999999998e-295Initial program 100.0%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6466.1%
Applied rewrites66.1%
lift-+.f64N/A
+-commutativeN/A
flip-+N/A
lower-unsound-/.f64N/A
Applied rewrites54.1%
Taylor expanded in x around 0
Applied rewrites66.7%
if -5.5999999999999998e-295 < x Initial program 100.0%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6466.1%
Applied rewrites66.1%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
remove-double-negN/A
lower--.f64N/A
remove-double-negN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
metadata-eval66.1%
Applied rewrites66.1%
(FPCore (x y) :precision binary64 (if (<= x -5.6e-295) (/ -1.0 (- (* (* y x) y) 1.0)) (- (* (* y y) x) -1.0)))
double code(double x, double y) {
double tmp;
if (x <= -5.6e-295) {
tmp = -1.0 / (((y * x) * y) - 1.0);
} else {
tmp = ((y * y) * 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-5.6d-295)) then
tmp = (-1.0d0) / (((y * x) * y) - 1.0d0)
else
tmp = ((y * y) * x) - (-1.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -5.6e-295) {
tmp = -1.0 / (((y * x) * y) - 1.0);
} else {
tmp = ((y * y) * x) - -1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -5.6e-295: tmp = -1.0 / (((y * x) * y) - 1.0) else: tmp = ((y * y) * x) - -1.0 return tmp
function code(x, y) tmp = 0.0 if (x <= -5.6e-295) tmp = Float64(-1.0 / Float64(Float64(Float64(y * x) * y) - 1.0)); else tmp = Float64(Float64(Float64(y * y) * x) - -1.0); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -5.6e-295) tmp = -1.0 / (((y * x) * y) - 1.0); else tmp = ((y * y) * x) - -1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -5.6e-295], N[(-1.0 / N[(N[(N[(y * x), $MachinePrecision] * y), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y * y), $MachinePrecision] * x), $MachinePrecision] - -1.0), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;x \leq -5.6 \cdot 10^{-295}:\\
\;\;\;\;\frac{-1}{\left(y \cdot x\right) \cdot y - 1}\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot y\right) \cdot x - -1\\
\end{array}
if x < -5.5999999999999998e-295Initial program 100.0%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6466.1%
Applied rewrites66.1%
lift-+.f64N/A
+-commutativeN/A
flip-+N/A
lower-unsound-/.f64N/A
Applied rewrites54.1%
Taylor expanded in x around 0
Applied rewrites66.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f6463.3%
Applied rewrites63.3%
if -5.5999999999999998e-295 < x Initial program 100.0%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6466.1%
Applied rewrites66.1%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
remove-double-negN/A
lower--.f64N/A
remove-double-negN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
metadata-eval66.1%
Applied rewrites66.1%
(FPCore (x y) :precision binary64 (- (* (* y y) x) -1.0))
double code(double x, double y) {
return ((y * y) * 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((y * y) * x) - (-1.0d0)
end function
public static double code(double x, double y) {
return ((y * y) * x) - -1.0;
}
def code(x, y): return ((y * y) * x) - -1.0
function code(x, y) return Float64(Float64(Float64(y * y) * x) - -1.0) end
function tmp = code(x, y) tmp = ((y * y) * x) - -1.0; end
code[x_, y_] := N[(N[(N[(y * y), $MachinePrecision] * x), $MachinePrecision] - -1.0), $MachinePrecision]
\left(y \cdot y\right) \cdot x - -1
Initial program 100.0%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6466.1%
Applied rewrites66.1%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
remove-double-negN/A
lower--.f64N/A
remove-double-negN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
metadata-eval66.1%
Applied rewrites66.1%
(FPCore (x y) :precision binary64 (+ 1.0 (* (* y x) y)))
double code(double x, double y) {
return 1.0 + ((y * x) * y);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0 + ((y * x) * y)
end function
public static double code(double x, double y) {
return 1.0 + ((y * x) * y);
}
def code(x, y): return 1.0 + ((y * x) * y)
function code(x, y) return Float64(1.0 + Float64(Float64(y * x) * y)) end
function tmp = code(x, y) tmp = 1.0 + ((y * x) * y); end
code[x_, y_] := N[(1.0 + N[(N[(y * x), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]
1 + \left(y \cdot x\right) \cdot y
Initial program 100.0%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6466.1%
Applied rewrites66.1%
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6463.4%
Applied rewrites63.4%
(FPCore (x y) :precision binary64 1.0)
double code(double x, double y) {
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0
end function
public static double code(double x, double y) {
return 1.0;
}
def code(x, y): return 1.0
function code(x, y) return 1.0 end
function tmp = code(x, y) tmp = 1.0; end
code[x_, y_] := 1.0
1
Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites51.2%
herbie shell --seed 2025258
(FPCore (x y)
:name "Data.Random.Distribution.Normal:normalF from random-fu-0.2.6.2"
:precision binary64
(exp (* (* x y) y)))