MCPcopy
hub / github.com/shopspring/decimal / TestCos

Function TestCos

decimal_test.go:3540–3577  ·  view source on GitHub ↗

For Cos

(t *testing.T)

Source from the content-addressed store, hash-verified

3538
3539// For Cos
3540func TestCos(t *testing.T) {
3541 inps := []string{
3542 "-2.91919191919191919",
3543 "-1.0",
3544 "-0.25",
3545 "0.0",
3546 "0.33",
3547 "1.0",
3548 "5.0",
3549 "10",
3550 "11000020.2407442310156021090304691671842603586882014729198302312846062338790031898128063403419218957424",
3551 }
3552 sols := []string{
3553 "-0.975370726167463467746508538219884948528729295145689640359666742268127382748782064668565276308334226452812521220478854320025773591423493734486361306323829818426063430805234608660356853863442937297855742231573288105774823103008774355455799906250461848079705023428527473474556899228935370709945979509634251305018978306493011197513482210179171510947538040406781879762352211326273272515279567525396877609653501706919545667682725671944948392322552266752",
3554 "0.54030230586813965874561515067176071767603141150991567490927772778673118786033739102174242337864109186439207498973007363884202112942385976796862442063752663646870430360736682397798633852405003167527051283327366631405990604840629657123985368031838052877290142895506386796217551784101265975360960112885444847880134909594560331781699767647860744559228420471946006511861233129745921297270844542687374552066388998112901504",
3555 "0.968912421710644784099084544806854121387004852294921875",
3556 "1",
3557 "0.9460423435283869715490383692051286742343482760977712222",
3558 "0.54030230586813965874561515067176071767603141150991567490927772778673118786033739102174242337864109186439207498973007363884202112942385976796862442063752663646870430360736682397798633852405003167527051283327366631405990604840629657123985368031838052877290142895506386796217551784101265975360960112885444847880134909594560331781699767647860744559228420471946006511861233129745921297270844542687374552066388998112901504",
3559 "0.28366218546322646623291670213892426815646045792775066552057877370468842342090306560693620285882975471913545189522117672866861003904575909174769890684057564495184019705963607555427518763375472432216131070235796577209064861003009894615394882021220247535890708789312783718414424224334988974848162884228012265684775651099758365989567444515619764427493598258393280941942356912304265535918025036942025858493361644535438208",
3560 "-0.839071529076452222947082170022504835457755803801719612447629165523199043803440231769716865070163209041973184176293170330332317060558438085478980463542480791358920580076809381102480339018809694514100495572097422057215638383077242523713704127605770444906854175870243452753002238589530499630034663296166308443155999957196346563161387705205277189957388653461251461388391745795979375660087266037741360406956289962327970672363315696841378765492754546688",
3561 "-0.82557544253149396284458404188071504476091346830440347376462206521981928020803354950315062147200396866217255527509254080721982393941347365824137698491042935894213870423296625749297033966815252917361266452901192457318047750698424190124169875103436588397415032138037063155981648677895645409699825582226442363080800781881653440538927704569142007751338851079530521979429507520541625303794665680584709171813053216867014700596866196844144286737568957809383224972108999354839705480223052622003994027222120126949093911643497423100187973906980635670000034664323357488815820848035808846624518774608931622703631130673844138378087837990739103263093532314835289302930152150130664948083902949999427848344301686172490282395687167681679607401220592559832932068966455384902377056623736013617949634746332323529256184776892339963173795176200590119077305668901887229709592836744082027738666294887303249770621722032438202753270710379312736193201366287952361100525126056993039858894987153270630277483613793395809214871734783742285495171911648254647287555645360520115341268930844095156502348405343740866836850201634640011708462641462047870611041595707018966032206807675586825362640000739202116391403514629284000986232673698892843586989003952425039512325844566790376383098534975022847888104706525937115931692008959513984157709954859352131323440787667052399474107219968",
3562 }
3563 for i, inp := range inps {
3564 d, err := NewFromString(inp)
3565 if err != nil {
3566 t.FailNow()
3567 }
3568 s, err := NewFromString(sols[i])
3569 if err != nil {
3570 t.FailNow()
3571 }
3572 a := d.Cos()
3573 if !a.Equal(s) {
3574 t.Errorf("expected %s, got %s", s, a)
3575 }
3576 }
3577}
3578
3579// For Tan
3580func TestTan(t *testing.T) {

Callers

nothing calls this directly

Calls 3

NewFromStringFunction · 0.85
CosMethod · 0.80
EqualMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…