(sin (* -2 (* PI z0)))

Percentage Accurate: 53.4% → 53.4%
Time: 3.7s
Alternatives: 5
Speedup: 0.3×

Specification

?
\[\sin \left(-2 \cdot \left(\pi \cdot z0\right)\right) \]
(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)

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 5 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 53.4% accurate, 1.0× speedup?

\[\sin \left(-2 \cdot \left(\pi \cdot z0\right)\right) \]
(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)

Alternative 1: 53.4% accurate, 0.3× speedup?

\[\sin \left({\pi}^{0.5555555555555556} \cdot \left(\left({\pi}^{0.1111111111111111} \cdot -2.9291837751230467\right) \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)
Derivation
  1. Initial program 53.4%

    \[\sin \left(-2 \cdot \left(\pi \cdot z0\right)\right) \]
  2. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \sin \color{blue}{\left(-2 \cdot \left(\pi \cdot z0\right)\right)} \]
    2. *-commutativeN/A

      \[\leadsto \sin \color{blue}{\left(\left(\pi \cdot z0\right) \cdot -2\right)} \]
    3. lift-*.f64N/A

      \[\leadsto \sin \left(\color{blue}{\left(\pi \cdot z0\right)} \cdot -2\right) \]
    4. lift-PI.f64N/A

      \[\leadsto \sin \left(\left(\color{blue}{\mathsf{PI}\left(\right)} \cdot z0\right) \cdot -2\right) \]
    5. add-cube-cbrtN/A

      \[\leadsto \sin \left(\left(\color{blue}{\left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot \sqrt[3]{\mathsf{PI}\left(\right)}\right) \cdot \sqrt[3]{\mathsf{PI}\left(\right)}\right)} \cdot z0\right) \cdot -2\right) \]
    6. associate-*l*N/A

      \[\leadsto \sin \left(\color{blue}{\left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot \sqrt[3]{\mathsf{PI}\left(\right)}\right) \cdot \left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot z0\right)\right)} \cdot -2\right) \]
    7. associate-*l*N/A

      \[\leadsto \sin \color{blue}{\left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot \sqrt[3]{\mathsf{PI}\left(\right)}\right) \cdot \left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot z0\right) \cdot -2\right)\right)} \]
    8. lower-*.f64N/A

      \[\leadsto \sin \color{blue}{\left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot \sqrt[3]{\mathsf{PI}\left(\right)}\right) \cdot \left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot z0\right) \cdot -2\right)\right)} \]
    9. lift-PI.f64N/A

      \[\leadsto \sin \left(\left(\sqrt[3]{\color{blue}{\pi}} \cdot \sqrt[3]{\mathsf{PI}\left(\right)}\right) \cdot \left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot z0\right) \cdot -2\right)\right) \]
    10. pow1/3N/A

      \[\leadsto \sin \left(\left(\color{blue}{{\pi}^{\frac{1}{3}}} \cdot \sqrt[3]{\mathsf{PI}\left(\right)}\right) \cdot \left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot z0\right) \cdot -2\right)\right) \]
    11. lift-PI.f64N/A

      \[\leadsto \sin \left(\left({\pi}^{\frac{1}{3}} \cdot \sqrt[3]{\color{blue}{\pi}}\right) \cdot \left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot z0\right) \cdot -2\right)\right) \]
    12. pow1/3N/A

      \[\leadsto \sin \left(\left({\pi}^{\frac{1}{3}} \cdot \color{blue}{{\pi}^{\frac{1}{3}}}\right) \cdot \left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot z0\right) \cdot -2\right)\right) \]
    13. pow-prod-upN/A

      \[\leadsto \sin \left(\color{blue}{{\pi}^{\left(\frac{1}{3} + \frac{1}{3}\right)}} \cdot \left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot z0\right) \cdot -2\right)\right) \]
    14. lower-pow.f64N/A

      \[\leadsto \sin \left(\color{blue}{{\pi}^{\left(\frac{1}{3} + \frac{1}{3}\right)}} \cdot \left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot z0\right) \cdot -2\right)\right) \]
    15. metadata-evalN/A

      \[\leadsto \sin \left({\pi}^{\color{blue}{\frac{2}{3}}} \cdot \left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot z0\right) \cdot -2\right)\right) \]
    16. lower-*.f64N/A

      \[\leadsto \sin \left({\pi}^{\frac{2}{3}} \cdot \color{blue}{\left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot z0\right) \cdot -2\right)}\right) \]
    17. lower-*.f64N/A

      \[\leadsto \sin \left({\pi}^{\frac{2}{3}} \cdot \left(\color{blue}{\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot z0\right)} \cdot -2\right)\right) \]
    18. lift-PI.f64N/A

      \[\leadsto \sin \left({\pi}^{\frac{2}{3}} \cdot \left(\left(\sqrt[3]{\color{blue}{\pi}} \cdot z0\right) \cdot -2\right)\right) \]
    19. lower-cbrt.f6452.9%

      \[\leadsto \sin \left({\pi}^{0.6666666666666666} \cdot \left(\left(\color{blue}{\sqrt[3]{\pi}} \cdot z0\right) \cdot -2\right)\right) \]
  3. Applied rewrites52.9%

    \[\leadsto \sin \color{blue}{\left({\pi}^{0.6666666666666666} \cdot \left(\left(\sqrt[3]{\pi} \cdot z0\right) \cdot -2\right)\right)} \]
  4. Evaluated real constant53.4%

    \[\leadsto \sin \left({\pi}^{0.6666666666666666} \cdot \left(\left(\color{blue}{1.4645918875615234} \cdot z0\right) \cdot -2\right)\right) \]
  5. Step-by-step derivation
    1. lift-pow.f64N/A

      \[\leadsto \sin \left(\color{blue}{{\pi}^{\frac{2}{3}}} \cdot \left(\left(\frac{824491934883991}{562949953421312} \cdot z0\right) \cdot -2\right)\right) \]
    2. metadata-evalN/A

      \[\leadsto \sin \left({\pi}^{\color{blue}{\left(\frac{2}{3}\right)}} \cdot \left(\left(\frac{824491934883991}{562949953421312} \cdot z0\right) \cdot -2\right)\right) \]
    3. pow-cbrtN/A

      \[\leadsto \sin \left(\color{blue}{{\left(\sqrt[3]{\pi}\right)}^{2}} \cdot \left(\left(\frac{824491934883991}{562949953421312} \cdot z0\right) \cdot -2\right)\right) \]
    4. lift-cbrt.f64N/A

      \[\leadsto \sin \left({\color{blue}{\left(\sqrt[3]{\pi}\right)}}^{2} \cdot \left(\left(\frac{824491934883991}{562949953421312} \cdot z0\right) \cdot -2\right)\right) \]
    5. lift-pow.f6452.7%

      \[\leadsto \sin \left(\color{blue}{{\left(\sqrt[3]{\pi}\right)}^{2}} \cdot \left(\left(1.4645918875615234 \cdot z0\right) \cdot -2\right)\right) \]
  6. Applied rewrites52.7%

    \[\leadsto \sin \left(\color{blue}{{\left(\sqrt[3]{\pi}\right)}^{2}} \cdot \left(\left(1.4645918875615234 \cdot z0\right) \cdot -2\right)\right) \]
  7. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \sin \color{blue}{\left({\left(\sqrt[3]{\pi}\right)}^{2} \cdot \left(\left(\frac{824491934883991}{562949953421312} \cdot z0\right) \cdot -2\right)\right)} \]
    2. lift-pow.f64N/A

      \[\leadsto \sin \left(\color{blue}{{\left(\sqrt[3]{\pi}\right)}^{2}} \cdot \left(\left(\frac{824491934883991}{562949953421312} \cdot z0\right) \cdot -2\right)\right) \]
    3. lift-cbrt.f64N/A

      \[\leadsto \sin \left({\color{blue}{\left(\sqrt[3]{\pi}\right)}}^{2} \cdot \left(\left(\frac{824491934883991}{562949953421312} \cdot z0\right) \cdot -2\right)\right) \]
    4. pow-cbrtN/A

      \[\leadsto \sin \left(\color{blue}{{\pi}^{\left(\frac{2}{3}\right)}} \cdot \left(\left(\frac{824491934883991}{562949953421312} \cdot z0\right) \cdot -2\right)\right) \]
    5. metadata-evalN/A

      \[\leadsto \sin \left({\pi}^{\color{blue}{\frac{2}{3}}} \cdot \left(\left(\frac{824491934883991}{562949953421312} \cdot z0\right) \cdot -2\right)\right) \]
    6. metadata-evalN/A

      \[\leadsto \sin \left({\pi}^{\color{blue}{\left(\frac{5}{9} + \frac{1}{9}\right)}} \cdot \left(\left(\frac{824491934883991}{562949953421312} \cdot z0\right) \cdot -2\right)\right) \]
    7. metadata-evalN/A

      \[\leadsto \sin \left({\pi}^{\left(\color{blue}{\frac{\frac{5}{3}}{3}} + \frac{1}{9}\right)} \cdot \left(\left(\frac{824491934883991}{562949953421312} \cdot z0\right) \cdot -2\right)\right) \]
    8. pow-prod-upN/A

      \[\leadsto \sin \left(\color{blue}{\left({\pi}^{\left(\frac{\frac{5}{3}}{3}\right)} \cdot {\pi}^{\frac{1}{9}}\right)} \cdot \left(\left(\frac{824491934883991}{562949953421312} \cdot z0\right) \cdot -2\right)\right) \]
    9. cbrt-powN/A

      \[\leadsto \sin \left(\left(\color{blue}{\sqrt[3]{{\pi}^{\frac{5}{3}}}} \cdot {\pi}^{\frac{1}{9}}\right) \cdot \left(\left(\frac{824491934883991}{562949953421312} \cdot z0\right) \cdot -2\right)\right) \]
    10. lift-pow.f64N/A

      \[\leadsto \sin \left(\left(\sqrt[3]{\color{blue}{{\pi}^{\frac{5}{3}}}} \cdot {\pi}^{\frac{1}{9}}\right) \cdot \left(\left(\frac{824491934883991}{562949953421312} \cdot z0\right) \cdot -2\right)\right) \]
    11. lift-cbrt.f64N/A

      \[\leadsto \sin \left(\left(\color{blue}{\sqrt[3]{{\pi}^{\frac{5}{3}}}} \cdot {\pi}^{\frac{1}{9}}\right) \cdot \left(\left(\frac{824491934883991}{562949953421312} \cdot z0\right) \cdot -2\right)\right) \]
    12. lift-pow.f64N/A

      \[\leadsto \sin \left(\left(\sqrt[3]{{\pi}^{\frac{5}{3}}} \cdot \color{blue}{{\pi}^{\frac{1}{9}}}\right) \cdot \left(\left(\frac{824491934883991}{562949953421312} \cdot z0\right) \cdot -2\right)\right) \]
    13. associate-*l*N/A

      \[\leadsto \sin \color{blue}{\left(\sqrt[3]{{\pi}^{\frac{5}{3}}} \cdot \left({\pi}^{\frac{1}{9}} \cdot \left(\left(\frac{824491934883991}{562949953421312} \cdot z0\right) \cdot -2\right)\right)\right)} \]
    14. lower-*.f64N/A

      \[\leadsto \sin \color{blue}{\left(\sqrt[3]{{\pi}^{\frac{5}{3}}} \cdot \left({\pi}^{\frac{1}{9}} \cdot \left(\left(\frac{824491934883991}{562949953421312} \cdot z0\right) \cdot -2\right)\right)\right)} \]
    15. lift-cbrt.f64N/A

      \[\leadsto \sin \left(\color{blue}{\sqrt[3]{{\pi}^{\frac{5}{3}}}} \cdot \left({\pi}^{\frac{1}{9}} \cdot \left(\left(\frac{824491934883991}{562949953421312} \cdot z0\right) \cdot -2\right)\right)\right) \]
    16. lift-pow.f64N/A

      \[\leadsto \sin \left(\sqrt[3]{\color{blue}{{\pi}^{\frac{5}{3}}}} \cdot \left({\pi}^{\frac{1}{9}} \cdot \left(\left(\frac{824491934883991}{562949953421312} \cdot z0\right) \cdot -2\right)\right)\right) \]
    17. cbrt-powN/A

      \[\leadsto \sin \left(\color{blue}{{\pi}^{\left(\frac{\frac{5}{3}}{3}\right)}} \cdot \left({\pi}^{\frac{1}{9}} \cdot \left(\left(\frac{824491934883991}{562949953421312} \cdot z0\right) \cdot -2\right)\right)\right) \]
    18. lower-pow.f64N/A

      \[\leadsto \sin \left(\color{blue}{{\pi}^{\left(\frac{\frac{5}{3}}{3}\right)}} \cdot \left({\pi}^{\frac{1}{9}} \cdot \left(\left(\frac{824491934883991}{562949953421312} \cdot z0\right) \cdot -2\right)\right)\right) \]
    19. metadata-evalN/A

      \[\leadsto \sin \left({\pi}^{\color{blue}{\frac{5}{9}}} \cdot \left({\pi}^{\frac{1}{9}} \cdot \left(\left(\frac{824491934883991}{562949953421312} \cdot z0\right) \cdot -2\right)\right)\right) \]
    20. lift-*.f64N/A

      \[\leadsto \sin \left({\pi}^{\frac{5}{9}} \cdot \left({\pi}^{\frac{1}{9}} \cdot \color{blue}{\left(\left(\frac{824491934883991}{562949953421312} \cdot z0\right) \cdot -2\right)}\right)\right) \]
    21. *-commutativeN/A

      \[\leadsto \sin \left({\pi}^{\frac{5}{9}} \cdot \left({\pi}^{\frac{1}{9}} \cdot \color{blue}{\left(-2 \cdot \left(\frac{824491934883991}{562949953421312} \cdot z0\right)\right)}\right)\right) \]
    22. lift-*.f64N/A

      \[\leadsto \sin \left({\pi}^{\frac{5}{9}} \cdot \left({\pi}^{\frac{1}{9}} \cdot \left(-2 \cdot \color{blue}{\left(\frac{824491934883991}{562949953421312} \cdot z0\right)}\right)\right)\right) \]
    23. associate-*r*N/A

      \[\leadsto \sin \left({\pi}^{\frac{5}{9}} \cdot \left({\pi}^{\frac{1}{9}} \cdot \color{blue}{\left(\left(-2 \cdot \frac{824491934883991}{562949953421312}\right) \cdot z0\right)}\right)\right) \]
  8. Applied rewrites53.4%

    \[\leadsto \sin \color{blue}{\left({\pi}^{0.5555555555555556} \cdot \left(\left({\pi}^{0.1111111111111111} \cdot -2.9291837751230467\right) \cdot z0\right)\right)} \]
  9. Add Preprocessing

