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

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

[Octave-bug-tracker] [bug #65495] nchoosek error "gcd: all values must b


From: Markus Mützel
Subject: [Octave-bug-tracker] [bug #65495] nchoosek error "gcd: all values must be integers"
Date: Wed, 20 Mar 2024 13:20:03 -0400 (EDT)

Follow-up Comment #11, bug #65495 (group octave):

I wonder if we should interrupt the for loop when C reaches Inf.
Maybe something along the lines of the following?

diff -r a79e07f980ff scripts/specfun/nchoosek.m
--- a/scripts/specfun/nchoosek.m        Fri Mar 15 07:24:58 2024 -0400
+++ b/scripts/specfun/nchoosek.m        Wed Mar 20 18:19:07 2024 +0100
@@ -149,6 +149,9 @@
         C *= (v - k + i);
         C /= i;
       endif
+      if (isinf (C))
+        break;
+      endif
     endfor
     if (! is_int && C > imax)
       warning ("Octave:nchoosek:large-output-float", ...


CC'ing Hendrik in case they have a better idea.



    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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