
(FPCore (z0) :precision binary64 (sin (* -2.0 (* PI z0))))
double code(double z0) {
return sin((-2.0 * (((double) M_PI) * z0)));
}
public static double code(double z0) {
return Math.sin((-2.0 * (Math.PI * z0)));
}
def code(z0): return math.sin((-2.0 * (math.pi * z0)))
function code(z0) return sin(Float64(-2.0 * Float64(pi * z0))) end
function tmp = code(z0) tmp = sin((-2.0 * (pi * z0))); end
code[z0_] := N[Sin[N[(-2.0 * N[(Pi * z0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\sin \left(-2 \cdot \left(\pi \cdot z0\right)\right)
Herbie found 5 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (z0) :precision binary64 (sin (* -2.0 (* PI z0))))
double code(double z0) {
return sin((-2.0 * (((double) M_PI) * z0)));
}
public static double code(double z0) {
return Math.sin((-2.0 * (Math.PI * z0)));
}
def code(z0): return math.sin((-2.0 * (math.pi * z0)))
function code(z0) return sin(Float64(-2.0 * Float64(pi * z0))) end
function tmp = code(z0) tmp = sin((-2.0 * (pi * z0))); end
code[z0_] := N[Sin[N[(-2.0 * N[(Pi * z0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\sin \left(-2 \cdot \left(\pi \cdot z0\right)\right)
(FPCore (z0) :precision binary64 (sin (* (pow PI 0.5555555555555556) (* (* (pow PI 0.1111111111111111) -2.9291837751230467) z0))))
double code(double z0) {
return sin((pow(((double) M_PI), 0.5555555555555556) * ((pow(((double) M_PI), 0.1111111111111111) * -2.9291837751230467) * z0)));
}
public static double code(double z0) {
return Math.sin((Math.pow(Math.PI, 0.5555555555555556) * ((Math.pow(Math.PI, 0.1111111111111111) * -2.9291837751230467) * z0)));
}
def code(z0): return math.sin((math.pow(math.pi, 0.5555555555555556) * ((math.pow(math.pi, 0.1111111111111111) * -2.9291837751230467) * z0)))
function code(z0) return sin(Float64((pi ^ 0.5555555555555556) * Float64(Float64((pi ^ 0.1111111111111111) * -2.9291837751230467) * z0))) end
function tmp = code(z0) tmp = sin(((pi ^ 0.5555555555555556) * (((pi ^ 0.1111111111111111) * -2.9291837751230467) * z0))); end
code[z0_] := N[Sin[N[(N[Power[Pi, 0.5555555555555556], $MachinePrecision] * N[(N[(N[Power[Pi, 0.1111111111111111], $MachinePrecision] * -2.9291837751230467), $MachinePrecision] * z0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\sin \left({\pi}^{0.5555555555555556} \cdot \left(\left({\pi}^{0.1111111111111111} \cdot -2.9291837751230467\right) \cdot z0\right)\right)
Initial program 53.4%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-PI.f64N/A
add-cube-cbrtN/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-PI.f64N/A
pow1/3N/A
lift-PI.f64N/A
pow1/3N/A
pow-prod-upN/A
lower-pow.f64N/A
metadata-evalN/A
lower-*.f64N/A
lower-*.f64N/A
lift-PI.f64N/A
lower-cbrt.f6452.9%
Applied rewrites52.9%
Evaluated real constant53.4%
lift-pow.f64N/A
metadata-evalN/A
pow-cbrtN/A
lift-cbrt.f64N/A
lift-pow.f6452.7%
Applied rewrites52.7%
lift-*.f64N/A
lift-pow.f64N/A
lift-cbrt.f64N/A
pow-cbrtN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
pow-prod-upN/A
cbrt-powN/A
lift-pow.f64N/A
lift-cbrt.f64N/A
lift-pow.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-cbrt.f64N/A
lift-pow.f64N/A
cbrt-powN/A
lower-pow.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
Applied rewrites53.4%
(FPCore (z0) :precision binary64 (sin (* (* z0 1.4645918875615234) -4.290058794222051)))
double code(double z0) {
return sin(((z0 * 1.4645918875615234) * -4.290058794222051));
}
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 = sin(((z0 * 1.4645918875615234d0) * (-4.290058794222051d0)))
end function
public static double code(double z0) {
return Math.sin(((z0 * 1.4645918875615234) * -4.290058794222051));
}
def code(z0): return math.sin(((z0 * 1.4645918875615234) * -4.290058794222051))
function code(z0) return sin(Float64(Float64(z0 * 1.4645918875615234) * -4.290058794222051)) end
function tmp = code(z0) tmp = sin(((z0 * 1.4645918875615234) * -4.290058794222051)); end
code[z0_] := N[Sin[N[(N[(z0 * 1.4645918875615234), $MachinePrecision] * -4.290058794222051), $MachinePrecision]], $MachinePrecision]
\sin \left(\left(z0 \cdot 1.4645918875615234\right) \cdot -4.290058794222051\right)
Initial program 53.4%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-PI.f64N/A
add-cube-cbrtN/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-PI.f64N/A
pow1/3N/A
lift-PI.f64N/A
pow1/3N/A
pow-prod-upN/A
lower-pow.f64N/A
metadata-evalN/A
lower-*.f64N/A
lower-*.f64N/A
lift-PI.f64N/A
lower-cbrt.f6452.9%
Applied rewrites52.9%
Evaluated real constant53.4%
Evaluated real constant53.4%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-eval53.4%
Applied rewrites53.4%
(FPCore (z0) :precision binary64 (sin (* z0 -6.283185307179586)))
double code(double z0) {
return sin((z0 * -6.283185307179586));
}
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 = sin((z0 * (-6.283185307179586d0)))
end function
public static double code(double z0) {
return Math.sin((z0 * -6.283185307179586));
}
def code(z0): return math.sin((z0 * -6.283185307179586))
function code(z0) return sin(Float64(z0 * -6.283185307179586)) end
function tmp = code(z0) tmp = sin((z0 * -6.283185307179586)); end
code[z0_] := N[Sin[N[(z0 * -6.283185307179586), $MachinePrecision]], $MachinePrecision]
\sin \left(z0 \cdot -6.283185307179586\right)
Initial program 53.4%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-PI.f64N/A
add-cube-cbrtN/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-PI.f64N/A
pow1/3N/A
lift-PI.f64N/A
pow1/3N/A
pow-prod-upN/A
lower-pow.f64N/A
metadata-evalN/A
lower-*.f64N/A
lower-*.f64N/A
lift-PI.f64N/A
lower-cbrt.f6452.9%
Applied rewrites52.9%
Evaluated real constant53.4%
Evaluated real constant53.4%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
metadata-evalN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
metadata-eval53.4%
Applied rewrites53.4%
(FPCore (z0) :precision binary64 (* (* PI (+ (* (* (* (* z0 z0) 1.3333333333333333) PI) PI) -2.0)) z0))
double code(double z0) {
return (((double) M_PI) * (((((z0 * z0) * 1.3333333333333333) * ((double) M_PI)) * ((double) M_PI)) + -2.0)) * z0;
}
public static double code(double z0) {
return (Math.PI * (((((z0 * z0) * 1.3333333333333333) * Math.PI) * Math.PI) + -2.0)) * z0;
}
def code(z0): return (math.pi * (((((z0 * z0) * 1.3333333333333333) * math.pi) * math.pi) + -2.0)) * z0
function code(z0) return Float64(Float64(pi * Float64(Float64(Float64(Float64(Float64(z0 * z0) * 1.3333333333333333) * pi) * pi) + -2.0)) * z0) end
function tmp = code(z0) tmp = (pi * (((((z0 * z0) * 1.3333333333333333) * pi) * pi) + -2.0)) * z0; end
code[z0_] := N[(N[(Pi * N[(N[(N[(N[(N[(z0 * z0), $MachinePrecision] * 1.3333333333333333), $MachinePrecision] * Pi), $MachinePrecision] * Pi), $MachinePrecision] + -2.0), $MachinePrecision]), $MachinePrecision] * z0), $MachinePrecision]
\left(\pi \cdot \left(\left(\left(\left(z0 \cdot z0\right) \cdot 1.3333333333333333\right) \cdot \pi\right) \cdot \pi + -2\right)\right) \cdot z0
Initial program 53.4%
Taylor expanded in z0 around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-PI.f6451.1%
Applied rewrites51.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6451.1%
Applied rewrites51.1%
(FPCore (z0) :precision binary64 (* z0 -6.283185307179586))
double code(double z0) {
return z0 * -6.283185307179586;
}
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 = z0 * (-6.283185307179586d0)
end function
public static double code(double z0) {
return z0 * -6.283185307179586;
}
def code(z0): return z0 * -6.283185307179586
function code(z0) return Float64(z0 * -6.283185307179586) end
function tmp = code(z0) tmp = z0 * -6.283185307179586; end
code[z0_] := N[(z0 * -6.283185307179586), $MachinePrecision]
z0 \cdot -6.283185307179586
Initial program 53.4%
Taylor expanded in z0 around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-PI.f6451.1%
Applied rewrites51.1%
Taylor expanded in z0 around 0
lower-*.f64N/A
lower-PI.f6451.1%
Applied rewrites51.1%
Evaluated real constant51.1%
herbie shell --seed 2025250
(FPCore (z0)
:name "(sin (* -2 (* PI z0)))"
:precision binary64
(sin (* -2.0 (* PI z0))))