octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #65291] [octave forge] (mapping) degrees2dms p


From: anonymous
Subject: [Octave-bug-tracker] [bug #65291] [octave forge] (mapping) degrees2dms produces incorrect results
Date: Tue, 13 Feb 2024 12:44:03 -0500 (EST)

Follow-up Comment #6, bug#65291 (group octave):

It would be interesting to see the output of MATLAB for the following which I
expect will run in less than 5 minutes:


format long

function dms = d2dms (d)
  df = fix(d);
  m = (d - df) .* 60;
  mf = fix(m);
  s = (m - mf) .* 60;
  dms = [df, mf, s];
end

a = single(0:(2 .^ 23 - 1)) .';
b = 1 + a .* eps('single');

positive_normal_mismatches = 0;
positive_normal_total = 0;
for p = (-126):127
  d = pow2(p) .* b;
  positive_normal_mismatches = positive_normal_mismatches + sum(any(d2dms(d)
!= degrees2dms(d), 2));
  positive_normal_total = positive_normal_total + numel(d);
end
positive_normal_mismatches
positive_normal_matches = positive_normal_total - positive_normal_mismatches

d = pow2(-149) .* a;
positive_zero_and_subnormal_mismatches = sum(any(d2dms(d) != degrees2dms(d),
2))
positive_zero_and_subnormal_matches = numel(d) -
positive_zero_and_subnormal_mismatches




    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?65291>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]