GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — reconsider how floating point values are printed · Issue #960 · sagemath/sage

reconsider how floating point values are printed #960

New issue
Copy link
New issue
Copy link
Closed
Closed
reconsider how floating point values are printed#960
Copy link
Assignees
mwhansen
Labels
c: basic arithmeticp: major / 3t: bug
Milestone
sage-2.8.10

Description

@williamstein
williamstein
opened on Oct 21, 2007
Issue body actions
some f-p values are printed like integers, which may confuse the user
 (especially if one copies them with the mouse):
 sage: 2.0^46
 70368744177664.0
 sage: 2.0^47
 140737488355328
 I would expect '140737488355328.' or '1.40737488355328e14' in the 2nd case.
 By the way, typing 140737488355328.0 outputs itself, which is inconsistent,
 since 140737488355328.0-2.0^47 gives 0.0000000000000000.

 Compare also:
 sage: 2.0^99
 633825300114115000000000000000
 sage: 2.0^100
 1.26765060022823e30

My 2 cents,
Paul Z.

Component: basic arithmetic

Issue created by migration from https://trac.sagemath.org/ticket/960

Activity

  1. williamstein
    added
    c: basic arithmetic
    on Oct 21, 2007
  2. sagetrac-mabshoff commented on Oct 21, 2007

    @sagetrac-mabshoff
    sagetrac-mabshoffmannequin
    on Oct 21, 2007 · Hidden as outdated
    show commentMore actions
  3. sagetrac-mabshoff
    added this to the sage-2.8.9 milestone on Oct 21, 2007
  4. sagetrac-cwitty commented on Oct 21, 2007

    @sagetrac-cwitty
    sagetrac-cwittymannequin
    on Oct 21, 2007
    Mannequin
    More actions
    comment:3

    The inconsistency mentioned is because of the automagic behavior of decimal literals, where longer literals get more bits:

    sage: (2.0^47).prec()
    53
    sage: (140737488355328.0).prec()
    56
    

    Maybe this magic behavior should be removed, or somehow modified to be less confusing? (Although I have no idea how to make it less confusing.)

    See also #962, for problems with the current implementation of the precision extension.

  5. malb
    assigned
    sagetrac-cwitty
    on Oct 23, 2007
  6. mwhansen commented on Oct 24, 2007

    @mwhansen
    mwhansen
    on Oct 24, 2007
    Contributor
    More actions
    comment:5

    Attachment: mpfr.patch.gz

    I've attached a patch that makes sure that all real numbers include a "." so that they don't get confused with integers.

    Here is the behavior after the patch

    sage:  2.0^47
    140737488355328.
    sage:  2.0^46
    70368744177664.0
    sage:  2.0^99
    633825300114115000000000000000.
    sage:  2.0^100
    1.26765060022823e30
    sage: 140737488355328.
    140737488355328.
    sage: a = 2.0^47
    sage: a
    140737488355328.
    sage: a.prec()
    53
    sage: b = 140737488355328.
    sage: b.prec()
    53
    
  7. sagetrac-mabshoff
    modified the milestones: sage-2.8.9, sage-2.8.10 on Oct 25, 2007
  8. sagetrac-cwitty
    assigned
    mwhansen
    and unassigned
    sagetrac-cwitty
    on Oct 25, 2007
  9. sagetrac-cwitty
    closed this as completedon Oct 27, 2007
  10. vbraun
    added 3 commits that reference this issue on Dec 11, 2024

    5c700f2

    efe5f64

    a0b5486
  11. cxzhong
    added a commit that references this issue on Jul 5, 2026

    b47992c
  12. vbraun
    added a commit that references this issue on Aug 4, 2026

    a8905cd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @mwhansen
    mwhansen

Labels

c: basic arithmeticp: major / 3t: bug

Type

No type

Projects

No projects

    Milestone

    • sage-2.8.10

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402792 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.