Alternative 2: 53.4% accurate, 1.0× speedup?

\[\sin \left(\left(z0 \cdot 1.4645918875615234\right) \cdot -4.290058794222051\right) \]
(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)
Derivation
  1. Initial program 53.4%

    \[\sin \left(-2 \cdot \left(\pi \cdot z0\right)\right) \]
  2. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \sin \color{blue}{\left(-2 \cdot \left(\pi \cdot z0\right)\right)} \]
    2. *-commutativeN/A

      \[\leadsto \sin \color{blue}{\left(\left(\pi \cdot z0\right) \cdot -2\right)} \]
    3. lift-*.f64N/A

      \[\leadsto \sin \left(\color{blue}{\left(\pi \cdot z0\right)} \cdot -2\right) \]
    4. lift-PI.f64N/A

      \[\leadsto \sin \left(\left(\color{blue}{\mathsf{PI}\left(\right)} \cdot z0\right) \cdot -2\right) \]
    5. add-cube-cbrtN/A

      \[\leadsto \sin \left(\left(\color{blue}{\left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot \sqrt[3]{\mathsf{PI}\left(\right)}\right) \cdot \sqrt[3]{\mathsf{PI}\left(\right)}\right)} \cdot z0\right) \cdot -2\right) \]
    6. associate-*l*N/A

      \[\leadsto \sin \left(\color{blue}{\left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot \sqrt[3]{\mathsf{PI}\left(\right)}\right) \cdot \left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot z0\right)\right)} \cdot -2\right) \]
    7. associate-*l*N/A

      \[\leadsto \sin \color{blue}{\left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot \sqrt[3]{\mathsf{PI}\left(\right)}\right) \cdot \left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot z0\right) \cdot -2\right)\right)} \]
    8. lower-*.f64N/A

      \[\leadsto \sin \color{blue}{\left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot \sqrt[3]{\mathsf{PI}\left(\right)}\right) \cdot \left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot z0\right) \cdot -2\right)\right)} \]
    9. lift-PI.f64N/A

      \[\leadsto \sin \left(\left(\sqrt[3]{\color{blue}{\pi}} \cdot \sqrt[3]{\mathsf{PI}\left(\right)}\right) \cdot \left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot z0\right) \cdot -2\right)\right) \]
    10. pow1/3N/A

      \[\leadsto \sin \left(\left(\color{blue}{{\pi}^{\frac{1}{3}}} \cdot \sqrt[3]{\mathsf{PI}\left(\right)}\right) \cdot \left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot z0\right) \cdot -2\right)\right) \]
    11. lift-PI.f64N/A

      \[\leadsto \sin \left(\left({\pi}^{\frac{1}{3}} \cdot \sqrt[3]{\color{blue}{\pi}}\right) \cdot \left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot z0\right) \cdot -2\right)\right) \]
    12. pow1/3N/A

      \[\leadsto \sin \left(\left({\pi}^{\frac{1}{3}} \cdot \color{blue}{{\pi}^{\frac{1}{3}}}\right) \cdot \left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot z0\right) \cdot -2\right)\right) \]
    13. pow-prod-upN/A

      \[\leadsto \sin \left(\color{blue}{{\pi}^{\left(\frac{1}{3} + \frac{1}{3}\right)}} \cdot \left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot z0\right) \cdot -2\right)\right) \]
    14. lower-pow.f64N/A

      \[\leadsto \sin \left(\color{blue}{{\pi}^{\left(\frac{1}{3} + \frac{1}{3}\right)}} \cdot \left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot z0\right) \cdot -2\right)\right) \]
    15. metadata-evalN/A

      \[\leadsto \sin \left({\pi}^{\color{blue}{\frac{2}{3}}} \cdot \left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot z0\right) \cdot -2\right)\right) \]
    16. lower-*.f64N/A

      \[\leadsto \sin \left({\pi}^{\frac{2}{3}} \cdot \color{blue}{\left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot z0\right) \cdot -2\right)}\right) \]
    17. lower-*.f64N/A

      \[\leadsto \sin \left({\pi}^{\frac{2}{3}} \cdot \left(\color{blue}{\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot z0\right)} \cdot -2\right)\right) \]
    18. lift-PI.f64N/A

      \[\leadsto \sin \left({\pi}^{\frac{2}{3}} \cdot \left(\left(\sqrt[3]{\color{blue}{\pi}} \cdot z0\right) \cdot -2\right)\right) \]
    19. lower-cbrt.f6452.9%

      \[\leadsto \sin \left({\pi}^{0.6666666666666666} \cdot \left(\left(\color{blue}{\sqrt[3]{\pi}} \cdot z0\right) \cdot -2\right)\right) \]
  3. Applied rewrites52.9%

    \[\leadsto \sin \color{blue}{\left({\pi}^{0.6666666666666666} \cdot \left(\left(\sqrt[3]{\pi} \cdot z0\right) \cdot -2\right)\right)} \]
  4. Evaluated real constant53.4%

    \[\leadsto \sin \left({\pi}^{0.6666666666666666} \cdot \left(\left(\color{blue}{1.4645918875615234} \cdot z0\right) \cdot -2\right)\right) \]
  5. Evaluated real constant53.4%

    \[\leadsto \sin \left(\color{blue}{2.1450293971110255} \cdot \left(\left(1.4645918875615234 \cdot z0\right) \cdot -2\right)\right) \]
  6. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \sin \color{blue}{\left(\frac{4830176796763987}{2251799813685248} \cdot \left(\left(\frac{824491934883991}{562949953421312} \cdot z0\right) \cdot -2\right)\right)} \]
    2. *-commutativeN/A

      \[\leadsto \sin \color{blue}{\left(\left(\left(\frac{824491934883991}{562949953421312} \cdot z0\right) \cdot -2\right) \cdot \frac{4830176796763987}{2251799813685248}\right)} \]
    3. lift-*.f64N/A

      \[\leadsto \sin \left(\color{blue}{\left(\left(\frac{824491934883991}{562949953421312} \cdot z0\right) \cdot -2\right)} \cdot \frac{4830176796763987}{2251799813685248}\right) \]
    4. associate-*l*N/A

      \[\leadsto \sin \color{blue}{\left(\left(\frac{824491934883991}{562949953421312} \cdot z0\right) \cdot \left(-2 \cdot \frac{4830176796763987}{2251799813685248}\right)\right)} \]
    5. lower-*.f64N/A

      \[\leadsto \sin \color{blue}{\left(\left(\frac{824491934883991}{562949953421312} \cdot z0\right) \cdot \left(-2 \cdot \frac{4830176796763987}{2251799813685248}\right)\right)} \]
    6. lift-*.f64N/A

      \[\leadsto \sin \left(\color{blue}{\left(\frac{824491934883991}{562949953421312} \cdot z0\right)} \cdot \left(-2 \cdot \frac{4830176796763987}{2251799813685248}\right)\right) \]
    7. *-commutativeN/A

      \[\leadsto \sin \left(\color{blue}{\left(z0 \cdot \frac{824491934883991}{562949953421312}\right)} \cdot \left(-2 \cdot \frac{4830176796763987}{2251799813685248}\right)\right) \]
    8. lower-*.f64N/A

      \[\leadsto \sin \left(\color{blue}{\left(z0 \cdot \frac{824491934883991}{562949953421312}\right)} \cdot \left(-2 \cdot \frac{4830176796763987}{2251799813685248}\right)\right) \]
    9. metadata-eval53.4%

      \[\leadsto \sin \left(\left(z0 \cdot 1.4645918875615234\right) \cdot \color{blue}{-4.290058794222051}\right) \]
  7. Applied rewrites53.4%

    \[\leadsto \sin \color{blue}{\left(\left(z0 \cdot 1.4645918875615234\right) \cdot -4.290058794222051\right)} \]
  8. Add Preprocessing

