Giter Club home page Giter Club logo

Comments (3)

ViralBShah avatar ViralBShah commented on May 16, 2024

That is indeed the right answer. Here is matlab:

>> format long
>> 10.3*3     

ans =

  30.900000000000002

This should have been filed at https://github.com/JuliaLang/julia/issues.

from gadfly.jl.

Suedede avatar Suedede commented on May 16, 2024

Allright then, thanks for being so polite and giving me a quick short answer.

from gadfly.jl.

StefanKarpinski avatar StefanKarpinski commented on May 16, 2024

This is a weird place to file such a bug since it has nothing to do with Gadfly. A little more elaboration – R looks like its answer is exactly 30.9 because it rounds trailing digits when it prints numbers, effectively lying about their exact value. Checking equality with 30.9, however, reveals that the value is not actually the same:

> 10.3*3
[1] 30.9
> 10.3*3 == 30.9
[1] FALSE
>

Julia, on the other hand, prints all the digits required to reconstruct a floating point number exactly, so you can see that this value is not exactly 30.9. All these systems are converting the input 30.9 to the closest representable IEEE 754 64-bit floating-point number (30.9 is not exactly representable in binary), and then doing standard IEEE arithmetic to get this result.

from gadfly.jl.

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.