Menu

#9 Floating point primatives for MPI

open
nobody
2
2001-06-20
2001-05-16
No

I would like to see floating point derivatives of a
number of the math functions to support such things as
Imperial <--> Metric conversions and similar operations
in MPI.

The following would be useful:

{fadd} - floating point addition
{fsubt} - floating point subtraction
{fdiv} - floating point division
{fmult} - floating point multiplication
{fmax} - floating point - max of two numbers
{fmin} - floating point - min of two numbers

Discussion

  • Kyle Hamilton

    Kyle Hamilton - 2001-06-20
    • labels: --> MPI interpreter
    • priority: 5 --> 2
     
  • Kyle Hamilton

    Kyle Hamilton - 2001-06-20

    Logged In: YES
    user_id=7718

    Floating point was the default in the initial version of
    MPI. It was removed for speed reasons.

    What all capabilities would be necessary to be supported?

     
  • John R. Johns II

    Logged In: YES
    user_id=220231

    According to Revar in a discussion online, floating point
    was initially going to be implemented transparently; {add}
    would do both integer and floating point. However, as you
    observed, for speed reasons this functionality was dropped.

    Without some sort of floating point functionality, I'm
    forced into writing obtuse code to shift decimals and treat
    things like integers, then shift the decimals back in. I'm
    trying to do metric/imperial measurement conversions without
    having to learn MUF.

    After explaining my situation to Revar, Revar suggested that
    perhaps floating point could be implemented as its own set
    of "f*" functions. This way, the floating point code would
    only be used when absolutely necessary.

    The capabilities _necessary_ are exactly those stated in my
    original feature request: Add, subtract, divide, multiply,
    and determine which is the greater or lesser of two numbers.

    Ideally, the Logical functions "eq", "lt", "le", "gt", and
    "ge" would also have appropriate floating point
    functionality, but as long as I have {fmax} and {fmin} I can
    probably write my own macros to reproduce that functionality
    without too much difficulty. A function to round to a
    specific precision would also be nice but again not
    necessary.

     

Log in to post a comment.

MongoDB Logo MongoDB