Giter Club home page Giter Club logo

Comments (3)

wbhart avatar wbhart commented on August 16, 2024

There are five files xaa, xab, xac, xad, xae each with around 72 potential cases to check.

Here are the suspicious cases per file after volunteers examined the files. Each will have to be checked very carefully and/or fixed.

xaa:

No problems to report.

xab:

There is no cast here:
fmpz/cdiv_q_ui.c: fmpz_set_si(f, - (((ulong) -c1) / c2))
There might be more casts as well when defining q et al. checked OK

Same for fmpz/fdiv_q.c and other division files. Also note the
discrepancy in the types used there and in the previous file (most
division files seem to follow this latter file convention). checked OK

Also check fmpz/add.c and fmpz/fdiv_q_ui.c. checked OK

This one looks dangerous:
fmpz/cdiv_q_2exp.c: fmpz_set_si(f, -((-d) >> FLINT_MIN(exp, should be OK
FLINT_BITS - 2)));
I'm not sure what the C standard says about right shifts.

No cast from ulong to slong here (though the result is > 0):
fmpz/multi_CRT_ui.c: fmpz_set_si(output, residues[0] - p); checked OK

In fmpz/xgcd_partial.c a few slong are fed to _ui functions which should be ok. checked OK

In
fmpz/is_prime_morrison.c: fmpz_set_si(B, b); b FIXED
is a mp_limb_t

In
fmpz/add_ui.c: fmpz_set_si(f, x + c checked OK
ulong + slong.

xac:

fmpz/divexact_ui.c: fmpz_set_si(f, c1 / (slong) h); checked OK

fmpz/invmod.c: return (gcd == UWORD(1) ? fmpz_set_si(f, inv), 1 : 0); checked OK
fmpz/invmod.c: return (gcd == UWORD(1) ? fmpz_set_si(f, inv), 1 : 0); checked OK

fmpz.h: fmpz_set_si(f, x - m); checked OK

fmpz_mat/hadamard.c: fmpz_set_si(fmpz_mat_entry(Q, r, c), checked OK

xad:

No problems to report.

xae:

No problems to report.

from flint2.

fredrik-johansson avatar fredrik-johansson commented on August 16, 2024

The one in fmpz_mat/hadamard.c: is OK; the argument type is actually int. The longs are safe also and could be changed to either int or slong. In fact all the fmpz values being set in this file are -1, 0, 1.

from flint2.

wbhart avatar wbhart commented on August 16, 2024

Thanks for checking. I may as well set the longs to slongs, just so we
don't keep examining the same thing in future.

On 30 July 2015 at 16:58, Fredrik Johansson [email protected]
wrote:

The one in fmpz_mat/hadamard.c: is OK; the argument type is actually int.
The longs are safe also and could be changed to either int or slong. In
fact all the fmpz values being set in this file are -1, 0, 1.


Reply to this email directly or view it on GitHub
#32 (comment).

from flint2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.