Alternative 3: 53.4% accurate, 1.0× speedup?

\[\sin \left(z0 \cdot -6.283185307179586\right) \]
(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)
Derivation
  1. Initial program 53.4%

    \[\sin \left(-2 \cdot \left(\pi \cdot z0\right)\right) \]
  2. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \sin \color{blue}{\left(-2 \cdot \left(\pi \cdot z0\right)\right)} \]
    2. *-commutativeN/A

      \[\leadsto \sin \color{blue}{\left(\left(\pi \cdot z0\right) \cdot -2\right)} \]
    3. lift-*.f64N/A

      \[\leadsto \sin \left(\color{blue}{\left(\pi \cdot z0\right)} \cdot -2\right) \]
    4. lift-PI.f64N/A

      \[\leadsto \sin \left(\left(\color{blue}{\mathsf{PI}\left(\right)} \cdot z0\right) \cdot -2\right) \]
    5. add-cube-cbrtN/A

      \[\leadsto \sin \left(\left(\color{blue}{\left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot \sqrt[3]{\mathsf{PI}\left(\right)}\right) \cdot \sqrt[3]{\mathsf{PI}\left(\right)}\right)} \cdot z0\right) \cdot -2\right) \]
    6. associate-*l*N/A

      \[\leadsto \sin \left(\color{blue}{\left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot \sqrt[3]{\mathsf{PI}\left(\right)}\right) \cdot \left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot z0\right)\right)} \cdot -2\right) \]
    7. associate-*l*N/A

      \[\leadsto \sin \color{blue}{\left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot \sqrt[3]{\mathsf{PI}\left(\right)}\right) \cdot \left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot z0\right) \cdot -2\right)\right)} \]
    8. lower-*.f64N/A

      \[\leadsto \sin \color{blue}{\left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot \sqrt[3]{\mathsf{PI}\left(\right)}\right) \cdot \left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot z0\right) \cdot -2\right)\right)} \]
    9. lift-PI.f64N/A

      \[\leadsto \sin \left(\left(\sqrt[3]{\color{blue}{\pi}} \cdot \sqrt[3]{\mathsf{PI}\left(\right)}\right) \cdot \left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot z0\right) \cdot -2\right)\right) \]
    10. pow1/3N/A

      \[\leadsto \sin \left(\left(\color{blue}{{\pi}^{\frac{1}{3}}} \cdot \sqrt[3]{\mathsf{PI}\left(\right)}\right) \cdot \left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot z0\right) \cdot -2\right)\right) \]
    11. lift-PI.f64N/A

      \[\leadsto \sin \left(\left({\pi}^{\frac{1}{3}} \cdot \sqrt[3]{\color{blue}{\pi}}\right) \cdot \left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot z0\right) \cdot -2\right)\right) \]
    12. pow1/3N/A

      \[\leadsto \sin \left(\left({\pi}^{\frac{1}{3}} \cdot \color{blue}{{\pi}^{\frac{1}{3}}}\right) \cdot \left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot z0\right) \cdot -2\right)\right) \]
    13. pow-prod-upN/A

      \[\leadsto \sin \left(\color{blue}{{\pi}^{\left(\frac{1}{3} + \frac{1}{3}\right)}} \cdot \left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot z0\right) \cdot -2\right)\right) \]
    14. lower-pow.f64N/A

      \[\leadsto \sin \left(\color{blue}{{\pi}^{\left(\frac{1}{3} + \frac{1}{3}\right)}} \cdot \left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot z0\right) \cdot -2\right)\right) \]
    15. metadata-evalN/A

      \[\leadsto \sin \left({\pi}^{\color{blue}{\frac{2}{3}}} \cdot \left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot z0\right) \cdot -2\right)\right) \]
    16. lower-*.f64N/A

      \[\leadsto \sin \left({\pi}^{\frac{2}{3}} \cdot \color{blue}{\left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot z0\right) \cdot -2\right)}\right) \]
    17. lower-*.f64N/A

      \[\leadsto \sin \left({\pi}^{\frac{2}{3}} \cdot \left(\color{blue}{\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot z0\right)} \cdot -2\right)\right) \]
    18. lift-PI.f64N/A

      \[\leadsto \sin \left({\pi}^{\frac{2}{3}} \cdot \left(\left(\sqrt[3]{\color{blue}{\pi}} \cdot z0\right) \cdot -2\right)\right) \]
    19. lower-cbrt.f6452.9%

      \[\leadsto \sin \left({\pi}^{0.6666666666666666} \cdot \left(\left(\color{blue}{\sqrt[3]{\pi}} \cdot z0\right) \cdot -2\right)\right) \]
  3. Applied rewrites52.9%

    \[\leadsto \sin \color{blue}{\left({\pi}^{0.6666666666666666} \cdot \left(\left(\sqrt[3]{\pi} \cdot z0\right) \cdot -2\right)\right)} \]
  4. Evaluated real constant53.4%

    \[\leadsto \sin \left({\pi}^{0.6666666666666666} \cdot \left(\left(\color{blue}{1.4645918875615234} \cdot z0\right) \cdot -2\right)\right) \]
  5. Evaluated real constant53.4%

    \[\leadsto \sin \left(\color{blue}{2.1450293971110255} \cdot \left(\left(1.4645918875615234 \cdot z0\right) \cdot -2\right)\right) \]
  6. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \sin \color{blue}{\left(\frac{4830176796763987}{2251799813685248} \cdot \left(\left(\frac{824491934883991}{562949953421312} \cdot z0\right) \cdot -2\right)\right)} \]
    2. lift-*.f64N/A

      \[\leadsto \sin \left(\frac{4830176796763987}{2251799813685248} \cdot \color{blue}{\left(\left(\frac{824491934883991}{562949953421312} \cdot z0\right) \cdot -2\right)}\right) \]
    3. *-commutativeN/A

      \[\leadsto \sin \left(\frac{4830176796763987}{2251799813685248} \cdot \color{blue}{\left(-2 \cdot \left(\frac{824491934883991}{562949953421312} \cdot z0\right)\right)}\right) \]
    4. lift-*.f64N/A

      \[\leadsto \sin \left(\frac{4830176796763987}{2251799813685248} \cdot \left(-2 \cdot \color{blue}{\left(\frac{824491934883991}{562949953421312} \cdot z0\right)}\right)\right) \]
    5. associate-*r*N/A

      \[\leadsto \sin \left(\frac{4830176796763987}{2251799813685248} \cdot \color{blue}{\left(\left(-2 \cdot \frac{824491934883991}{562949953421312}\right) \cdot z0\right)}\right) \]
    6. metadata-evalN/A

      \[\leadsto \sin \left(\frac{4830176796763987}{2251799813685248} \cdot \left(\color{blue}{\frac{-824491934883991}{281474976710656}} \cdot z0\right)\right) \]
    7. associate-*l*N/A

      \[\leadsto \sin \color{blue}{\left(\left(\frac{4830176796763987}{2251799813685248} \cdot \frac{-824491934883991}{281474976710656}\right) \cdot z0\right)} \]
    8. *-commutativeN/A

      \[\leadsto \sin \color{blue}{\left(z0 \cdot \left(\frac{4830176796763987}{2251799813685248} \cdot \frac{-824491934883991}{281474976710656}\right)\right)} \]
    9. lower-*.f64N/A

      \[\leadsto \sin \color{blue}{\left(z0 \cdot \left(\frac{4830176796763987}{2251799813685248} \cdot \frac{-824491934883991}{281474976710656}\right)\right)} \]
    10. metadata-eval53.4%

      \[\leadsto \sin \left(z0 \cdot \color{blue}{-6.283185307179586}\right) \]
  7. Applied rewrites53.4%

    \[\leadsto \sin \color{blue}{\left(z0 \cdot -6.283185307179586\right)} \]
  8. Add Preprocessing

