Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane

From: Johan Van Noten <johan <at> qootec.be>
Subject: Re: Unintuitive comparison between long and BigInteger
Newsgroups: gmane.comp.lang.jython.user
Date: Thursday 9th October 2014 09:24:23 UTC (over 4 years ago)
Hi Jeff,

This issue keeps bugging me... also in 2.7-b3.
So I decided to make a small Java application to demonstrate the issue.

Some easy steps:
1) Download archive from http://www.qtc.be/TestJython.zip

2) Extract
3) Run the script TestJython.cmd (just runs a small class with the jython
library on the cp)
4) Enter the example data (see below)
5) It is a small Eclipse Kepler project, so if you prefer, you can
load/debug/run it from Eclipse.

When I do this, I get:
E:\tmp\Jython\TestJython>TestJython.cmd
TestJython >>> 10L > 100
false
TestJython >>> a = 10L
None
TestJython >>> a > 100
true
TestJython >>> type(a)
class java.math.BigInteger
TestJython >>> exit

So, as I confirmed initially, the underlying layers seem to use the
BigInteger class, causing the failure in comparison.
As far as I know, I am not doing anything specific that could cause this.
I just use Jython as a Python Scripting Engine according to JSR-223, which
is a convenient way of using it.
(Take a look at the extremely simple src/TestJython.java)

Do you expect this behavior?
Can it be avoided?

Johan

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
 
CD: 15ms