Mercurial > hg > octave-avbm
changeset 1570:b10436a98aa7
[project @ 1995-10-19 04:16:37 by jwe]
author | jwe |
---|---|
date | Thu, 19 Oct 1995 04:16:37 +0000 |
parents | b221bae7ca15 |
children | 6ddabf91bc4e |
files | src/expm.cc |
diffstat | 1 files changed, 10 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/expm.cc +++ b/src/expm.cc @@ -140,13 +140,16 @@ m.fortran_vec (), nc, work.fortran_vec ()); - sqpow = (int) (1.0 + log (inf_norm) / log (2.0)); + sqpow = (int) (inf_norm > 0.0 + ? (1.0 + log (inf_norm) / log (2.0)) + : 0.0); // Check whether we need to square at all. if (sqpow < 0) sqpow = 0; - else + + if (sqpow > 0) { for (inf_norm = 1.0, i = 0; i < sqpow; i++) inf_norm *= 2.0; @@ -234,13 +237,16 @@ m.fortran_vec (), nc, work.fortran_vec ()); - sqpow = (int) (1.0 + log (inf_norm) / log (2.0)); + sqpow = (int) (inf_norm > 0.0 + ? (1.0 + log (inf_norm) / log (2.0)) + : 0.0); // Check whether we need to square at all. if (sqpow < 0) sqpow = 0; - else + + if (sqpow > 0) { for (inf_norm = 1.0, i = 0; i < sqpow; i++) inf_norm *= 2.0;