
(FPCore (z0) :precision binary64 (log (* (- 1.0 z0) 1.3333333333333333)))
double code(double z0) {
return log(((1.0 - z0) * 1.3333333333333333));
}
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 = log(((1.0d0 - z0) * 1.3333333333333333d0))
end function
public static double code(double z0) {
return Math.log(((1.0 - z0) * 1.3333333333333333));
}
def code(z0): return math.log(((1.0 - z0) * 1.3333333333333333))
function code(z0) return log(Float64(Float64(1.0 - z0) * 1.3333333333333333)) end
function tmp = code(z0) tmp = log(((1.0 - z0) * 1.3333333333333333)); end
code[z0_] := N[Log[N[(N[(1.0 - z0), $MachinePrecision] * 1.3333333333333333), $MachinePrecision]], $MachinePrecision]
\log \left(\left(1 - z0\right) \cdot 1.3333333333333333\right)
Herbie found 5 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (z0) :precision binary64 (log (* (- 1.0 z0) 1.3333333333333333)))
double code(double z0) {
return log(((1.0 - z0) * 1.3333333333333333));
}
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 = log(((1.0d0 - z0) * 1.3333333333333333d0))
end function
public static double code(double z0) {
return Math.log(((1.0 - z0) * 1.3333333333333333));
}
def code(z0): return math.log(((1.0 - z0) * 1.3333333333333333))
function code(z0) return log(Float64(Float64(1.0 - z0) * 1.3333333333333333)) end
function tmp = code(z0) tmp = log(((1.0 - z0) * 1.3333333333333333)); end
code[z0_] := N[Log[N[(N[(1.0 - z0), $MachinePrecision] * 1.3333333333333333), $MachinePrecision]], $MachinePrecision]
\log \left(\left(1 - z0\right) \cdot 1.3333333333333333\right)
(FPCore (z0) :precision binary64 (+ 0.9808292530117262 (log (* (- 1.0 z0) 0.5))))
double code(double z0) {
return 0.9808292530117262 + log(((1.0 - z0) * 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 = 0.9808292530117262d0 + log(((1.0d0 - z0) * 0.5d0))
end function
public static double code(double z0) {
return 0.9808292530117262 + Math.log(((1.0 - z0) * 0.5));
}
def code(z0): return 0.9808292530117262 + math.log(((1.0 - z0) * 0.5))
function code(z0) return Float64(0.9808292530117262 + log(Float64(Float64(1.0 - z0) * 0.5))) end
function tmp = code(z0) tmp = 0.9808292530117262 + log(((1.0 - z0) * 0.5)); end
code[z0_] := N[(0.9808292530117262 + N[Log[N[(N[(1.0 - z0), $MachinePrecision] * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
0.9808292530117262 + \log \left(\left(1 - z0\right) \cdot 0.5\right)
Initial program 98.9%
lift-log.f64N/A
lift-*.f64N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
1-expN/A
1-expN/A
metadata-evalN/A
metadata-evalN/A
1-expN/A
1-expN/A
metadata-evalN/A
associate-*r/N/A
log-divN/A
lower-unsound--.f64N/A
Applied rewrites99.8%
lower-unsound--.f64N/A
lower-unsound-log.f64N/A
lower-unsound-log.f64N/A
log-divN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
log-prodN/A
lower-unsound-+.f64N/A
lower-unsound-log.f64N/A
lower-unsound-log.f64N/A
mult-flipN/A
lower-*.f64N/A
metadata-eval99.9%
Applied rewrites99.9%
Evaluated real constant99.9%
(FPCore (z0) :precision binary64 (log (- (* -1.3333333333333333 z0) -1.3333333333333333)))
double code(double z0) {
return log(((-1.3333333333333333 * z0) - -1.3333333333333333));
}
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 = log((((-1.3333333333333333d0) * z0) - (-1.3333333333333333d0)))
end function
public static double code(double z0) {
return Math.log(((-1.3333333333333333 * z0) - -1.3333333333333333));
}
def code(z0): return math.log(((-1.3333333333333333 * z0) - -1.3333333333333333))
function code(z0) return log(Float64(Float64(-1.3333333333333333 * z0) - -1.3333333333333333)) end
function tmp = code(z0) tmp = log(((-1.3333333333333333 * z0) - -1.3333333333333333)); end
code[z0_] := N[Log[N[(N[(-1.3333333333333333 * z0), $MachinePrecision] - -1.3333333333333333), $MachinePrecision]], $MachinePrecision]
\log \left(-1.3333333333333333 \cdot z0 - -1.3333333333333333\right)
Initial program 98.9%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
distribute-lft-inN/A
metadata-evalN/A
add-flipN/A
lower--.f64N/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-evalN/A
metadata-eval98.9%
Applied rewrites98.9%
(FPCore (z0) :precision binary64 (if (<= (log (* (- 1.0 z0) 1.3333333333333333)) 0.5) (- 0.2876820724517809 z0) (log (* -1.3333333333333333 z0))))
double code(double z0) {
double tmp;
if (log(((1.0 - z0) * 1.3333333333333333)) <= 0.5) {
tmp = 0.2876820724517809 - z0;
} else {
tmp = log((-1.3333333333333333 * z0));
}
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) :: tmp
if (log(((1.0d0 - z0) * 1.3333333333333333d0)) <= 0.5d0) then
tmp = 0.2876820724517809d0 - z0
else
tmp = log(((-1.3333333333333333d0) * z0))
end if
code = tmp
end function
public static double code(double z0) {
double tmp;
if (Math.log(((1.0 - z0) * 1.3333333333333333)) <= 0.5) {
tmp = 0.2876820724517809 - z0;
} else {
tmp = Math.log((-1.3333333333333333 * z0));
}
return tmp;
}
def code(z0): tmp = 0 if math.log(((1.0 - z0) * 1.3333333333333333)) <= 0.5: tmp = 0.2876820724517809 - z0 else: tmp = math.log((-1.3333333333333333 * z0)) return tmp
function code(z0) tmp = 0.0 if (log(Float64(Float64(1.0 - z0) * 1.3333333333333333)) <= 0.5) tmp = Float64(0.2876820724517809 - z0); else tmp = log(Float64(-1.3333333333333333 * z0)); end return tmp end
function tmp_2 = code(z0) tmp = 0.0; if (log(((1.0 - z0) * 1.3333333333333333)) <= 0.5) tmp = 0.2876820724517809 - z0; else tmp = log((-1.3333333333333333 * z0)); end tmp_2 = tmp; end
code[z0_] := If[LessEqual[N[Log[N[(N[(1.0 - z0), $MachinePrecision] * 1.3333333333333333), $MachinePrecision]], $MachinePrecision], 0.5], N[(0.2876820724517809 - z0), $MachinePrecision], N[Log[N[(-1.3333333333333333 * z0), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\log \left(\left(1 - z0\right) \cdot 1.3333333333333333\right) \leq 0.5:\\
\;\;\;\;0.2876820724517809 - z0\\
\mathbf{else}:\\
\;\;\;\;\log \left(-1.3333333333333333 \cdot z0\right)\\
\end{array}
if (log.f64 (*.f64 (-.f64 #s(literal 1 binary64) z0) #s(literal 13333333333333333/10000000000000000 binary64))) < 0.5Initial program 98.9%
Taylor expanded in z0 around 0
lower-+.f64N/A
lower-log.f64N/A
lower-*.f6467.5%
Applied rewrites67.5%
Evaluated real constant68.5%
lift-+.f64N/A
lift-*.f64N/A
mul-1-negN/A
sub-flip-reverseN/A
lower--.f6468.5%
Applied rewrites68.5%
if 0.5 < (log.f64 (*.f64 (-.f64 #s(literal 1 binary64) z0) #s(literal 13333333333333333/10000000000000000 binary64))) Initial program 98.9%
Taylor expanded in z0 around inf
lower-*.f6432.4%
Applied rewrites32.4%
(FPCore (z0) :precision binary64 0.2876820724517809)
double code(double z0) {
return 0.2876820724517809;
}
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 = 0.2876820724517809d0
end function
public static double code(double z0) {
return 0.2876820724517809;
}
def code(z0): return 0.2876820724517809
function code(z0) return 0.2876820724517809 end
function tmp = code(z0) tmp = 0.2876820724517809; end
code[z0_] := 0.2876820724517809
0.2876820724517809
Initial program 98.9%
Taylor expanded in z0 around 0
lower-+.f64N/A
lower-log.f64N/A
lower-*.f6467.5%
Applied rewrites67.5%
Evaluated real constant68.5%
Taylor expanded in z0 around 0
Applied rewrites70.4%
herbie shell --seed 2025250
(FPCore (z0)
:name "(log (* (- 1 z0) 13333333333333333/10000000000000000))"
:precision binary64
(log (* (- 1.0 z0) 1.3333333333333333)))