
(FPCore (z0) :precision binary64 (sqrt (fabs (log (- 1.0 z0)))))
double code(double z0) {
return sqrt(fabs(log((1.0 - z0))));
}
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(z0)
use fmin_fmax_functions
real(8), intent (in) :: z0
code = sqrt(abs(log((1.0d0 - z0))))
end function
public static double code(double z0) {
return Math.sqrt(Math.abs(Math.log((1.0 - z0))));
}
def code(z0): return math.sqrt(math.fabs(math.log((1.0 - z0))))
function code(z0) return sqrt(abs(log(Float64(1.0 - z0)))) end
function tmp = code(z0) tmp = sqrt(abs(log((1.0 - z0)))); end
code[z0_] := N[Sqrt[N[Abs[N[Log[N[(1.0 - z0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]
\sqrt{\left|\log \left(1 - z0\right)\right|}
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (z0) :precision binary64 (sqrt (fabs (log (- 1.0 z0)))))
double code(double z0) {
return sqrt(fabs(log((1.0 - z0))));
}
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(z0)
use fmin_fmax_functions
real(8), intent (in) :: z0
code = sqrt(abs(log((1.0d0 - z0))))
end function
public static double code(double z0) {
return Math.sqrt(Math.abs(Math.log((1.0 - z0))));
}
def code(z0): return math.sqrt(math.fabs(math.log((1.0 - z0))))
function code(z0) return sqrt(abs(log(Float64(1.0 - z0)))) end
function tmp = code(z0) tmp = sqrt(abs(log((1.0 - z0)))); end
code[z0_] := N[Sqrt[N[Abs[N[Log[N[(1.0 - z0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]
\sqrt{\left|\log \left(1 - z0\right)\right|}
(FPCore (z0)
:precision binary64
(let* ((t_0 (sqrt (fabs (log (- 1.0 z0))))) (t_1 (/ 1.0 t_0)))
(if (<= t_0 0.0002)
(sqrt
(fabs (- (* (* (- (* -0.3333333333333333 z0) 0.5) z0) z0) z0)))
(+ (* (- t_0 t_1) 0.5) (* (+ t_0 t_1) 0.5)))))double code(double z0) {
double t_0 = sqrt(fabs(log((1.0 - z0))));
double t_1 = 1.0 / t_0;
double tmp;
if (t_0 <= 0.0002) {
tmp = sqrt(fabs((((((-0.3333333333333333 * z0) - 0.5) * z0) * z0) - z0)));
} else {
tmp = ((t_0 - t_1) * 0.5) + ((t_0 + t_1) * 0.5);
}
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(z0)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sqrt(abs(log((1.0d0 - z0))))
t_1 = 1.0d0 / t_0
if (t_0 <= 0.0002d0) then
tmp = sqrt(abs(((((((-0.3333333333333333d0) * z0) - 0.5d0) * z0) * z0) - z0)))
else
tmp = ((t_0 - t_1) * 0.5d0) + ((t_0 + t_1) * 0.5d0)
end if
code = tmp
end function
public static double code(double z0) {
double t_0 = Math.sqrt(Math.abs(Math.log((1.0 - z0))));
double t_1 = 1.0 / t_0;
double tmp;
if (t_0 <= 0.0002) {
tmp = Math.sqrt(Math.abs((((((-0.3333333333333333 * z0) - 0.5) * z0) * z0) - z0)));
} else {
tmp = ((t_0 - t_1) * 0.5) + ((t_0 + t_1) * 0.5);
}
return tmp;
}
def code(z0): t_0 = math.sqrt(math.fabs(math.log((1.0 - z0)))) t_1 = 1.0 / t_0 tmp = 0 if t_0 <= 0.0002: tmp = math.sqrt(math.fabs((((((-0.3333333333333333 * z0) - 0.5) * z0) * z0) - z0))) else: tmp = ((t_0 - t_1) * 0.5) + ((t_0 + t_1) * 0.5) return tmp
function code(z0) t_0 = sqrt(abs(log(Float64(1.0 - z0)))) t_1 = Float64(1.0 / t_0) tmp = 0.0 if (t_0 <= 0.0002) tmp = sqrt(abs(Float64(Float64(Float64(Float64(Float64(-0.3333333333333333 * z0) - 0.5) * z0) * z0) - z0))); else tmp = Float64(Float64(Float64(t_0 - t_1) * 0.5) + Float64(Float64(t_0 + t_1) * 0.5)); end return tmp end
function tmp_2 = code(z0) t_0 = sqrt(abs(log((1.0 - z0)))); t_1 = 1.0 / t_0; tmp = 0.0; if (t_0 <= 0.0002) tmp = sqrt(abs((((((-0.3333333333333333 * z0) - 0.5) * z0) * z0) - z0))); else tmp = ((t_0 - t_1) * 0.5) + ((t_0 + t_1) * 0.5); end tmp_2 = tmp; end
code[z0_] := Block[{t$95$0 = N[Sqrt[N[Abs[N[Log[N[(1.0 - z0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(1.0 / t$95$0), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0002], N[Sqrt[N[Abs[N[(N[(N[(N[(N[(-0.3333333333333333 * z0), $MachinePrecision] - 0.5), $MachinePrecision] * z0), $MachinePrecision] * z0), $MachinePrecision] - z0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[(N[(N[(t$95$0 - t$95$1), $MachinePrecision] * 0.5), $MachinePrecision] + N[(N[(t$95$0 + t$95$1), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \sqrt{\left|\log \left(1 - z0\right)\right|}\\
t_1 := \frac{1}{t\_0}\\
\mathbf{if}\;t\_0 \leq 0.0002:\\
\;\;\;\;\sqrt{\left|\left(\left(-0.3333333333333333 \cdot z0 - 0.5\right) \cdot z0\right) \cdot z0 - z0\right|}\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 - t\_1\right) \cdot 0.5 + \left(t\_0 + t\_1\right) \cdot 0.5\\
\end{array}
if (sqrt.f64 (fabs.f64 (log.f64 (-.f64 #s(literal 1 binary64) z0)))) < 2.0000000000000001e-4Initial program 37.1%
Taylor expanded in z0 around 0
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6468.5%
Applied rewrites68.5%
lift-*.f64N/A
lift--.f64N/A
sub-flipN/A
metadata-evalN/A
distribute-rgt-inN/A
mul-1-negN/A
sub-flip-reverseN/A
lower--.f64N/A
lower-*.f6468.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6468.5%
Applied rewrites68.5%
if 2.0000000000000001e-4 < (sqrt.f64 (fabs.f64 (log.f64 (-.f64 #s(literal 1 binary64) z0)))) Initial program 37.1%
remove-double-negN/A
lift-log.f64N/A
neg-logN/A
neg-logN/A
*-inversesN/A
associate-/l/N/A
div-flip-revN/A
log-divN/A
lower-unsound--.f64N/A
lower-unsound-log.f64N/A
lower-*.f64N/A
cosh-undefN/A
cosh-0-revN/A
metadata-evalN/A
lower-unsound-log.f64N/A
cosh-undefN/A
Applied rewrites37.1%
lift-sqrt.f64N/A
pow1/2N/A
remove-double-negN/A
pow-negN/A
Applied rewrites37.1%
lift-/.f64N/A
lift-pow.f64N/A
pow-flipN/A
metadata-evalN/A
exp-to-powN/A
lift-log.f64N/A
lift-*.f64N/A
sinh-+-cosh-revN/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites34.6%
(FPCore (z0)
:precision binary64
(let* ((t_0 (sqrt (fabs (log (- 1.0 z0))))))
(if (<= t_0 0.0002)
(sqrt
(fabs (- (* (* (- (* -0.3333333333333333 z0) 0.5) z0) z0) z0)))
t_0)))double code(double z0) {
double t_0 = sqrt(fabs(log((1.0 - z0))));
double tmp;
if (t_0 <= 0.0002) {
tmp = sqrt(fabs((((((-0.3333333333333333 * z0) - 0.5) * z0) * z0) - z0)));
} 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(z0)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt(abs(log((1.0d0 - z0))))
if (t_0 <= 0.0002d0) then
tmp = sqrt(abs(((((((-0.3333333333333333d0) * z0) - 0.5d0) * z0) * z0) - z0)))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double z0) {
double t_0 = Math.sqrt(Math.abs(Math.log((1.0 - z0))));
double tmp;
if (t_0 <= 0.0002) {
tmp = Math.sqrt(Math.abs((((((-0.3333333333333333 * z0) - 0.5) * z0) * z0) - z0)));
} else {
tmp = t_0;
}
return tmp;
}
def code(z0): t_0 = math.sqrt(math.fabs(math.log((1.0 - z0)))) tmp = 0 if t_0 <= 0.0002: tmp = math.sqrt(math.fabs((((((-0.3333333333333333 * z0) - 0.5) * z0) * z0) - z0))) else: tmp = t_0 return tmp
function code(z0) t_0 = sqrt(abs(log(Float64(1.0 - z0)))) tmp = 0.0 if (t_0 <= 0.0002) tmp = sqrt(abs(Float64(Float64(Float64(Float64(Float64(-0.3333333333333333 * z0) - 0.5) * z0) * z0) - z0))); else tmp = t_0; end return tmp end
function tmp_2 = code(z0) t_0 = sqrt(abs(log((1.0 - z0)))); tmp = 0.0; if (t_0 <= 0.0002) tmp = sqrt(abs((((((-0.3333333333333333 * z0) - 0.5) * z0) * z0) - z0))); else tmp = t_0; end tmp_2 = tmp; end
code[z0_] := Block[{t$95$0 = N[Sqrt[N[Abs[N[Log[N[(1.0 - z0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, 0.0002], N[Sqrt[N[Abs[N[(N[(N[(N[(N[(-0.3333333333333333 * z0), $MachinePrecision] - 0.5), $MachinePrecision] * z0), $MachinePrecision] * z0), $MachinePrecision] - z0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], t$95$0]]
\begin{array}{l}
t_0 := \sqrt{\left|\log \left(1 - z0\right)\right|}\\
\mathbf{if}\;t\_0 \leq 0.0002:\\
\;\;\;\;\sqrt{\left|\left(\left(-0.3333333333333333 \cdot z0 - 0.5\right) \cdot z0\right) \cdot z0 - z0\right|}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if (sqrt.f64 (fabs.f64 (log.f64 (-.f64 #s(literal 1 binary64) z0)))) < 2.0000000000000001e-4Initial program 37.1%
Taylor expanded in z0 around 0
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6468.5%
Applied rewrites68.5%
lift-*.f64N/A
lift--.f64N/A
sub-flipN/A
metadata-evalN/A
distribute-rgt-inN/A
mul-1-negN/A
sub-flip-reverseN/A
lower--.f64N/A
lower-*.f6468.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6468.5%
Applied rewrites68.5%
if 2.0000000000000001e-4 < (sqrt.f64 (fabs.f64 (log.f64 (-.f64 #s(literal 1 binary64) z0)))) Initial program 37.1%
(FPCore (z0) :precision binary64 (sqrt (fabs (- (* (* (- (* (- (* -0.25 z0) 0.3333333333333333) z0) 0.5) z0) z0) z0))))
double code(double z0) {
return sqrt(fabs((((((((-0.25 * z0) - 0.3333333333333333) * z0) - 0.5) * z0) * z0) - z0)));
}
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(z0)
use fmin_fmax_functions
real(8), intent (in) :: z0
code = sqrt(abs(((((((((-0.25d0) * z0) - 0.3333333333333333d0) * z0) - 0.5d0) * z0) * z0) - z0)))
end function
public static double code(double z0) {
return Math.sqrt(Math.abs((((((((-0.25 * z0) - 0.3333333333333333) * z0) - 0.5) * z0) * z0) - z0)));
}
def code(z0): return math.sqrt(math.fabs((((((((-0.25 * z0) - 0.3333333333333333) * z0) - 0.5) * z0) * z0) - z0)))
function code(z0) return sqrt(abs(Float64(Float64(Float64(Float64(Float64(Float64(Float64(-0.25 * z0) - 0.3333333333333333) * z0) - 0.5) * z0) * z0) - z0))) end
function tmp = code(z0) tmp = sqrt(abs((((((((-0.25 * z0) - 0.3333333333333333) * z0) - 0.5) * z0) * z0) - z0))); end
code[z0_] := N[Sqrt[N[Abs[N[(N[(N[(N[(N[(N[(N[(-0.25 * z0), $MachinePrecision] - 0.3333333333333333), $MachinePrecision] * z0), $MachinePrecision] - 0.5), $MachinePrecision] * z0), $MachinePrecision] * z0), $MachinePrecision] - z0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]
\sqrt{\left|\left(\left(\left(-0.25 \cdot z0 - 0.3333333333333333\right) \cdot z0 - 0.5\right) \cdot z0\right) \cdot z0 - z0\right|}
Initial program 37.1%
Taylor expanded in z0 around 0
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6468.5%
Applied rewrites68.5%
lift-*.f64N/A
lift--.f64N/A
sub-flipN/A
metadata-evalN/A
distribute-rgt-inN/A
mul-1-negN/A
sub-flip-reverseN/A
lower--.f64N/A
lower-*.f6468.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6468.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6468.5%
Applied rewrites68.5%
(FPCore (z0)
:precision binary64
(sqrt
(fabs
(*
z0
(-
(* z0 (- (* z0 (- (* -0.25 z0) 0.3333333333333333)) 0.5))
1.0)))))double code(double z0) {
return sqrt(fabs((z0 * ((z0 * ((z0 * ((-0.25 * z0) - 0.3333333333333333)) - 0.5)) - 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(z0)
use fmin_fmax_functions
real(8), intent (in) :: z0
code = sqrt(abs((z0 * ((z0 * ((z0 * (((-0.25d0) * z0) - 0.3333333333333333d0)) - 0.5d0)) - 1.0d0))))
end function
public static double code(double z0) {
return Math.sqrt(Math.abs((z0 * ((z0 * ((z0 * ((-0.25 * z0) - 0.3333333333333333)) - 0.5)) - 1.0))));
}
def code(z0): return math.sqrt(math.fabs((z0 * ((z0 * ((z0 * ((-0.25 * z0) - 0.3333333333333333)) - 0.5)) - 1.0))))
function code(z0) return sqrt(abs(Float64(z0 * Float64(Float64(z0 * Float64(Float64(z0 * Float64(Float64(-0.25 * z0) - 0.3333333333333333)) - 0.5)) - 1.0)))) end
function tmp = code(z0) tmp = sqrt(abs((z0 * ((z0 * ((z0 * ((-0.25 * z0) - 0.3333333333333333)) - 0.5)) - 1.0)))); end
code[z0_] := N[Sqrt[N[Abs[N[(z0 * N[(N[(z0 * N[(N[(z0 * N[(N[(-0.25 * z0), $MachinePrecision] - 0.3333333333333333), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]
\sqrt{\left|z0 \cdot \left(z0 \cdot \left(z0 \cdot \left(-0.25 \cdot z0 - 0.3333333333333333\right) - 0.5\right) - 1\right)\right|}
Initial program 37.1%
Taylor expanded in z0 around 0
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6468.5%
Applied rewrites68.5%
(FPCore (z0) :precision binary64 (sqrt (fabs (* z0 (- (- (* -0.5 z0) 0.5) 0.5)))))
double code(double z0) {
return sqrt(fabs((z0 * (((-0.5 * z0) - 0.5) - 0.5))));
}
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(z0)
use fmin_fmax_functions
real(8), intent (in) :: z0
code = sqrt(abs((z0 * ((((-0.5d0) * z0) - 0.5d0) - 0.5d0))))
end function
public static double code(double z0) {
return Math.sqrt(Math.abs((z0 * (((-0.5 * z0) - 0.5) - 0.5))));
}
def code(z0): return math.sqrt(math.fabs((z0 * (((-0.5 * z0) - 0.5) - 0.5))))
function code(z0) return sqrt(abs(Float64(z0 * Float64(Float64(Float64(-0.5 * z0) - 0.5) - 0.5)))) end
function tmp = code(z0) tmp = sqrt(abs((z0 * (((-0.5 * z0) - 0.5) - 0.5)))); end
code[z0_] := N[Sqrt[N[Abs[N[(z0 * N[(N[(N[(-0.5 * z0), $MachinePrecision] - 0.5), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]
\sqrt{\left|z0 \cdot \left(\left(-0.5 \cdot z0 - 0.5\right) - 0.5\right)\right|}
Initial program 37.1%
Taylor expanded in z0 around 0
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6468.5%
Applied rewrites68.5%
Taylor expanded in z0 around 0
Applied rewrites68.5%
lift--.f64N/A
metadata-evalN/A
associate--r+N/A
lower--.f64N/A
lower--.f6468.5%
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
lift-*.f6468.5%
*-commutative68.5%
Applied rewrites68.5%
(FPCore (z0) :precision binary64 (sqrt (fabs (- (* (* -0.5 z0) z0) z0))))
double code(double z0) {
return sqrt(fabs((((-0.5 * z0) * z0) - z0)));
}
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(z0)
use fmin_fmax_functions
real(8), intent (in) :: z0
code = sqrt(abs(((((-0.5d0) * z0) * z0) - z0)))
end function
public static double code(double z0) {
return Math.sqrt(Math.abs((((-0.5 * z0) * z0) - z0)));
}
def code(z0): return math.sqrt(math.fabs((((-0.5 * z0) * z0) - z0)))
function code(z0) return sqrt(abs(Float64(Float64(Float64(-0.5 * z0) * z0) - z0))) end
function tmp = code(z0) tmp = sqrt(abs((((-0.5 * z0) * z0) - z0))); end
code[z0_] := N[Sqrt[N[Abs[N[(N[(N[(-0.5 * z0), $MachinePrecision] * z0), $MachinePrecision] - z0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]
\sqrt{\left|\left(-0.5 \cdot z0\right) \cdot z0 - z0\right|}
Initial program 37.1%
Taylor expanded in z0 around 0
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6468.5%
Applied rewrites68.5%
lift-*.f64N/A
lift--.f64N/A
sub-flipN/A
metadata-evalN/A
distribute-rgt-inN/A
mul-1-negN/A
sub-flip-reverseN/A
lower--.f64N/A
lower-*.f6468.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6468.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6468.5%
Applied rewrites68.5%
Taylor expanded in z0 around 0
Applied rewrites68.5%
(FPCore (z0) :precision binary64 (sqrt (fabs (* z0 (- (* -0.5 z0) 1.0)))))
double code(double z0) {
return sqrt(fabs((z0 * ((-0.5 * z0) - 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(z0)
use fmin_fmax_functions
real(8), intent (in) :: z0
code = sqrt(abs((z0 * (((-0.5d0) * z0) - 1.0d0))))
end function
public static double code(double z0) {
return Math.sqrt(Math.abs((z0 * ((-0.5 * z0) - 1.0))));
}
def code(z0): return math.sqrt(math.fabs((z0 * ((-0.5 * z0) - 1.0))))
function code(z0) return sqrt(abs(Float64(z0 * Float64(Float64(-0.5 * z0) - 1.0)))) end
function tmp = code(z0) tmp = sqrt(abs((z0 * ((-0.5 * z0) - 1.0)))); end
code[z0_] := N[Sqrt[N[Abs[N[(z0 * N[(N[(-0.5 * z0), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]
\sqrt{\left|z0 \cdot \left(-0.5 \cdot z0 - 1\right)\right|}
Initial program 37.1%
Taylor expanded in z0 around 0
lower-*.f64N/A
lower--.f64N/A
lower-*.f6468.5%
Applied rewrites68.5%
(FPCore (z0) :precision binary64 (sqrt (fabs (- z0))))
double code(double z0) {
return sqrt(fabs(-z0));
}
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(z0)
use fmin_fmax_functions
real(8), intent (in) :: z0
code = sqrt(abs(-z0))
end function
public static double code(double z0) {
return Math.sqrt(Math.abs(-z0));
}
def code(z0): return math.sqrt(math.fabs(-z0))
function code(z0) return sqrt(abs(Float64(-z0))) end
function tmp = code(z0) tmp = sqrt(abs(-z0)); end
code[z0_] := N[Sqrt[N[Abs[(-z0)], $MachinePrecision]], $MachinePrecision]
\sqrt{\left|-z0\right|}
Initial program 37.1%
Taylor expanded in z0 around 0
lower-*.f6468.5%
Applied rewrites68.5%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6468.5%
Applied rewrites68.5%
herbie shell --seed 2025250
(FPCore (z0)
:name "(sqrt (fabs (log (- 1 z0))))"
:precision binary64
(sqrt (fabs (log (- 1.0 z0)))))