[erlang-questions] How to write this code better?

Vance Shipley <>
Fri Apr 11 23:40:09 CEST 2008


On Fri, Apr 11, 2008 at 11:00:21PM +0200, Jilani Khaldi wrote:
}  The Erlang code works but I think there is at least one way to write it 
}  better.

	T1 = 2*3.14159*((JD - 1) / 365.0),
	case (0.322003-22.971*cos(T1)
			-0.357898*cos(2*T1)
			-0.14398*cos(3*T1)
			+3.94638*sin(T1)
			+0.019334*sin(2*T1)
			+0.05928*sin(3*T1)) of
		Declination when Declination > 89.99 ->
			89.99;
		Declination when Declination < -89.99) ->
			-89.99;
		Declination ->
			Declination
	end.



More information about the erlang-questions mailing list