Git Product home page Git Product logo

Comments (6)

bennibbelink avatar bennibbelink commented on July 23, 2024

Turns out we already have constants for this in cyc_limits.h:

/// maximum (+ or -) value for an integer variable
static const int kIntBoundLimit = std::numeric_limits<int>::max();

/// maximum (+ or -) value for a linear variable
static const double kLinBoundLimit = std::numeric_limits<double>::max();

from cyclus.

gonuke avatar gonuke commented on July 23, 2024

I found those recently, too, but they seemed to be named in a way that was intended for some specific purpose. Perhaps we can revisit their naming so that it is more clear how they can/should be used.

from cyclus.

bennibbelink avatar bennibbelink commented on July 23, 2024

They're not used anywhere in cyclus/cyclus or cyclus/cycamore. Based on their names it sounds like they might be intended for this specific purpose (specifying an upper/lower bound) but I agree that we could use more intuitive names. What do you think about changing them to something more generic like:

  • cy_max_int
  • cy_min_int
  • cy_max_double
  • cy_min_double

Looking at the rest of this file:

  • There are also no instances of kConstraintEps anywhere else in the code, and I'm unsure of the use case for it vs. cy_eps.
  • kModifierLimit is used only in commodity_producer.h (and a test). It is describe as maximum value for a function modifier (i.e., a_i for variable x_i) in a comment, but its not clear to me whether this is how it's being used in CommodityProducer

from cyclus.

bennibbelink avatar bennibbelink commented on July 23, 2024

Trying to clean up places in cyclus and cycamore where we use 1e299 and running into overflow issues in the Enrichment class when calculating enrichment parameters. It appears that by using std::numeric_limits::max() instead of 1e299 there are some calculations that push us over the edge. @gonuke do you know if 1e299 was picked arbitrarily or is it meant to be an intentional upper bound on some parameters?

Many of the places it is used in cycamore can be found here

from cyclus.

gonuke avatar gonuke commented on July 23, 2024

I don't recall how we chose 1e299. Any idea how different it is from the IEEE max double?

from cyclus.

bennibbelink avatar bennibbelink commented on July 23, 2024

The IEEE max double is the same as std::numeric_limits<double>::max() - roughly 1.8e+308. I will continue exploring...

from cyclus.

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.