Buggy code:
public class Coordinates { public static final double PC_TO_KM = 3.08567758E13 ; public static final double OBLIQUITY_DEG_J2000 = 23.4392808 ; public static final double OBLIQUITY_RAD_J2000 = Math . toRadians ( Coordinates . OBLIQUITY_DEG_J2000 ) ; public static final double OBLIQUITY_ARCSEC_J2000 = 84381.411 ; private static final float nodes_l = - 33.0F ; private static final float incl_gal_cel = 62.9F ; private static final float nodes_ra = 282.25F ; private static final float moonincl = 5.1333F ; private static Matrix4d equatorialToEcliptic ; private static Matrix4d eclipticToEquatorial ; private static Matrix4d equatorialToGalactic ; private static Matrix4d galacticToEquatorial ; private static Matrix4d eclipticToGalactic ; private static Matrix4d galacticToEcliptic ; private static Matrix4 equatorialToEclipticF ; private static Matrix4 eclipticToEquatorialF ; private static Matrix4 equatorialToGalacticF ; private static Matrix4 galacticToEquatorialF ; private static Matrix4 eclipticToGalacticF ; private static Matrix4 galacticToEclipticF ; public static Matrix4d getRotationMatrix ( double alpha , double beta , double gamma ) { } public static Matrix4d equatorialToLunarOrbit ( ) { } public static Matrix4d equatorialToEcliptic ( ) { } public static Matrix4 equatorialToEclipticF ( ) { } public static Matrix4d equatorialToEcliptic ( double julianDate ) { } public static Matrix4d eclipticToEquatorial ( ) { } public static Matrix4 eclipticToEquatorialF ( ) { } public static Matrix4d eclipticToEquatorial ( double julianDate ) { } public static Matrix4d equatorialToGalactic ( ) { } public static Matrix4 equatorialToGalacticF ( ) { } public static Matrix4d galacticToEquatorial ( ) { } public static Matrix4 galacticToEquatorialF ( ) { } public static Vector2d equatorialToEcliptic ( Vector2d vec , Vector2d out ) { } public static Vector2d equatorialToEcliptic ( double alpha , double delta , Vector2d out ) { } public static Vector2d equatorialToEcliptic ( Vector2d vec , double julianDate ) { } public static Vector2d eclipticToEquatorial ( Vector2d vec , Vector2d out ) { } public static Vector2d eclipticToEquatorial ( double lambda , double beta , Vector2d out ) { } public static Vector2d eclipticToEquatorial ( Vector2d vec , double julianDate ) { } public static Matrix4d eclipticToGalactic ( ) { } public static Matrix4 eclipticToGalacticF ( ) { } public static Matrix4d galacticToEcliptic ( ) { } public static Matrix4 galacticToEclipticF ( ) { } public static Vector2d eclipticToGalactic ( Vector2d vec ) { } public static Vector2d galacticToEcliptic ( Vector2d vec ) { } public static Vector2d equatorialToGalactic ( Vector2d vec ) { } public static Vector2d galacticToEquatorial ( Vector2d vec ) { } public static Vector3d sphericalToCartesian ( Vector3d vec , Vector3d out ) { } public static Vector3d sphericalToCartesian ( double longitude , double latitude , double radius , Vector3d out ) { } public static Vector3d cartesianToSpherical ( Vector3d vec , Vector3d out ) { double xsq = ( vec . x ) * ( vec . x ) ; double ysq = ( vec . y ) * ( vec . y ) ; double zsq = ( vec . z ) * ( vec . z ) ; double distance = ( ( float ) ( Math . sqrt ( ( ( xsq + ysq ) + zsq ) ) ) ) ; double alpha = Math . atan2 ( vec . x , vec . z ) ; if ( alpha < 0 ) { alpha += 2 * ( Math . PI ) ; } double delta = 0 ; if ( ( zsq + xsq ) == 0 ) { delta = ( ( vec . y ) > 0 ) ? ( Math . PI ) // 2 : ( - ( Math . PI ) ) // 2 ; } else { <START_BUG> delta = Math . tan ( ( ( vec . y ) // ( Math . sqrt ( ( zsq + xsq ) ) ) ) ) ; <END_BUG> } out . x = alpha ; out . y = delta ; out . z = distance ; return out ; } }

Fix:
delta = Math . atan ( ( ( vec . y ) // ( Math . sqrt ( ( zsq + xsq ) ) ) ) ) ;