Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7092595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:20:01+00:00 2026-05-28T08:20:01+00:00

The cartesian function inside List::Gen seems to be limited by the unsigned 32-bit upper

  • 0

The cartesian function inside List::Gen seems to be limited by the unsigned 32-bit upper limit on my 64-bit Windows OS:

use strict;
use warnings;
use List::Gen '*';
use 5.010;
use bigint;               # This didn't help either

say $List::Gen::VERSION;  # 0.80

my $diameters = range( 1, 175 );
my @five_in_a_row = ( $diameters ) x 5;

my $combinations = cartesian { \@_ } @five_in_a_row;

say 0+@$combinations;   # Should be 175**5 == 164_130_859_375
                        # prints -1+2**31  ==   2_147_483_647

Is there any way to overcome this limitation? My Perl build details are below.

> perl -v

This is perl 5, version 12, subversion 3 (v5.12.3) built for
MSWin32-x64-multi-thread (with 9 registered patches, see perl -V for
more detail)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T08:20:01+00:00Added an answer on May 28, 2026 at 8:20 am

    At some point, the tied interface to generators will always be limited, due to perl fitting array indicies into 32 or 64 bit integers. Beyond that range, you can use the object oriented interface to generators, which is not limited to 2**31-1 and is much faster than then tied interface.

    my $combinations = cartesian {\@_} map {range 1 => 175} 1 .. 5;
    
    say $combinations->size; # 164130859375
    

    and to get an element:

    my $x = $combinations->get(164130859374);
    

    or

    my $x = $combinations->(164130859374);
    

    And I will add auto-detected 64-bit limits to the list of improvements to make before the next release.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, I would like to build a list comprehension over the cartesian product of
I have a problem with writing a Cartesian power function. I found many examples
I've been trying to do a function that returns the Cartesian Product of n
Given two lists, I can produce a list of all permutations the Cartesian Product
I have an R / ggplot2 use case that seems to call for geom_raster
I want to read cartesian coordinates of a large set of points from of
A cross join performs a cartesian product on the tuples of the two sets.
This question asks how to compute the Cartesian product of a given number of
This question is related to my previous question How to generate Cartesian Coordinate (x,y)
Is there a good algorithm to calculate the cartesian product of three seq s

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.