Function Longitude.tryFromDegrees

Construct a longitude from degrees without throwing.

static bool tryFromDegrees(
  const T degrees,
  out Longitude result
) pure nothrow @nogc @safe;

Parameters

NameDescription
degrees Longitude in the closed interval [-180,+180] degrees.
result Receives the constructed longitude on success.

Returns

true on success; false for non-finite or out-of-domain input. Both antimeridian endpoints are accepted. On failure result is initialized to .init on entry and has no guaranteed value on failure.

Example

Example checking longitude degrees without throwing.

import geodesy;
Longitude!double longitude;
assert(Longitude!double.tryFromDegrees(16.37208, longitude));
assert(longitude.degrees > 16.0);