Git Product home page Git Product logo

Comments (5)

iagomosqueira avatar iagomosqueira commented on August 20, 2024

Fixed now. 10 * t or t * 10 returns "t * 10" as units. Same for other powers of ten except for a thousand tonnes, where the convent "1000 t" is used instead.

from flcore.

gustavdelius avatar gustavdelius commented on August 20, 2024

That was quick. What is the philosophy behind these changes in units? Why would I want t * 10 as a unit? Would it not be better to restrict to well-known units like g, kg, tonnes, kilotonnes and megatonnes? In the example I gave I would have stuck with tonnes and just multiply the value by 10.

Also, do I really want to change the unit when I multiply the value by a numeric factor? It is a bit strange that multiplying by 2 * 5 is doing something different from multiplying by 10.

from flcore.

iagomosqueira avatar iagomosqueira commented on August 20, 2024

The logic is mostly applied to a product of two FLQuants, one with an unit like 't' or 'kg', multiplied by one that consists of thousands of individuals, '1000'. This is not of course a real unit but a convention we follow for example for numbers of individuals in thousands. In this case 'kg' * '1000' leads to 't'.
This was then applied to a product of an FLQuant with units and a numeric value that matched one of those 'units' used for numbers. So 'FLQuant(20, units='kg') * 1000work this way, but notFLQuant(20, units='kg') * 6`.

Maybe assuming the numeric value represents individuals, if it is a power of ten, is too much to do, and could limit this behaviour to operations with two FLQuant objects.

from flcore.

gustavdelius avatar gustavdelius commented on August 20, 2024

Yes, I think limiting the change of units to the operation between two FLQuants would be good. I think operation with a number should just change the numeric values.

from flcore.

iagomosqueira avatar iagomosqueira commented on August 20, 2024

uom() is not called anymore in operations between FLQuant and numeric, so units remain as those in the FLQuant object. 0f21520

from flcore.

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.