cot

function cot( x ) --> res

Description

Returns the cotangent of x.

Parameters

x

An angle in radians.

Return Values

res

The cotangent of x.

Code

--ZFUNC-cot-v1
local function cot( x ) --> res
   return 1 / math.tan( x );
end

return cot

Examples

local t = require( "taptest" )
local cot = require( "cot" )
local round = require( "round" )

t( round( cot( 30 ), 5 ), -0.15612 )
t( round( cot( 45 ), 7 ), 0.6173696 )

t()

Inspired by

See also