Fragmented - Android Developer Podcast

132: Dealing with Money in programming


Listen Later

In this mini fragment Kaushik talks about dealing with the Money object. With money we need decimals, but the obvious solution of using a float or double may not work as advertised. Listen to this episode to find out why and how you can go about dealing with this.

Show Notes
  • The infamous Short - Ep029: All about the infamous 65,536 dex method count
  • IEEE_754 float storage format
  • How binary fractions work
  • Problematic snippet 1:

    println(1.03-0.42) # prints 0.6100000000000001

    Problematic snippet 2:

    var x = 0F
    (1..100).forEach { i ->
    x += 0.01F
    }
    println(x) # 0.99999934 vs 1
    Sponsors
    • Bitrise - Bitrise is your mobile continuous integration and delivery for your whole team, with dozens of integrations for your favorite services.
    • Contact
      • @fragmentedcast [twitter.com]
      • @donnfelker and +DonnFelker
      • @kaushikgopal and +KaushikGopalIsMe
      • ...more
        View all episodesView all episodes
        Download on the App Store

        Fragmented - Android Developer PodcastBy Donn Felker, Kaushik Gopal

        • 5
        • 5
        • 5
        • 5
        • 5

        5

        68 ratings


        More shows like Fragmented - Android Developer Podcast

        View all
        Design Details by Brian Lovin, Marshall Bock

        Design Details

        361 Listeners

        Developer Tea by Jonathan Cutrell

        Developer Tea

        402 Listeners

        Does Not Compute by Sean Washington, Rockwell Schrock

        Does Not Compute

        53 Listeners

        Toolsday by Una Kravets, Chris Dhanaraj

        Toolsday

        48 Listeners

        Swift Unwrapped by JP Simard, Jesse Squires, Spec Network, Inc.

        Swift Unwrapped

        90 Listeners