Alternative 4: 51.1% accurate, 3.3× speedup?

\[\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 \]
(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
Derivation
  1. Initial program 53.4%

    \[\sin \left(-2 \cdot \left(\pi \cdot z0\right)\right) \]
  2. Taylor expanded in z0 around 0

    \[\leadsto \color{blue}{z0 \cdot \left(-2 \cdot \pi + \frac{4}{3} \cdot \left({z0}^{2} \cdot {\pi}^{3}\right)\right)} \]
  3. Step-by-step derivation
    1. lower-*.f64N/A

      \[\leadsto z0 \cdot \color{blue}{\left(-2 \cdot \mathsf{PI}\left(\right) + \frac{4}{3} \cdot \left({z0}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right)} \]
    2. lower-+.f64N/A

      \[\leadsto z0 \cdot \left(-2 \cdot \mathsf{PI}\left(\right) + \color{blue}{\frac{4}{3} \cdot \left({z0}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right)}\right) \]
    3. lower-*.f64N/A

      \[\leadsto z0 \cdot \left(-2 \cdot \mathsf{PI}\left(\right) + \color{blue}{\frac{4}{3}} \cdot \left({z0}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right) \]
    4. lower-PI.f64N/A

      \[\leadsto z0 \cdot \left(-2 \cdot \pi + \frac{4}{3} \cdot \left({z0}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right) \]
    5. lower-*.f64N/A

      \[\leadsto z0 \cdot \left(-2 \cdot \pi + \frac{4}{3} \cdot \color{blue}{\left({z0}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right)}\right) \]
    6. lower-*.f64N/A

      \[\leadsto z0 \cdot \left(-2 \cdot \pi + \frac{4}{3} \cdot \left({z0}^{2} \cdot \color{blue}{{\mathsf{PI}\left(\right)}^{3}}\right)\right) \]
    7. lower-pow.f64N/A

      \[\leadsto z0 \cdot \left(-2 \cdot \pi + \frac{4}{3} \cdot \left({z0}^{2} \cdot {\color{blue}{\mathsf{PI}\left(\right)}}^{3}\right)\right) \]
    8. lower-pow.f64N/A

      \[\leadsto z0 \cdot \left(-2 \cdot \pi + \frac{4}{3} \cdot \left({z0}^{2} \cdot {\mathsf{PI}\left(\right)}^{\color{blue}{3}}\right)\right) \]
    9. lower-PI.f6451.1%

      \[\leadsto z0 \cdot \left(-2 \cdot \pi + 1.3333333333333333 \cdot \left({z0}^{2} \cdot {\pi}^{3}\right)\right) \]
  4. Applied rewrites51.1%

    \[\leadsto \color{blue}{z0 \cdot \left(-2 \cdot \pi + 1.3333333333333333 \cdot \left({z0}^{2} \cdot {\pi}^{3}\right)\right)} \]
  5. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto z0 \cdot \color{blue}{\left(-2 \cdot \pi + \frac{4}{3} \cdot \left({z0}^{2} \cdot {\pi}^{3}\right)\right)} \]
    2. *-commutativeN/A

      \[\leadsto \left(-2 \cdot \pi + \frac{4}{3} \cdot \left({z0}^{2} \cdot {\pi}^{3}\right)\right) \cdot \color{blue}{z0} \]
    3. lower-*.f6451.1%

      \[\leadsto \left(-2 \cdot \pi + 1.3333333333333333 \cdot \left({z0}^{2} \cdot {\pi}^{3}\right)\right) \cdot \color{blue}{z0} \]
  6. Applied rewrites51.1%

    \[\leadsto \left(\pi \cdot \left(\left(\left(\left(z0 \cdot z0\right) \cdot 1.3333333333333333\right) \cdot \pi\right) \cdot \pi + -2\right)\right) \cdot \color{blue}{z0} \]
  7. Add Preprocessing

Alternative 5: 51.1% accurate, 18.5× speedup?

\[z0 \cdot -6.283185307179586 \]
(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
Derivation
  1. Initial program 53.4%

    \[\sin \left(-2 \cdot \left(\pi \cdot z0\right)\right) \]
  2. Taylor expanded in z0 around 0

    \[\leadsto \color{blue}{z0 \cdot \left(-2 \cdot \pi + \frac{4}{3} \cdot \left({z0}^{2} \cdot {\pi}^{3}\right)\right)} \]
  3. Step-by-step derivation
    1. lower-*.f64N/A

      \[\leadsto z0 \cdot \color{blue}{\left(-2 \cdot \mathsf{PI}\left(\right) + \frac{4}{3} \cdot \left({z0}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right)} \]
    2. lower-+.f64N/A

      \[\leadsto z0 \cdot \left(-2 \cdot \mathsf{PI}\left(\right) + \color{blue}{\frac{4}{3} \cdot \left({z0}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right)}\right) \]
    3. lower-*.f64N/A

      \[\leadsto z0 \cdot \left(-2 \cdot \mathsf{PI}\left(\right) + \color{blue}{\frac{4}{3}} \cdot \left({z0}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right) \]
    4. lower-PI.f64N/A

      \[\leadsto z0 \cdot \left(-2 \cdot \pi + \frac{4}{3} \cdot \left({z0}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right) \]
    5. lower-*.f64N/A

      \[\leadsto z0 \cdot \left(-2 \cdot \pi + \frac{4}{3} \cdot \color{blue}{\left({z0}^{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right)}\right) \]
    6. lower-*.f64N/A

      \[\leadsto z0 \cdot \left(-2 \cdot \pi + \frac{4}{3} \cdot \left({z0}^{2} \cdot \color{blue}{{\mathsf{PI}\left(\right)}^{3}}\right)\right) \]
    7. lower-pow.f64N/A

      \[\leadsto z0 \cdot \left(-2 \cdot \pi + \frac{4}{3} \cdot \left({z0}^{2} \cdot {\color{blue}{\mathsf{PI}\left(\right)}}^{3}\right)\right) \]
    8. lower-pow.f64N/A

      \[\leadsto z0 \cdot \left(-2 \cdot \pi + \frac{4}{3} \cdot \left({z0}^{2} \cdot {\mathsf{PI}\left(\right)}^{\color{blue}{3}}\right)\right) \]
    9. lower-PI.f6451.1%

      \[\leadsto z0 \cdot \left(-2 \cdot \pi + 1.3333333333333333 \cdot \left({z0}^{2} \cdot {\pi}^{3}\right)\right) \]
  4. Applied rewrites51.1%

    \[\leadsto \color{blue}{z0 \cdot \left(-2 \cdot \pi + 1.3333333333333333 \cdot \left({z0}^{2} \cdot {\pi}^{3}\right)\right)} \]
  5. Taylor expanded in z0 around 0

    \[\leadsto z0 \cdot \left(-2 \cdot \color{blue}{\pi}\right) \]
  6. Step-by-step derivation
    1. lower-*.f64N/A

      \[\leadsto z0 \cdot \left(-2 \cdot \mathsf{PI}\left(\right)\right) \]
    2. lower-PI.f6451.1%

      \[\leadsto z0 \cdot \left(-2 \cdot \pi\right) \]
  7. Applied rewrites51.1%

    \[\leadsto z0 \cdot \left(-2 \cdot \color{blue}{\pi}\right) \]
  8. Evaluated real constant51.1%

    \[\leadsto z0 \cdot -6.283185307179586 \]
  9. Add Preprocessing

Reproduce

?
herbie shell --seed 2025250 
(FPCore (z0)
  :name "(sin (* -2 (* PI z0)))"
  :precision binary64
  (sin (* -2.0 (* PI z0))))