@@ -39,7 +39,7 @@ import {
3939 parseUnitDSL ,
4040 type UnitExpression ,
4141} from '../../numerics/unit-data' ;
42- import { normalizeAngle , degreesToDMS } from '../serialize-dms' ;
42+ import { normalizeAngle , formatDMS } from '../serialize-dms' ;
4343
4444// ---------------------------------------------------------------------------
4545// Helpers
@@ -380,7 +380,8 @@ export const DEFINITIONS_UNITS: LatexDictionary = [
380380
381381 if (
382382 isAngleUnit &&
383- ( options . dmsFormat || options . angleNormalization !== 'none' )
383+ ( options . dmsFormat ||
384+ ( options . angleNormalization && options . angleNormalization !== 'none' ) )
384385 ) {
385386 // Get numeric value
386387 const magnitudeValue = machineValue ( magnitude ) ;
@@ -403,33 +404,11 @@ export const DEFINITIONS_UNITS: LatexDictionary = [
403404 }
404405
405406 // Apply normalization
406- if ( options . angleNormalization !== 'none' ) {
407+ if ( options . angleNormalization && options . angleNormalization !== 'none' )
407408 degrees = normalizeAngle ( degrees , options . angleNormalization ) ;
408- }
409409
410- // Format as DMS if requested
411- if ( options . dmsFormat ) {
412- const { deg, min, sec } = degreesToDMS ( degrees ) ;
413-
414- let result = `${ deg } °` ;
415-
416- if ( Math . abs ( sec ) > 0.001 ) {
417- // Include seconds
418- const secStr = sec % 1 === 0 ? sec . toString ( ) : sec . toFixed ( 2 ) ;
419- result += `${ Math . abs ( min ) } '${ Math . abs ( Number ( secStr ) ) } "` ;
420- } else if ( Math . abs ( min ) > 0 ) {
421- // Include minutes only
422- result += `${ Math . abs ( min ) } '` ;
423- } else {
424- // Degrees only, show 0'0" for consistency
425- result += `0'0"` ;
426- }
427-
428- return result ;
429- } else {
430- // Just normalize, use decimal degrees
431- return `${ degrees } °` ;
432- }
410+ if ( options . dmsFormat ) return formatDMS ( degrees ) ;
411+ return `${ degrees } °` ;
433412 }
434413
435414 // Fall through to default Quantity serialization
0 commit comments