Skip to content

math: Sincos is very wrong when called from PortAudio callback. #8623

@gordonklaus

Description

@gordonklaus
go version devel +9985ecf9828f Wed Aug 20 12:58:01 2014 +0400 darwin/amd64

When called from a PortAudio callback, the loop

for t := 0.0; t < 1; t += .125 {
    sin, _ := math.Sincos(t*math.Pi/2)
    fmt.Println(sin)
}

outputs

0
0.19509032201612828
0.3826834323650898
0.5555702330196023
0.7071067811865476
0.5555702330196023
0.38268343236508984
0.19509032201612833

whereas I would expect it to print the same thing as when it is not run from the
callback:

0
0.19509032201612828
0.3826834323650898
0.5555702330196023
0.7071067811865476
0.8314696123025451
0.9238795325112867
0.9807852804032304

Working code (requires PortAudio):  http://play.golang.org/p/XlIDtR6JIF

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions