Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • gnumeric gnumeric
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 378
    • Issues 378
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 3
    • Merge requests 3
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GNOME
  • gnumericgnumeric
  • Issues
  • #603

Closed
Open
Created Oct 10, 2021 by b. s.@newbie-02

avoid '-0' as result of '=ceil( x )' with x = ( -1 .. 0 )

just a test to learn the craftsmanship of issue-ing and git-ing ...

Gnumeric announces in 'http://www.gnumeric.org/numerical-issues.html': 'We also do our best to hide the value "-0" from users.'.

But '=ceil( -0.5 )' results in '-0'.

Plenty functions in gnumeric/plugins/fn-math/functions.c have a 'catch-0' upfront to avoid such? CEIL hasn't. Tried to implement.

Of course everything may be improved / corrected by experienced developers.

the patch i'll try to push is:

static GnmValue *
gnumeric_ceil (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
{
// edit b. - TO STAY - 2021-10-10: avoid '-0' results
        return ( gnm_fake_ceil( value_get_as_float( argv[ 0 ] ) ) == -0 )
                ? 0                                                                     // change to '0'
                : value_new_float (gnm_fake_ceil (value_get_as_float (argv[0])));
}  
Assignee
Assign to
Time tracking