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

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

[Octave-bug-tracker] [bug #63415] Error in fwrite() or rand() or randn()


From: José Luis García Pallero
Subject: [Octave-bug-tracker] [bug #63415] Error in fwrite() or rand() or randn(), I'm not sure
Date: Fri, 25 Nov 2022 04:18:27 -0500 (EST)

URL:
  <https://savannah.gnu.org/bugs/?63415>

                 Summary: Error in fwrite() or rand() or randn(), I'm not sure
                 Project: GNU Octave
               Submitter: jgpallero
               Submitted: vie 25 nov 2022 09:18:24
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: José Luis García Pallero
        Originator Email: 
             Open/Closed: Open
                 Release: 8.0.90
         Discussion Lock: Any
        Operating System: Any
           Fixed Release: None
         Planned Release: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: vie 25 nov 2022 09:18:24       By: José Luis García Pallero
<jgpallero>
Hello:

Yesterday (November, 24th) I cloned the stable branch of Octave (hg clone
https://hg.octave.org/octave -r stable) and I compiled it (version command
output is 8.1.0)

When I try to print a matrix generated by rand function to a binary file I
obtain an incorrect size. See this code:

idf = fopen('m_eye.bin','wb','ieee-le');
mat = eye(100,150);
n = fwrite(idf,mat,'double')
fclose(idf);

idf = fopen('m_rand.bin','wb','ieee-le');
mat = rand(100,150);
n = fwrite(idf,mat,'double')
fclose(idf);


The first file contains a matrix generated by eye and written as 'double'
format. As its dimensions are 100x150 the final file size if 100*150*8=120000
bytes. But in the second case the matrix is generated by rand function and the
size of the file created is  114971 bytes (the size varies between different
executions), so I think there is an error in fwrite() function or maybe in
rand() or even in randn(), which produces also wrong size in the file.

But all works well with Octave 7.3.0, the file sizes are correct







    _______________________________________________________

Reply to this item at:

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

_______________________________________________
Mensaje enviado vía Savannah
https://savannah.gnu.org/




reply via email to

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