AROSAmiga Research OS

Previous Next Top of Manual blank.gif

AROS - The Amiga Research OS


Documentation
    AutoDocs
        Exec.library
        MathFFP.library
            SPAdd
            SPCmp
            SPMul
            SPAbs
            SPCeil
            SPDiv
            SPNeg
            SPTst
            SPFloor
            SPFix
            SPSub
            SPFlt
        MathIEEEDoubleBase
        MathIEEEDoubleTrans
        MathIEEESingleBase
        MathIEEESingleTrans
        MathTrans
NAME
#include <libraries/mathffp.h>
#include <proto/mathffp.h>

float SPFloor ()

SYNOPSIS
float y

FUNCTION
Calculate the largest integer ffp-number less than or equal to fnum
INPUTS
y
FFP number

RESULT
FFP number Flags: zero : result is zero negative : result is negative overflow : 0 (???)
NOTES
EXAMPLE
floor(10.5) = 10
floor(0.5)  = 0
floor(-0.5) = -1
floor(-10.5)= -11

BUGS
SEE ALSO
MathFFP.library, IEEESPCeil(), IEEESPFloor(), SPCeil()

INTERNALS
ALGORITHM:

The integer part of a ffp number are the left "exponent"-bits of the mantisse! Therefore: Test the exponent for <= 0. This has to be done separately! If the sign is negative then return -1 otherwise return 0.

Generate a mask of exponent(y) (where y is the given ffp-number) bits starting with bit 31. If y < 0 then test whether it is already an integer. If not then y = y - 1 and generate that mask again. Use the mask on the mantisse.


Previous Next Top of Manual blank.gif
minilogo.gif

Amiga® is a trademark of Amiga Inc. All other trademarks belong to their respective owners.

Copyright © AROS - The Amiga Research OS
All Rights Reserved
Comments to webmaster: digulla@aros.org
Generated: Tue Sep 4, 2001