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( "tapered" )
local cot = require( "cot" )
-- util functions
local round = require( "round" )

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

t.done()

Inspired by

See also