Skip to content

[fuzzing] std.math.sin vs glibc sin/sinf disagreements #9902

@squeek502

Description

@squeek502

These are cases found via https://github.com/squeek502/zig-std-lib-fuzzing where the Zig implementation and the glibc implementation of sin disagree on the results. Note that these could either be a Zig bug or a glibc bug. Also note that this list should not be considered exhaustive.

Format for each case is (can be either f32 or f64, will be differentiated by the width of the binary notation):

in : <float input to sin in binary notation>
<zig testing.expectEqual error>
zig: <zig's result in binary notation>
c  : <glibc's result in binary notation>
(only when the musl and glibc results are different):
m  : <musl's result in binary notation>
mf : <musl's result in default zig fmt notation>

Cases:

in : 0100000000000000000000000000000000000000000000000001000000000000
expected 9.092974268249248e-01, found 9.092974268249246e-01
zig: 0011111111101101000110001111011011101010110100011001100110100011
c  : 0011111111101101000110001111011011101010110100011001100110100100

in : 01000000000000001010011010100110
expected 9.05017673e-01, found 9.05017614e-01
zig: 00111111011001111010111100111100
c  : 00111111011001111010111100111101

in : 01001000011101101110100000000000
expected 2.33006611e-01, found 2.28855669e-01
zig: 00111110011010100101100100100100
c  : 00111110011011101001100101001001

in : 01001110011100101010000000000000
expected 1.63289263e-01, found 1.85135078e+05
zig: 01001000001101001100101111000101
c  : 00111110001001110011010101001101

in : 01001110011100101001111111111111
expected -8.43691587e-01, found 7.34320759e+14
zig: 01011000001001101111011100011000
c  : 10111111010101111111110000101100

in : 0100001100000000000000001110000000000000000000000000000000000000
expected 9.08591047718329e-01, found 9.120429664891301e-01
zig: 0011111111101101001011110111010010111011001100111100001110110000
c  : 0011111111101101000100110010110110001000011011000110111101100110

in : 0100000000001100111111110111100000000000000000000000000000000100
expected -4.645690959179299e-01, found -4.6456909591792994e-01
zig: 1011111111011101101110111000000000000100011011001100100101110110
c  : 1011111111011101101110111000000000000100011011001100100101110101

in : 01001110010100111010000000000000
expected 6.90152049e-01, found 2.1922186e+07
zig: 01001011101001110100000011000101
c  : 00111111001100001010110111001110

in : 01001110000000001101001011111111
expected -9.81242120e-01, found 4.97343365e+10
zig: 01010001001110010100011001011100
c  : 10111111011110110011001010101111

in : 1100001101111111011111110111111101111111100000001100001100000000
expected 8.004099288476395e-01, found -2.023617463869512e+06
zig: 1100000100111110111000001100000101110110110000000010011100000000
c  : 0011111111101001100111001111010101001000011110010110101011100101

in : 01001110010011100100111000000000
expected -3.11624944e-01, found 2.33093351e+15
zig: 01011001000001000111111110001100
c  : 10111110100111111000110101001110

in : 11001010000000000001011011111010
expected -7.88453161e-01, found -8.24845671e-01
zig: 10111111010100110010100100010110
c  : 10111111010010011101100000010001

in : 11001101000000011111111100000000
expected -4.27663803e-01, found -2.34546905e+02
zig: 11000011011010101000110000000010
c  : 10111110110110101111011011000000

in : 11001101110011011100110111001101
expected -1.20696187e-01, found -2.71583002e+11
zig: 11010010011111001110111001101111
c  : 10111101111101110010111110010000

in : 01001110000010000001100111111111
expected 3.92203092e-01, found -6.49677952e+08
zig: 11001110000110101110010100110010
c  : 00111110110010001100111011011000

in : 1100001111000011110000110000000000000000000000000000000000000000
expected -6.778564488857252e-01, found -1.8795122100475533e+25
zig: 1100010100101111000110000000101100111000101010100010101110001001
c  : 1011111111100101101100010000000000000001111010110001100110101111

in : 01001110010100111001111111111111
expected 9.36231136e-01, found 1.98054632e+15
zig: 01011000111000010010100101111100
c  : 00111111011011111010110011011000

in : 1100001111000011110000111100001100000000000000011100001111000011
expected -8.08603289849552e-01, found 2.4952947336399975e+10
zig: 0100001000010111001111010011111100001010001000011001100110010011
c  : 1011111111101001111000000001010000000001101010101111000001001111

in : 01001101000110100101111111111111
expected -1.30424886e-01, found 3.17445526e+01
zig: 01000001111111011111010011011000
c  : 10111110000001011000111000011010

in : 0100001101111011010000110000000000000100110100110111101101000011
expected -3.4213862981519044e-01, found 2.096661263497096e+03
zig: 0100000010100000011000010101001010010001001000010000110000100010
c  : 1011111111010101111001011001100101101100011100000100100110011111

in : 11001101110000011100110111111111
expected 8.37280929e-01, found -1.25460615e+04
zig: 11000110010001000000100000111111
c  : 00111111010101100101100000001011

in : 01001110100101011110001100000000
expected -8.34248661e-01, found 9.39783136e+13
zig: 01010110101010101111001000010000
c  : 10111111010101011001000101010010

in : 11001101010110000110010001100100
expected -5.45474529e-01, found 9.02290344e-01
zig: 00111111011001101111110010000000
c  : 10111111000010111010010000111000

in : 11001110110000000000000110100101
expected 6.71918809e-01, found -2.12447159e+12
zig: 11010011111101110101001000110000
c  : 00111111001011000000001011011111

in : 0100001111001110110111000010000000000000000000111101110000111110
expected -7.869679179222414e-01, found 1.0058259276925056e+20
zig: 0100010000010101110011110111010010011100110110110101101111010000
c  : 1011111111101001001011101101011101010111110011110100010110001011

in : 11001110000101111100111010000000
expected 8.48641514e-01, found -8.90999705e+09
zig: 11010000000001001100010011110001
c  : 00111111010110010100000010010010

in : 0100001110111111100000000000000000000100101111110101000001111010
expected -9.652505668435394e-01, found 6.946386659742551e+23
zig: 0100010011100010011000110000111000000000010011011100011001100101
c  : 1011111111101110111000110101010100101000001000010011101100011000
m  : 1011111111101110111000110101010100101000001000010011101100011001
mf : -9.652505668435395e-01

in : 01001010010010100001000011110011
expected -1.0e+00, found -9.95873391e-01
zig: 10111111011111101111000110001111
c  : 10111111100000000000000000000000

in : 1100001110100111101001111010011110100111101001111010011110100111
expected 9.203011777144383e-01, found -1.8897266312835092e+16
zig: 1100001101010000110010001011110110101011011100110101110000000101
c  : 0011111111101101011100110001101101110100100110000001111100011010

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviorcontributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.standard libraryThis issue involves writing Zig code for the standard library.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions