
(FPCore (x y) :precision binary64 (/ (exp (* x (log (/ x (+ x y))))) x))
double code(double x, double y) {
return exp((x * log((x / (x + y))))) / x;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = exp((x * log((x / (x + y))))) / x
end function
public static double code(double x, double y) {
return Math.exp((x * Math.log((x / (x + y))))) / x;
}
def code(x, y): return math.exp((x * math.log((x / (x + y))))) / x
function code(x, y) return Float64(exp(Float64(x * log(Float64(x / Float64(x + y))))) / x) end
function tmp = code(x, y) tmp = exp((x * log((x / (x + y))))) / x; end
code[x_, y_] := N[(N[Exp[N[(x * N[Log[N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / x), $MachinePrecision]
\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}
Herbie found 7 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (/ (exp (* x (log (/ x (+ x y))))) x))
double code(double x, double y) {
return exp((x * log((x / (x + y))))) / x;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = exp((x * log((x / (x + y))))) / x
end function
public static double code(double x, double y) {
return Math.exp((x * Math.log((x / (x + y))))) / x;
}
def code(x, y): return math.exp((x * math.log((x / (x + y))))) / x
function code(x, y) return Float64(exp(Float64(x * log(Float64(x / Float64(x + y))))) / x) end
function tmp = code(x, y) tmp = exp((x * log((x / (x + y))))) / x; end
code[x_, y_] := N[(N[Exp[N[(x * N[Log[N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / x), $MachinePrecision]
\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}
(FPCore (x y) :precision binary64 (let* ((t_0 (/ (exp (- y)) x))) (if (<= x -3.9) t_0 (if (<= x 3.2) (/ 1.0 x) t_0))))
double code(double x, double y) {
double t_0 = exp(-y) / x;
double tmp;
if (x <= -3.9) {
tmp = t_0;
} else if (x <= 3.2) {
tmp = 1.0 / x;
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = exp(-y) / x
if (x <= (-3.9d0)) then
tmp = t_0
else if (x <= 3.2d0) then
tmp = 1.0d0 / x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = Math.exp(-y) / x;
double tmp;
if (x <= -3.9) {
tmp = t_0;
} else if (x <= 3.2) {
tmp = 1.0 / x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = math.exp(-y) / x tmp = 0 if x <= -3.9: tmp = t_0 elif x <= 3.2: tmp = 1.0 / x else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(exp(Float64(-y)) / x) tmp = 0.0 if (x <= -3.9) tmp = t_0; elseif (x <= 3.2) tmp = Float64(1.0 / x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = exp(-y) / x; tmp = 0.0; if (x <= -3.9) tmp = t_0; elseif (x <= 3.2) tmp = 1.0 / x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[Exp[(-y)], $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[x, -3.9], t$95$0, If[LessEqual[x, 3.2], N[(1.0 / x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \frac{e^{-y}}{x}\\
\mathbf{if}\;x \leq -3.9:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 3.2:\\
\;\;\;\;\frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if x < -3.8999999999999999 or 3.2000000000000002 < x Initial program 78.5%
Taylor expanded in x around inf
lower-*.f6483.2%
Applied rewrites83.2%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6483.2%
Applied rewrites83.2%
if -3.8999999999999999 < x < 3.2000000000000002Initial program 78.5%
Taylor expanded in x around 0
Applied rewrites75.3%
(FPCore (x y)
:precision binary64
(let* ((t_0
(/
1.0
(+
x
(*
y
(-
(*
-1.0
(* y (+ (* -1.0 x) (* x (+ 0.5 (* 0.5 (/ 1.0 x)))))))
(* -1.0 x)))))))
(if (<= x -5.2e+138)
t_0
(if (<= x -4.0)
(/ (/ (* (* (- 1.0 y) x) x) (* x x)) x)
(if (<= x 3.2e-17) (/ 1.0 x) t_0)))))double code(double x, double y) {
double t_0 = 1.0 / (x + (y * ((-1.0 * (y * ((-1.0 * x) + (x * (0.5 + (0.5 * (1.0 / x))))))) - (-1.0 * x))));
double tmp;
if (x <= -5.2e+138) {
tmp = t_0;
} else if (x <= -4.0) {
tmp = ((((1.0 - y) * x) * x) / (x * x)) / x;
} else if (x <= 3.2e-17) {
tmp = 1.0 / x;
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 / (x + (y * (((-1.0d0) * (y * (((-1.0d0) * x) + (x * (0.5d0 + (0.5d0 * (1.0d0 / x))))))) - ((-1.0d0) * x))))
if (x <= (-5.2d+138)) then
tmp = t_0
else if (x <= (-4.0d0)) then
tmp = ((((1.0d0 - y) * x) * x) / (x * x)) / x
else if (x <= 3.2d-17) then
tmp = 1.0d0 / x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 / (x + (y * ((-1.0 * (y * ((-1.0 * x) + (x * (0.5 + (0.5 * (1.0 / x))))))) - (-1.0 * x))));
double tmp;
if (x <= -5.2e+138) {
tmp = t_0;
} else if (x <= -4.0) {
tmp = ((((1.0 - y) * x) * x) / (x * x)) / x;
} else if (x <= 3.2e-17) {
tmp = 1.0 / x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 / (x + (y * ((-1.0 * (y * ((-1.0 * x) + (x * (0.5 + (0.5 * (1.0 / x))))))) - (-1.0 * x)))) tmp = 0 if x <= -5.2e+138: tmp = t_0 elif x <= -4.0: tmp = ((((1.0 - y) * x) * x) / (x * x)) / x elif x <= 3.2e-17: tmp = 1.0 / x else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 / Float64(x + Float64(y * Float64(Float64(-1.0 * Float64(y * Float64(Float64(-1.0 * x) + Float64(x * Float64(0.5 + Float64(0.5 * Float64(1.0 / x))))))) - Float64(-1.0 * x))))) tmp = 0.0 if (x <= -5.2e+138) tmp = t_0; elseif (x <= -4.0) tmp = Float64(Float64(Float64(Float64(Float64(1.0 - y) * x) * x) / Float64(x * x)) / x); elseif (x <= 3.2e-17) tmp = Float64(1.0 / x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 / (x + (y * ((-1.0 * (y * ((-1.0 * x) + (x * (0.5 + (0.5 * (1.0 / x))))))) - (-1.0 * x)))); tmp = 0.0; if (x <= -5.2e+138) tmp = t_0; elseif (x <= -4.0) tmp = ((((1.0 - y) * x) * x) / (x * x)) / x; elseif (x <= 3.2e-17) tmp = 1.0 / x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 / N[(x + N[(y * N[(N[(-1.0 * N[(y * N[(N[(-1.0 * x), $MachinePrecision] + N[(x * N[(0.5 + N[(0.5 * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(-1.0 * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -5.2e+138], t$95$0, If[LessEqual[x, -4.0], N[(N[(N[(N[(N[(1.0 - y), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 3.2e-17], N[(1.0 / x), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
t_0 := \frac{1}{x + y \cdot \left(-1 \cdot \left(y \cdot \left(-1 \cdot x + x \cdot \left(0.5 + 0.5 \cdot \frac{1}{x}\right)\right)\right) - -1 \cdot x\right)}\\
\mathbf{if}\;x \leq -5.2 \cdot 10^{+138}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -4:\\
\;\;\;\;\frac{\frac{\left(\left(1 - y\right) \cdot x\right) \cdot x}{x \cdot x}}{x}\\
\mathbf{elif}\;x \leq 3.2 \cdot 10^{-17}:\\
\;\;\;\;\frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if x < -5.2000000000000002e138 or 3.2000000000000002e-17 < x Initial program 78.5%
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-/.f6460.2%
Applied rewrites60.2%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6460.2%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6460.2%
Applied rewrites60.2%
Taylor expanded in x around inf
Applied rewrites64.4%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
Applied rewrites63.9%
if -5.2000000000000002e138 < x < -4Initial program 78.5%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f6459.1%
Applied rewrites59.1%
lift-+.f64N/A
lift-*.f64N/A
mul-1-negN/A
sub-flip-reverseN/A
lower--.f6459.1%
Applied rewrites59.1%
remove-double-negN/A
lift--.f64N/A
sub-negate-revN/A
*-inversesN/A
sub-to-fraction-revN/A
*-commutativeN/A
lift-*.f64N/A
sub-negate-revN/A
lift--.f64N/A
remove-double-negN/A
frac-2negN/A
distribute-frac-negN/A
frac-2negN/A
mult-flipN/A
*-inversesN/A
associate-/r*N/A
lift-*.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites34.6%
if -4 < x < 3.2000000000000002e-17Initial program 78.5%
Taylor expanded in x around 0
Applied rewrites75.3%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ 1.0 (+ x (* x y)))))
(if (<= x -7.5e+150)
t_0
(if (<= x -4.0)
(/ (/ (* (* (- 1.0 y) x) x) (* x x)) x)
(if (<= x 1.1e-11) (/ 1.0 x) t_0)))))double code(double x, double y) {
double t_0 = 1.0 / (x + (x * y));
double tmp;
if (x <= -7.5e+150) {
tmp = t_0;
} else if (x <= -4.0) {
tmp = ((((1.0 - y) * x) * x) / (x * x)) / x;
} else if (x <= 1.1e-11) {
tmp = 1.0 / x;
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 / (x + (x * y))
if (x <= (-7.5d+150)) then
tmp = t_0
else if (x <= (-4.0d0)) then
tmp = ((((1.0d0 - y) * x) * x) / (x * x)) / x
else if (x <= 1.1d-11) then
tmp = 1.0d0 / x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 / (x + (x * y));
double tmp;
if (x <= -7.5e+150) {
tmp = t_0;
} else if (x <= -4.0) {
tmp = ((((1.0 - y) * x) * x) / (x * x)) / x;
} else if (x <= 1.1e-11) {
tmp = 1.0 / x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 / (x + (x * y)) tmp = 0 if x <= -7.5e+150: tmp = t_0 elif x <= -4.0: tmp = ((((1.0 - y) * x) * x) / (x * x)) / x elif x <= 1.1e-11: tmp = 1.0 / x else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 / Float64(x + Float64(x * y))) tmp = 0.0 if (x <= -7.5e+150) tmp = t_0; elseif (x <= -4.0) tmp = Float64(Float64(Float64(Float64(Float64(1.0 - y) * x) * x) / Float64(x * x)) / x); elseif (x <= 1.1e-11) tmp = Float64(1.0 / x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 / (x + (x * y)); tmp = 0.0; if (x <= -7.5e+150) tmp = t_0; elseif (x <= -4.0) tmp = ((((1.0 - y) * x) * x) / (x * x)) / x; elseif (x <= 1.1e-11) tmp = 1.0 / x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 / N[(x + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -7.5e+150], t$95$0, If[LessEqual[x, -4.0], N[(N[(N[(N[(N[(1.0 - y), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 1.1e-11], N[(1.0 / x), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
t_0 := \frac{1}{x + x \cdot y}\\
\mathbf{if}\;x \leq -7.5 \cdot 10^{+150}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -4:\\
\;\;\;\;\frac{\frac{\left(\left(1 - y\right) \cdot x\right) \cdot x}{x \cdot x}}{x}\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{-11}:\\
\;\;\;\;\frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if x < -7.4999999999999998e150 or 1.1000000000000001e-11 < x Initial program 78.5%
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-/.f6460.2%
Applied rewrites60.2%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6460.2%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6460.2%
Applied rewrites60.2%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f6465.3%
Applied rewrites65.3%
if -7.4999999999999998e150 < x < -4Initial program 78.5%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f6459.1%
Applied rewrites59.1%
lift-+.f64N/A
lift-*.f64N/A
mul-1-negN/A
sub-flip-reverseN/A
lower--.f6459.1%
Applied rewrites59.1%
remove-double-negN/A
lift--.f64N/A
sub-negate-revN/A
*-inversesN/A
sub-to-fraction-revN/A
*-commutativeN/A
lift-*.f64N/A
sub-negate-revN/A
lift--.f64N/A
remove-double-negN/A
frac-2negN/A
distribute-frac-negN/A
frac-2negN/A
mult-flipN/A
*-inversesN/A
associate-/r*N/A
lift-*.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites34.6%
if -4 < x < 1.1000000000000001e-11Initial program 78.5%
Taylor expanded in x around 0
Applied rewrites75.3%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ 1.0 (+ x (* x y)))))
(if (<= x -2.05e+139)
t_0
(if (<= x -5.0)
(/ (* (- (* (- (* 0.5 y) 1.0) y) -1.0) x) (* x x))
(if (<= x 1.1e-11) (/ 1.0 x) t_0)))))double code(double x, double y) {
double t_0 = 1.0 / (x + (x * y));
double tmp;
if (x <= -2.05e+139) {
tmp = t_0;
} else if (x <= -5.0) {
tmp = (((((0.5 * y) - 1.0) * y) - -1.0) * x) / (x * x);
} else if (x <= 1.1e-11) {
tmp = 1.0 / x;
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 / (x + (x * y))
if (x <= (-2.05d+139)) then
tmp = t_0
else if (x <= (-5.0d0)) then
tmp = (((((0.5d0 * y) - 1.0d0) * y) - (-1.0d0)) * x) / (x * x)
else if (x <= 1.1d-11) then
tmp = 1.0d0 / x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 / (x + (x * y));
double tmp;
if (x <= -2.05e+139) {
tmp = t_0;
} else if (x <= -5.0) {
tmp = (((((0.5 * y) - 1.0) * y) - -1.0) * x) / (x * x);
} else if (x <= 1.1e-11) {
tmp = 1.0 / x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 / (x + (x * y)) tmp = 0 if x <= -2.05e+139: tmp = t_0 elif x <= -5.0: tmp = (((((0.5 * y) - 1.0) * y) - -1.0) * x) / (x * x) elif x <= 1.1e-11: tmp = 1.0 / x else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 / Float64(x + Float64(x * y))) tmp = 0.0 if (x <= -2.05e+139) tmp = t_0; elseif (x <= -5.0) tmp = Float64(Float64(Float64(Float64(Float64(Float64(0.5 * y) - 1.0) * y) - -1.0) * x) / Float64(x * x)); elseif (x <= 1.1e-11) tmp = Float64(1.0 / x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 / (x + (x * y)); tmp = 0.0; if (x <= -2.05e+139) tmp = t_0; elseif (x <= -5.0) tmp = (((((0.5 * y) - 1.0) * y) - -1.0) * x) / (x * x); elseif (x <= 1.1e-11) tmp = 1.0 / x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 / N[(x + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.05e+139], t$95$0, If[LessEqual[x, -5.0], N[(N[(N[(N[(N[(N[(0.5 * y), $MachinePrecision] - 1.0), $MachinePrecision] * y), $MachinePrecision] - -1.0), $MachinePrecision] * x), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.1e-11], N[(1.0 / x), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
t_0 := \frac{1}{x + x \cdot y}\\
\mathbf{if}\;x \leq -2.05 \cdot 10^{+139}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -5:\\
\;\;\;\;\frac{\left(\left(0.5 \cdot y - 1\right) \cdot y - -1\right) \cdot x}{x \cdot x}\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{-11}:\\
\;\;\;\;\frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if x < -2.0500000000000001e139 or 1.1000000000000001e-11 < x Initial program 78.5%
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-/.f6460.2%
Applied rewrites60.2%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6460.2%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6460.2%
Applied rewrites60.2%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f6465.3%
Applied rewrites65.3%
if -2.0500000000000001e139 < x < -5Initial program 78.5%
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-/.f6460.2%
Applied rewrites60.2%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6460.2%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6460.2%
Applied rewrites60.2%
Taylor expanded in x around inf
Applied rewrites64.4%
*-lft-identityN/A
*-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
div-flip-revN/A
rgt-mult-inverseN/A
mult-flip-revN/A
frac-timesN/A
lift-*.f64N/A
lower-/.f64N/A
Applied rewrites38.0%
if -5 < x < 1.1000000000000001e-11Initial program 78.5%
Taylor expanded in x around 0
Applied rewrites75.3%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ 1.0 (+ x (* x y)))))
(if (<= x -3e+204)
t_0
(if (<= x -5.0)
(/ (+ 1.0 (* y (- (* y 0.5) 1.0))) x)
(if (<= x 1.1e-11) (/ 1.0 x) t_0)))))double code(double x, double y) {
double t_0 = 1.0 / (x + (x * y));
double tmp;
if (x <= -3e+204) {
tmp = t_0;
} else if (x <= -5.0) {
tmp = (1.0 + (y * ((y * 0.5) - 1.0))) / x;
} else if (x <= 1.1e-11) {
tmp = 1.0 / x;
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 / (x + (x * y))
if (x <= (-3d+204)) then
tmp = t_0
else if (x <= (-5.0d0)) then
tmp = (1.0d0 + (y * ((y * 0.5d0) - 1.0d0))) / x
else if (x <= 1.1d-11) then
tmp = 1.0d0 / x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 / (x + (x * y));
double tmp;
if (x <= -3e+204) {
tmp = t_0;
} else if (x <= -5.0) {
tmp = (1.0 + (y * ((y * 0.5) - 1.0))) / x;
} else if (x <= 1.1e-11) {
tmp = 1.0 / x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 / (x + (x * y)) tmp = 0 if x <= -3e+204: tmp = t_0 elif x <= -5.0: tmp = (1.0 + (y * ((y * 0.5) - 1.0))) / x elif x <= 1.1e-11: tmp = 1.0 / x else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 / Float64(x + Float64(x * y))) tmp = 0.0 if (x <= -3e+204) tmp = t_0; elseif (x <= -5.0) tmp = Float64(Float64(1.0 + Float64(y * Float64(Float64(y * 0.5) - 1.0))) / x); elseif (x <= 1.1e-11) tmp = Float64(1.0 / x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 / (x + (x * y)); tmp = 0.0; if (x <= -3e+204) tmp = t_0; elseif (x <= -5.0) tmp = (1.0 + (y * ((y * 0.5) - 1.0))) / x; elseif (x <= 1.1e-11) tmp = 1.0 / x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 / N[(x + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3e+204], t$95$0, If[LessEqual[x, -5.0], N[(N[(1.0 + N[(y * N[(N[(y * 0.5), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 1.1e-11], N[(1.0 / x), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
t_0 := \frac{1}{x + x \cdot y}\\
\mathbf{if}\;x \leq -3 \cdot 10^{+204}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -5:\\
\;\;\;\;\frac{1 + y \cdot \left(y \cdot 0.5 - 1\right)}{x}\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{-11}:\\
\;\;\;\;\frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if x < -2.9999999999999998e204 or 1.1000000000000001e-11 < x Initial program 78.5%
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-/.f6460.2%
Applied rewrites60.2%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6460.2%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6460.2%
Applied rewrites60.2%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f6465.3%
Applied rewrites65.3%
if -2.9999999999999998e204 < x < -5Initial program 78.5%
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-/.f6460.2%
Applied rewrites60.2%
Taylor expanded in x around inf
Applied rewrites64.4%
if -5 < x < 1.1000000000000001e-11Initial program 78.5%
Taylor expanded in x around 0
Applied rewrites75.3%
(FPCore (x y) :precision binary64 (let* ((t_0 (/ 1.0 (+ x (* x y))))) (if (<= x -450.0) t_0 (if (<= x 1.1e-11) (/ 1.0 x) t_0))))
double code(double x, double y) {
double t_0 = 1.0 / (x + (x * y));
double tmp;
if (x <= -450.0) {
tmp = t_0;
} else if (x <= 1.1e-11) {
tmp = 1.0 / x;
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 / (x + (x * y))
if (x <= (-450.0d0)) then
tmp = t_0
else if (x <= 1.1d-11) then
tmp = 1.0d0 / x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 / (x + (x * y));
double tmp;
if (x <= -450.0) {
tmp = t_0;
} else if (x <= 1.1e-11) {
tmp = 1.0 / x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 / (x + (x * y)) tmp = 0 if x <= -450.0: tmp = t_0 elif x <= 1.1e-11: tmp = 1.0 / x else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 / Float64(x + Float64(x * y))) tmp = 0.0 if (x <= -450.0) tmp = t_0; elseif (x <= 1.1e-11) tmp = Float64(1.0 / x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 / (x + (x * y)); tmp = 0.0; if (x <= -450.0) tmp = t_0; elseif (x <= 1.1e-11) tmp = 1.0 / x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 / N[(x + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -450.0], t$95$0, If[LessEqual[x, 1.1e-11], N[(1.0 / x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \frac{1}{x + x \cdot y}\\
\mathbf{if}\;x \leq -450:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{-11}:\\
\;\;\;\;\frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if x < -450 or 1.1000000000000001e-11 < x Initial program 78.5%
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-/.f6460.2%
Applied rewrites60.2%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6460.2%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6460.2%
Applied rewrites60.2%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f6465.3%
Applied rewrites65.3%
if -450 < x < 1.1000000000000001e-11Initial program 78.5%
Taylor expanded in x around 0
Applied rewrites75.3%
(FPCore (x y) :precision binary64 (/ 1.0 x))
double code(double x, double y) {
return 1.0 / x;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0 / x
end function
public static double code(double x, double y) {
return 1.0 / x;
}
def code(x, y): return 1.0 / x
function code(x, y) return Float64(1.0 / x) end
function tmp = code(x, y) tmp = 1.0 / x; end
code[x_, y_] := N[(1.0 / x), $MachinePrecision]
\frac{1}{x}
Initial program 78.5%
Taylor expanded in x around 0
Applied rewrites75.3%
herbie shell --seed 2025258
(FPCore (x y)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, F"
:precision binary64
(/ (exp (* x (log (/ x (+ x y))))) x))