The simplest way would be to use the trigonometric identities.
Specifically, the one that says tan [i]θ[/i] = sin [i]θ[/i] / cos [i]θ[/i].
function tan(a) return sin(a)/cos(a) end
Note though that this starts to fall apart in the vicinity of 90° and 270°, since pico-8's fixed-point variables can't represent the large numbers around those values, or the infinite values at them, but realistically you wouldn't be using tan() for angles like that anyway, because it wouldn't be useful.
[Please log in to post a comment]