[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #65291] [octave forge] (mapping) degrees2dms p
From: |
Philip Nienhuis |
Subject: |
[Octave-bug-tracker] [bug #65291] [octave forge] (mapping) degrees2dms produces incorrect results |
Date: |
Mon, 25 Mar 2024 11:00:24 -0400 (EDT) |
Follow-up Comment #16, bug #65291 (group octave):
In a spell between other work I just tried this with your new degrees2dms.m:
>> degrees2dms ([1 : 0.6 : 5]')
ans =
1.0000 0 0
1.0000 36.0000 0.0000
2.0000 12.0000 0.0000
2.0000 47.0000 60.0000
3.0000 23.0000 60.0000
4.0000 0 0
4.0000 35.0000 60.0000
where minute values still can be 60 and don't overflow to minutes.
Or,
>> format long
>> degrees2dms ([1 : 0.6 : 5]')
ans =
1.000000000000000e+00 0 0
1.000000000000000e+00 3.600000000000000e+01 4.263256414560601e-13
2.000000000000000e+00 1.200000000000000e+01 6.394884621840902e-13
2.000000000000000e+00 4.700000000000000e+01 5.999999999999915e+01
3.000000000000000e+00 2.300000000000000e+01 5.999999999999957e+01
4.000000000000000e+00 0 0
4.000000000000000e+00 3.500000000000000e+01 5.999999999999872e+01
To have proper output, seconds >= 59.5 (rather than >= 60.0-eps) need to
overflow to minutes. IIRC that's also what I did for angl2str.m (patch
#9953).
Yet I wonder if we should hunt down this all the way or just leave it as-is.
It's not pretty but still mostly bug-for-bug compatible with Matlab (although
just a tiny bit better :-) see last-but-one row):
>> degrees2dms ([1 : 0.6 : 5])
Warning: Reshaping input into 7-by-1 column vector. Output will be 7-by-3.
> In degrees2dms (line 57)
ans =
1.0000 0 0
1.0000 36.0000 0.0000
2.0000 12.0000 0.0000
2.0000 47.0000 60.0000
3.0000 23.0000 60.0000
3.0000 59.0000 60.0000
4.0000 35.0000 60.0000
(where you can also see that Matlab warns about a wrong dimension of the input
vector while Octave doesn't.)
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?65291>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
Message not available
Message not available
Message not available
Message not available
Message not available
Message not available
Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- [Octave-bug-tracker] [bug #65291] [octave forge] (mapping) degrees2dms produces incorrect results,
Philip Nienhuis <=
Message not available