From 427844cfd19fcf7d9a004f9da63aa32bf6dca323 Mon Sep 17 00:00:00 2001 From: Joachim Klein Date: Fri, 22 Jul 2016 10:34:43 +0000 Subject: [PATCH] BigRational: add isInteger method git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@11554 bbc10eb1-c90d-0410-af57-cb519fbb1720 --- prism/src/param/BigRational.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/prism/src/param/BigRational.java b/prism/src/param/BigRational.java index fcd397c6..8e484e20 100644 --- a/prism/src/param/BigRational.java +++ b/prism/src/param/BigRational.java @@ -774,6 +774,18 @@ public final class BigRational implements Comparable return !isNaN() && !isInf() && !isMInf(); } + /** + * Returns true iff this object represents an integer, i.e., + * is not not-a-number, positive, or negative infinity and + * the denominator is 1. + * + * @return true iff this object represents an integer + */ + public boolean isInteger() + { + return isRational() && getDen().equals(ONE); + } + /** * Returns true iff this value represents a special number. * This is the case if this is either not-a-number, positive or