Skip to content
JervenBolleman edited this page Jun 6, 2019 · 1 revision

cos

Signature

     xsd:double cos (xsd:double)

Special cases

If $θ is positive or negative infinity, or NaN, then the result is NaN.

The result is the cosine of $θ (which is treated as an angle in radians) as defined in the [IEEE 754-2008] specification of the cos function applied to 64-bit binary floating point values.

This function is equivalent to math:cos.

ASK {FILTER(COS(0) = "1.0"^^xsd:double)}
ASK {FILTER(COS(-0.0e0) = "1.0"^^xsd:double)}

#approximately 0
ASK {FILTER(COS(PI() / 2) < "0.01"^^xsd:double)} 
ASK {FILTER(COS(PI() / 2) > -"0.01"^^xsd:double)}

#approximately 0
ASK {FILTER(COS(-PI() / 2) < "0.01"^^xsd:double)} 
ASK {FILTER(COS(-PI() / 2) > -"0.01"^^xsd:double)}

#approximately -1
ASK {FILTER(COS(PI()) >= "-1.0"^^xsd:double)}
ASK {FILTER(COS(PI()) < "-0.99"^^xsd:double)}

#specical cases
ASK {FILTER(COS("Nan"^^xsd:double) = "Nan"^^xsd:double)}
ASK {FILTER(COS("-Inf"^^xsd:double) = "Nan"^^xsd:double)}
ASK {FILTER(COS("Inf"^^xsd:double) ="Nan"^^xsd:double)}

TODO: UNDEF

Clone this wiki locally