Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Problem 1731. Text File Read: 64 bit data set

Created by Richard Zapor

This Challenge is to read a text file that has vary large integers up to 2e18, typical for Google Code Jam. These values are well within the bounds of uint64.

The data is an array of Q pairs.

Input: [Q, fname] The number of lines in the file and its filename.

Output: M a uint64 matrix of size(Q,2)

Example:

Input: {4, 'Cody_64.txt']
The text file:
308436464205151562 1850618785230909388
373665302816212423 1494661211264849698
760961177192651897 1521922354385303795
1 2000000000000000000
Ouput: A uint64 (4,2) matrix to full precision.

Note of Warning:

The fscanf function with %ul may not succeed, as of 7/20/2013.

The result window has a case showing the function output

Related Challenges:

1) Bullseye Large Numbers r<1E18, P<2E18
2) Super Large Numbers >2^64  (Java BigInteger methods)

Tags

Problem Group

Solution Statistics

7 correct solutions 14 incorrect solutions
Last solution submitted on Sep 15, 2014

Solution Comments