
(FPCore (x) :precision binary64 (/ (- (exp x) (exp (- x))) 2))
double code(double x) {
return (exp(x) - exp(-x)) / 2.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)
use fmin_fmax_functions
real(8), intent (in) :: x
code = (exp(x) - exp(-x)) / 2.0d0
end function
public static double code(double x) {
return (Math.exp(x) - Math.exp(-x)) / 2.0;
}
def code(x): return (math.exp(x) - math.exp(-x)) / 2.0
function code(x) return Float64(Float64(exp(x) - exp(Float64(-x))) / 2.0) end
function tmp = code(x) tmp = (exp(x) - exp(-x)) / 2.0; end
code[x_] := N[(N[(N[Exp[x], $MachinePrecision] - N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2), $MachinePrecision]
\frac{e^{x} - e^{-x}}{2}
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x) :precision binary64 (/ (- (exp x) (exp (- x))) 2))
double code(double x) {
return (exp(x) - exp(-x)) / 2.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)
use fmin_fmax_functions
real(8), intent (in) :: x
code = (exp(x) - exp(-x)) / 2.0d0
end function
public static double code(double x) {
return (Math.exp(x) - Math.exp(-x)) / 2.0;
}
def code(x): return (math.exp(x) - math.exp(-x)) / 2.0
function code(x) return Float64(Float64(exp(x) - exp(Float64(-x))) / 2.0) end
function tmp = code(x) tmp = (exp(x) - exp(-x)) / 2.0; end
code[x_] := N[(N[(N[Exp[x], $MachinePrecision] - N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2), $MachinePrecision]
\frac{e^{x} - e^{-x}}{2}
(FPCore (x)
:precision binary64
(let* ((t_0 (* (fabs x) (fabs x))))
(*
(copysign 1 x)
(if (<= (fabs x) 19/2)
(+ (* (* (fabs x) (- (* 1/120 t_0) -1/6)) t_0) (fabs x))
(* 1/2 (- (exp (fabs x)) (exp (- (fabs x)))))))))double code(double x) {
double t_0 = fabs(x) * fabs(x);
double tmp;
if (fabs(x) <= 9.5) {
tmp = ((fabs(x) * ((0.008333333333333333 * t_0) - -0.16666666666666666)) * t_0) + fabs(x);
} else {
tmp = 0.5 * (exp(fabs(x)) - exp(-fabs(x)));
}
return copysign(1.0, x) * tmp;
}
public static double code(double x) {
double t_0 = Math.abs(x) * Math.abs(x);
double tmp;
if (Math.abs(x) <= 9.5) {
tmp = ((Math.abs(x) * ((0.008333333333333333 * t_0) - -0.16666666666666666)) * t_0) + Math.abs(x);
} else {
tmp = 0.5 * (Math.exp(Math.abs(x)) - Math.exp(-Math.abs(x)));
}
return Math.copySign(1.0, x) * tmp;
}
def code(x): t_0 = math.fabs(x) * math.fabs(x) tmp = 0 if math.fabs(x) <= 9.5: tmp = ((math.fabs(x) * ((0.008333333333333333 * t_0) - -0.16666666666666666)) * t_0) + math.fabs(x) else: tmp = 0.5 * (math.exp(math.fabs(x)) - math.exp(-math.fabs(x))) return math.copysign(1.0, x) * tmp
function code(x) t_0 = Float64(abs(x) * abs(x)) tmp = 0.0 if (abs(x) <= 9.5) tmp = Float64(Float64(Float64(abs(x) * Float64(Float64(0.008333333333333333 * t_0) - -0.16666666666666666)) * t_0) + abs(x)); else tmp = Float64(0.5 * Float64(exp(abs(x)) - exp(Float64(-abs(x))))); end return Float64(copysign(1.0, x) * tmp) end
function tmp_2 = code(x) t_0 = abs(x) * abs(x); tmp = 0.0; if (abs(x) <= 9.5) tmp = ((abs(x) * ((0.008333333333333333 * t_0) - -0.16666666666666666)) * t_0) + abs(x); else tmp = 0.5 * (exp(abs(x)) - exp(-abs(x))); end tmp_2 = (sign(x) * abs(1.0)) * tmp; end
code[x_] := Block[{t$95$0 = N[(N[Abs[x], $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[x], $MachinePrecision], 19/2], N[(N[(N[(N[Abs[x], $MachinePrecision] * N[(N[(1/120 * t$95$0), $MachinePrecision] - -1/6), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] + N[Abs[x], $MachinePrecision]), $MachinePrecision], N[(1/2 * N[(N[Exp[N[Abs[x], $MachinePrecision]], $MachinePrecision] - N[Exp[(-N[Abs[x], $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
t_0 := \left|x\right| \cdot \left|x\right|\\
\mathsf{copysign}\left(1, x\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|x\right| \leq \frac{19}{2}:\\
\;\;\;\;\left(\left|x\right| \cdot \left(\frac{1}{120} \cdot t\_0 - \frac{-1}{6}\right)\right) \cdot t\_0 + \left|x\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{2} \cdot \left(e^{\left|x\right|} - e^{-\left|x\right|}\right)\\
\end{array}
\end{array}
if x < 9.5Initial program 55.3%
Taylor expanded in x around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6490.7%
Applied rewrites90.7%
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-rgt-inN/A
*-rgt-identityN/A
*-lft-identityN/A
lower-+.f64N/A
Applied rewrites90.7%
if 9.5 < x Initial program 55.3%
Taylor expanded in x around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6490.7%
Applied rewrites90.7%
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-rgt-inN/A
*-rgt-identityN/A
*-lft-identityN/A
lower-+.f64N/A
Applied rewrites90.7%
Taylor expanded in x around inf
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6455.3%
Applied rewrites55.3%
(FPCore (x)
:precision binary64
(let* ((t_0 (* (fabs x) (fabs x))))
(*
(copysign 1 x)
(if (<= (fabs x) 19/2)
(+ (* (* (fabs x) (- (* 1/120 t_0) -1/6)) t_0) (fabs x))
(* (- (exp (fabs x)) (- 1 (fabs x))) 1/2)))))double code(double x) {
double t_0 = fabs(x) * fabs(x);
double tmp;
if (fabs(x) <= 9.5) {
tmp = ((fabs(x) * ((0.008333333333333333 * t_0) - -0.16666666666666666)) * t_0) + fabs(x);
} else {
tmp = (exp(fabs(x)) - (1.0 - fabs(x))) * 0.5;
}
return copysign(1.0, x) * tmp;
}
public static double code(double x) {
double t_0 = Math.abs(x) * Math.abs(x);
double tmp;
if (Math.abs(x) <= 9.5) {
tmp = ((Math.abs(x) * ((0.008333333333333333 * t_0) - -0.16666666666666666)) * t_0) + Math.abs(x);
} else {
tmp = (Math.exp(Math.abs(x)) - (1.0 - Math.abs(x))) * 0.5;
}
return Math.copySign(1.0, x) * tmp;
}
def code(x): t_0 = math.fabs(x) * math.fabs(x) tmp = 0 if math.fabs(x) <= 9.5: tmp = ((math.fabs(x) * ((0.008333333333333333 * t_0) - -0.16666666666666666)) * t_0) + math.fabs(x) else: tmp = (math.exp(math.fabs(x)) - (1.0 - math.fabs(x))) * 0.5 return math.copysign(1.0, x) * tmp
function code(x) t_0 = Float64(abs(x) * abs(x)) tmp = 0.0 if (abs(x) <= 9.5) tmp = Float64(Float64(Float64(abs(x) * Float64(Float64(0.008333333333333333 * t_0) - -0.16666666666666666)) * t_0) + abs(x)); else tmp = Float64(Float64(exp(abs(x)) - Float64(1.0 - abs(x))) * 0.5); end return Float64(copysign(1.0, x) * tmp) end
function tmp_2 = code(x) t_0 = abs(x) * abs(x); tmp = 0.0; if (abs(x) <= 9.5) tmp = ((abs(x) * ((0.008333333333333333 * t_0) - -0.16666666666666666)) * t_0) + abs(x); else tmp = (exp(abs(x)) - (1.0 - abs(x))) * 0.5; end tmp_2 = (sign(x) * abs(1.0)) * tmp; end
code[x_] := Block[{t$95$0 = N[(N[Abs[x], $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[x], $MachinePrecision], 19/2], N[(N[(N[(N[Abs[x], $MachinePrecision] * N[(N[(1/120 * t$95$0), $MachinePrecision] - -1/6), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] + N[Abs[x], $MachinePrecision]), $MachinePrecision], N[(N[(N[Exp[N[Abs[x], $MachinePrecision]], $MachinePrecision] - N[(1 - N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 1/2), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
t_0 := \left|x\right| \cdot \left|x\right|\\
\mathsf{copysign}\left(1, x\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|x\right| \leq \frac{19}{2}:\\
\;\;\;\;\left(\left|x\right| \cdot \left(\frac{1}{120} \cdot t\_0 - \frac{-1}{6}\right)\right) \cdot t\_0 + \left|x\right|\\
\mathbf{else}:\\
\;\;\;\;\left(e^{\left|x\right|} - \left(1 - \left|x\right|\right)\right) \cdot \frac{1}{2}\\
\end{array}
\end{array}
if x < 9.5Initial program 55.3%
Taylor expanded in x around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6490.7%
Applied rewrites90.7%
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-rgt-inN/A
*-rgt-identityN/A
*-lft-identityN/A
lower-+.f64N/A
Applied rewrites90.7%
if 9.5 < x Initial program 55.3%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f6430.9%
Applied rewrites30.9%
lift-/.f64N/A
mult-flipN/A
lower-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
mul-1-negN/A
sub-flip-reverseN/A
*-rgt-identityN/A
lower--.f64N/A
*-rgt-identityN/A
*-rgt-identityN/A
Applied rewrites30.9%
(FPCore (x)
:precision binary64
(let* ((t_0 (* (fabs x) (fabs x)))
(t_1 (* (* t_0 (fabs x)) (fabs x))))
(*
(copysign 1 x)
(if (<= (fabs x) 25999999999999999036901235468997230592)
(+ (* (* (fabs x) (- (* 1/120 t_0) -1/6)) t_0) (fabs x))
(if (<=
(fabs x)
10000000000000000019156750857346687362159551272651920111528035145993793242039887559612361451081803235328)
(/
(*
(fabs x)
(- (* (* 1/36 (sqrt (* t_1 t_1))) (fabs x)) (fabs x)))
(- (* (* 1/6 t_0) (fabs x)) (fabs x)))
(* (fabs x) (+ 1 (* (* 1/6 (fabs x)) (fabs x)))))))))double code(double x) {
double t_0 = fabs(x) * fabs(x);
double t_1 = (t_0 * fabs(x)) * fabs(x);
double tmp;
if (fabs(x) <= 2.6e+37) {
tmp = ((fabs(x) * ((0.008333333333333333 * t_0) - -0.16666666666666666)) * t_0) + fabs(x);
} else if (fabs(x) <= 1e+103) {
tmp = (fabs(x) * (((0.027777777777777776 * sqrt((t_1 * t_1))) * fabs(x)) - fabs(x))) / (((0.16666666666666666 * t_0) * fabs(x)) - fabs(x));
} else {
tmp = fabs(x) * (1.0 + ((0.16666666666666666 * fabs(x)) * fabs(x)));
}
return copysign(1.0, x) * tmp;
}
public static double code(double x) {
double t_0 = Math.abs(x) * Math.abs(x);
double t_1 = (t_0 * Math.abs(x)) * Math.abs(x);
double tmp;
if (Math.abs(x) <= 2.6e+37) {
tmp = ((Math.abs(x) * ((0.008333333333333333 * t_0) - -0.16666666666666666)) * t_0) + Math.abs(x);
} else if (Math.abs(x) <= 1e+103) {
tmp = (Math.abs(x) * (((0.027777777777777776 * Math.sqrt((t_1 * t_1))) * Math.abs(x)) - Math.abs(x))) / (((0.16666666666666666 * t_0) * Math.abs(x)) - Math.abs(x));
} else {
tmp = Math.abs(x) * (1.0 + ((0.16666666666666666 * Math.abs(x)) * Math.abs(x)));
}
return Math.copySign(1.0, x) * tmp;
}
def code(x): t_0 = math.fabs(x) * math.fabs(x) t_1 = (t_0 * math.fabs(x)) * math.fabs(x) tmp = 0 if math.fabs(x) <= 2.6e+37: tmp = ((math.fabs(x) * ((0.008333333333333333 * t_0) - -0.16666666666666666)) * t_0) + math.fabs(x) elif math.fabs(x) <= 1e+103: tmp = (math.fabs(x) * (((0.027777777777777776 * math.sqrt((t_1 * t_1))) * math.fabs(x)) - math.fabs(x))) / (((0.16666666666666666 * t_0) * math.fabs(x)) - math.fabs(x)) else: tmp = math.fabs(x) * (1.0 + ((0.16666666666666666 * math.fabs(x)) * math.fabs(x))) return math.copysign(1.0, x) * tmp
function code(x) t_0 = Float64(abs(x) * abs(x)) t_1 = Float64(Float64(t_0 * abs(x)) * abs(x)) tmp = 0.0 if (abs(x) <= 2.6e+37) tmp = Float64(Float64(Float64(abs(x) * Float64(Float64(0.008333333333333333 * t_0) - -0.16666666666666666)) * t_0) + abs(x)); elseif (abs(x) <= 1e+103) tmp = Float64(Float64(abs(x) * Float64(Float64(Float64(0.027777777777777776 * sqrt(Float64(t_1 * t_1))) * abs(x)) - abs(x))) / Float64(Float64(Float64(0.16666666666666666 * t_0) * abs(x)) - abs(x))); else tmp = Float64(abs(x) * Float64(1.0 + Float64(Float64(0.16666666666666666 * abs(x)) * abs(x)))); end return Float64(copysign(1.0, x) * tmp) end
function tmp_2 = code(x) t_0 = abs(x) * abs(x); t_1 = (t_0 * abs(x)) * abs(x); tmp = 0.0; if (abs(x) <= 2.6e+37) tmp = ((abs(x) * ((0.008333333333333333 * t_0) - -0.16666666666666666)) * t_0) + abs(x); elseif (abs(x) <= 1e+103) tmp = (abs(x) * (((0.027777777777777776 * sqrt((t_1 * t_1))) * abs(x)) - abs(x))) / (((0.16666666666666666 * t_0) * abs(x)) - abs(x)); else tmp = abs(x) * (1.0 + ((0.16666666666666666 * abs(x)) * abs(x))); end tmp_2 = (sign(x) * abs(1.0)) * tmp; end
code[x_] := Block[{t$95$0 = N[(N[Abs[x], $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[x], $MachinePrecision], 25999999999999999036901235468997230592], N[(N[(N[(N[Abs[x], $MachinePrecision] * N[(N[(1/120 * t$95$0), $MachinePrecision] - -1/6), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] + N[Abs[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[x], $MachinePrecision], 10000000000000000019156750857346687362159551272651920111528035145993793242039887559612361451081803235328], N[(N[(N[Abs[x], $MachinePrecision] * N[(N[(N[(1/36 * N[Sqrt[N[(t$95$1 * t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] - N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(1/6 * t$95$0), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] - N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Abs[x], $MachinePrecision] * N[(1 + N[(N[(1/6 * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \left|x\right| \cdot \left|x\right|\\
t_1 := \left(t\_0 \cdot \left|x\right|\right) \cdot \left|x\right|\\
\mathsf{copysign}\left(1, x\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 25999999999999999036901235468997230592:\\
\;\;\;\;\left(\left|x\right| \cdot \left(\frac{1}{120} \cdot t\_0 - \frac{-1}{6}\right)\right) \cdot t\_0 + \left|x\right|\\
\mathbf{elif}\;\left|x\right| \leq 10000000000000000019156750857346687362159551272651920111528035145993793242039887559612361451081803235328:\\
\;\;\;\;\frac{\left|x\right| \cdot \left(\left(\frac{1}{36} \cdot \sqrt{t\_1 \cdot t\_1}\right) \cdot \left|x\right| - \left|x\right|\right)}{\left(\frac{1}{6} \cdot t\_0\right) \cdot \left|x\right| - \left|x\right|}\\
\mathbf{else}:\\
\;\;\;\;\left|x\right| \cdot \left(1 + \left(\frac{1}{6} \cdot \left|x\right|\right) \cdot \left|x\right|\right)\\
\end{array}
\end{array}
if x < 2.5999999999999999e37Initial program 55.3%
Taylor expanded in x around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6490.7%
Applied rewrites90.7%
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-rgt-inN/A
*-rgt-identityN/A
*-lft-identityN/A
lower-+.f64N/A
Applied rewrites90.7%
if 2.5999999999999999e37 < x < 1e103Initial program 55.3%
Taylor expanded in x around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6484.1%
Applied rewrites84.1%
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-rgt-inN/A
*-rgt-identityN/A
*-lft-identityN/A
flip-+N/A
lower-unsound-/.f64N/A
Applied rewrites35.9%
Applied rewrites35.9%
rem-square-sqrtN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6437.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
pow3N/A
lower-pow.f32N/A
lower-unsound-pow.f32N/A
lower-*.f64N/A
lower-unsound-pow.f3241.5%
lower-pow.f32N/A
pow3N/A
lift-*.f64N/A
lift-*.f6437.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
pow3N/A
lower-pow.f32N/A
lower-unsound-pow.f32N/A
lower-*.f64N/A
Applied rewrites37.8%
if 1e103 < x Initial program 55.3%
Taylor expanded in x around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6484.1%
Applied rewrites84.1%
lift-*.f64N/A
lift-pow.f64N/A
*-rgt-identityN/A
pow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-rgt-identityN/A
*-rgt-identity84.1%
Applied rewrites84.1%
(FPCore (x)
:precision binary64
(let* ((t_0 (* (fabs x) (fabs x)))
(t_1 (- (* 1/120 t_0) -1/6))
(t_2 (* (* t_1 (fabs x)) (fabs x))))
(*
(copysign 1 x)
(if (<=
(fabs x)
39999999999999997975485411882960754678545800440536402923356160)
(* (fabs x) (/ (- (* t_2 t_2) (* 1 1)) (- t_2 1)))
(* (fabs x) (+ 1 (* t_1 t_0)))))))double code(double x) {
double t_0 = fabs(x) * fabs(x);
double t_1 = (0.008333333333333333 * t_0) - -0.16666666666666666;
double t_2 = (t_1 * fabs(x)) * fabs(x);
double tmp;
if (fabs(x) <= 4e+61) {
tmp = fabs(x) * (((t_2 * t_2) - (1.0 * 1.0)) / (t_2 - 1.0));
} else {
tmp = fabs(x) * (1.0 + (t_1 * t_0));
}
return copysign(1.0, x) * tmp;
}
public static double code(double x) {
double t_0 = Math.abs(x) * Math.abs(x);
double t_1 = (0.008333333333333333 * t_0) - -0.16666666666666666;
double t_2 = (t_1 * Math.abs(x)) * Math.abs(x);
double tmp;
if (Math.abs(x) <= 4e+61) {
tmp = Math.abs(x) * (((t_2 * t_2) - (1.0 * 1.0)) / (t_2 - 1.0));
} else {
tmp = Math.abs(x) * (1.0 + (t_1 * t_0));
}
return Math.copySign(1.0, x) * tmp;
}
def code(x): t_0 = math.fabs(x) * math.fabs(x) t_1 = (0.008333333333333333 * t_0) - -0.16666666666666666 t_2 = (t_1 * math.fabs(x)) * math.fabs(x) tmp = 0 if math.fabs(x) <= 4e+61: tmp = math.fabs(x) * (((t_2 * t_2) - (1.0 * 1.0)) / (t_2 - 1.0)) else: tmp = math.fabs(x) * (1.0 + (t_1 * t_0)) return math.copysign(1.0, x) * tmp
function code(x) t_0 = Float64(abs(x) * abs(x)) t_1 = Float64(Float64(0.008333333333333333 * t_0) - -0.16666666666666666) t_2 = Float64(Float64(t_1 * abs(x)) * abs(x)) tmp = 0.0 if (abs(x) <= 4e+61) tmp = Float64(abs(x) * Float64(Float64(Float64(t_2 * t_2) - Float64(1.0 * 1.0)) / Float64(t_2 - 1.0))); else tmp = Float64(abs(x) * Float64(1.0 + Float64(t_1 * t_0))); end return Float64(copysign(1.0, x) * tmp) end
function tmp_2 = code(x) t_0 = abs(x) * abs(x); t_1 = (0.008333333333333333 * t_0) - -0.16666666666666666; t_2 = (t_1 * abs(x)) * abs(x); tmp = 0.0; if (abs(x) <= 4e+61) tmp = abs(x) * (((t_2 * t_2) - (1.0 * 1.0)) / (t_2 - 1.0)); else tmp = abs(x) * (1.0 + (t_1 * t_0)); end tmp_2 = (sign(x) * abs(1.0)) * tmp; end
code[x_] := Block[{t$95$0 = N[(N[Abs[x], $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(1/120 * t$95$0), $MachinePrecision] - -1/6), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t$95$1 * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[x], $MachinePrecision], 39999999999999997975485411882960754678545800440536402923356160], N[(N[Abs[x], $MachinePrecision] * N[(N[(N[(t$95$2 * t$95$2), $MachinePrecision] - N[(1 * 1), $MachinePrecision]), $MachinePrecision] / N[(t$95$2 - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Abs[x], $MachinePrecision] * N[(1 + N[(t$95$1 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \left|x\right| \cdot \left|x\right|\\
t_1 := \frac{1}{120} \cdot t\_0 - \frac{-1}{6}\\
t_2 := \left(t\_1 \cdot \left|x\right|\right) \cdot \left|x\right|\\
\mathsf{copysign}\left(1, x\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 39999999999999997975485411882960754678545800440536402923356160:\\
\;\;\;\;\left|x\right| \cdot \frac{t\_2 \cdot t\_2 - 1 \cdot 1}{t\_2 - 1}\\
\mathbf{else}:\\
\;\;\;\;\left|x\right| \cdot \left(1 + t\_1 \cdot t\_0\right)\\
\end{array}
\end{array}
if x < 3.9999999999999998e61Initial program 55.3%
Taylor expanded in x around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6490.7%
Applied rewrites90.7%
lift-+.f64N/A
+-commutativeN/A
flip-+N/A
lower-unsound-/.f64N/A
Applied rewrites55.2%
if 3.9999999999999998e61 < x Initial program 55.3%
Taylor expanded in x around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6490.7%
Applied rewrites90.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.7%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
lower--.f64N/A
lift-pow.f64N/A
*-rgt-identityN/A
pow2N/A
lower-*.f64N/A
*-rgt-identityN/A
*-rgt-identityN/A
metadata-eval90.7%
lift-pow.f64N/A
*-rgt-identityN/A
pow2N/A
lower-*.f64N/A
*-rgt-identityN/A
*-rgt-identity90.7%
Applied rewrites90.7%
(FPCore (x) :precision binary64 (+ (* (* x (- (* 1/120 (* x x)) -1/6)) (* x x)) x))
double code(double x) {
return ((x * ((0.008333333333333333 * (x * x)) - -0.16666666666666666)) * (x * x)) + 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)
use fmin_fmax_functions
real(8), intent (in) :: x
code = ((x * ((0.008333333333333333d0 * (x * x)) - (-0.16666666666666666d0))) * (x * x)) + x
end function
public static double code(double x) {
return ((x * ((0.008333333333333333 * (x * x)) - -0.16666666666666666)) * (x * x)) + x;
}
def code(x): return ((x * ((0.008333333333333333 * (x * x)) - -0.16666666666666666)) * (x * x)) + x
function code(x) return Float64(Float64(Float64(x * Float64(Float64(0.008333333333333333 * Float64(x * x)) - -0.16666666666666666)) * Float64(x * x)) + x) end
function tmp = code(x) tmp = ((x * ((0.008333333333333333 * (x * x)) - -0.16666666666666666)) * (x * x)) + x; end
code[x_] := N[(N[(N[(x * N[(N[(1/120 * N[(x * x), $MachinePrecision]), $MachinePrecision] - -1/6), $MachinePrecision]), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\left(x \cdot \left(\frac{1}{120} \cdot \left(x \cdot x\right) - \frac{-1}{6}\right)\right) \cdot \left(x \cdot x\right) + x
Initial program 55.3%
Taylor expanded in x around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6490.7%
Applied rewrites90.7%
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-rgt-inN/A
*-rgt-identityN/A
*-lft-identityN/A
lower-+.f64N/A
Applied rewrites90.7%
(FPCore (x) :precision binary64 (* x (+ 1 (* (- (* 1/120 (* x x)) -1/6) (* x x)))))
double code(double x) {
return x * (1.0 + (((0.008333333333333333 * (x * x)) - -0.16666666666666666) * (x * 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)
use fmin_fmax_functions
real(8), intent (in) :: x
code = x * (1.0d0 + (((0.008333333333333333d0 * (x * x)) - (-0.16666666666666666d0)) * (x * x)))
end function
public static double code(double x) {
return x * (1.0 + (((0.008333333333333333 * (x * x)) - -0.16666666666666666) * (x * x)));
}
def code(x): return x * (1.0 + (((0.008333333333333333 * (x * x)) - -0.16666666666666666) * (x * x)))
function code(x) return Float64(x * Float64(1.0 + Float64(Float64(Float64(0.008333333333333333 * Float64(x * x)) - -0.16666666666666666) * Float64(x * x)))) end
function tmp = code(x) tmp = x * (1.0 + (((0.008333333333333333 * (x * x)) - -0.16666666666666666) * (x * x))); end
code[x_] := N[(x * N[(1 + N[(N[(N[(1/120 * N[(x * x), $MachinePrecision]), $MachinePrecision] - -1/6), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x \cdot \left(1 + \left(\frac{1}{120} \cdot \left(x \cdot x\right) - \frac{-1}{6}\right) \cdot \left(x \cdot x\right)\right)
Initial program 55.3%
Taylor expanded in x around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6490.7%
Applied rewrites90.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.7%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
lower--.f64N/A
lift-pow.f64N/A
*-rgt-identityN/A
pow2N/A
lower-*.f64N/A
*-rgt-identityN/A
*-rgt-identityN/A
metadata-eval90.7%
lift-pow.f64N/A
*-rgt-identityN/A
pow2N/A
lower-*.f64N/A
*-rgt-identityN/A
*-rgt-identity90.7%
Applied rewrites90.7%
(FPCore (x) :precision binary64 (+ (* (* x 1/6) (* x x)) x))
double code(double x) {
return ((x * 0.16666666666666666) * (x * x)) + 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)
use fmin_fmax_functions
real(8), intent (in) :: x
code = ((x * 0.16666666666666666d0) * (x * x)) + x
end function
public static double code(double x) {
return ((x * 0.16666666666666666) * (x * x)) + x;
}
def code(x): return ((x * 0.16666666666666666) * (x * x)) + x
function code(x) return Float64(Float64(Float64(x * 0.16666666666666666) * Float64(x * x)) + x) end
function tmp = code(x) tmp = ((x * 0.16666666666666666) * (x * x)) + x; end
code[x_] := N[(N[(N[(x * 1/6), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\left(x \cdot \frac{1}{6}\right) \cdot \left(x \cdot x\right) + x
Initial program 55.3%
Taylor expanded in x around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6490.7%
Applied rewrites90.7%
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-rgt-inN/A
*-rgt-identityN/A
*-lft-identityN/A
lower-+.f64N/A
Applied rewrites90.7%
Taylor expanded in x around 0
Applied rewrites84.1%
(FPCore (x) :precision binary64 (* x (+ 1 (* (* 1/6 x) x))))
double code(double x) {
return x * (1.0 + ((0.16666666666666666 * x) * 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)
use fmin_fmax_functions
real(8), intent (in) :: x
code = x * (1.0d0 + ((0.16666666666666666d0 * x) * x))
end function
public static double code(double x) {
return x * (1.0 + ((0.16666666666666666 * x) * x));
}
def code(x): return x * (1.0 + ((0.16666666666666666 * x) * x))
function code(x) return Float64(x * Float64(1.0 + Float64(Float64(0.16666666666666666 * x) * x))) end
function tmp = code(x) tmp = x * (1.0 + ((0.16666666666666666 * x) * x)); end
code[x_] := N[(x * N[(1 + N[(N[(1/6 * x), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x \cdot \left(1 + \left(\frac{1}{6} \cdot x\right) \cdot x\right)
Initial program 55.3%
Taylor expanded in x around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6484.1%
Applied rewrites84.1%
lift-*.f64N/A
lift-pow.f64N/A
*-rgt-identityN/A
pow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-rgt-identityN/A
*-rgt-identity84.1%
Applied rewrites84.1%
(FPCore (x) :precision binary64 (* x 1))
double code(double x) {
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)
use fmin_fmax_functions
real(8), intent (in) :: x
code = x * 1.0d0
end function
public static double code(double x) {
return x * 1.0;
}
def code(x): return x * 1.0
function code(x) return Float64(x * 1.0) end
function tmp = code(x) tmp = x * 1.0; end
code[x_] := N[(x * 1), $MachinePrecision]
x \cdot 1
Initial program 55.3%
Taylor expanded in x around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6490.7%
Applied rewrites90.7%
Taylor expanded in x around 0
Applied rewrites51.0%
herbie shell --seed 2025271 -o generate:evaluate
(FPCore (x)
:name "Hyperbolic sine"
:precision binary64
(/ (- (exp x) (exp (- x))) 2))