Java float vs. double and micro-optimization

Some people at work implemented a few classes all with floats and I am sick and tired of casting everything into float. There is absolutely no reason why floats should have ever been used. The original reason was because of memory and/or network and/or diskspace issues which is all now totally irrelevant because the project that these classes were mostly used for has now been scrapped. I recently ripped out a few classes from that project, however, because they are useful. I am finding them extremely annoying to use, however. Not only do they use floats but they are totally micro-optimized in other ways as well. I'm probably rewrite the class soon anyways so that it is readable. My opinion is that there is no reason to ever use anything other than ints, doubles, and bytes in Java. At leas in 2 years I have never come across any reason. Part of this is Java's fault for having two floating point types in the first place. I would have been much happier had this all been developed in Python.

Tags: 

Comments

Though quite old now, it was a pretty useless rant at the time and it still is now, if you ask me.

It comes down to "Don't use floats because I don't like them", which can hardly be considered a reasonable argument. Instead, if you want to try to confince people, mention what the difference between floats and doubles is, why floats where actually used in the past, why this is different now, why using floats is now a problem and why doubles would now be more appropiate. No concrete examples where given, just that some project used to have 'memory and/or network and/or diskspace issues' when not using floats. We don't know anything about that project.

p://www.leftsen.com/discussion/137730/httpwww-hbdjd-comaustralia-soccer-jers... http://www.rmnx.com/docs/index.php?title=User:Hdz23w8o#http:.2F.2Fwww.fr... http://zjq801111.yes123e.84684.net/home.php?mod=space&uid=192012 http://guanyuma.com/home.php?mod=space&uid=12984 http://sc.admin987.com/home.php?mod=space&uid=226197 http://sasksun.com/home.php?mod=space&uid=45772 http://home.tonlion.com/home.php?mod=space&uid=2361417 http://www.lefenxiang.net/home.php?mod=space&uid=32730 http://lagrimasyrisas.hol.es/?q=node/36495 http://cake57.com/home.php?mod=space&uid=512027 http://yl1881.com/home.php?mod=space&uid=57677 http://www.themulan.com/home.php?mod=space&uid=317120 http://www.0370cars.com/bbs/home.php?mod=space&uid=1393306 http://www.001english.com/home.php?mod=space&uid=125959 http://twopenguinsphotography.com/piwigo/picture.php?/17/category/5/star... http://mtdz.foz.cn/home.php?mod=space&uid=1679360 http://www.wshfy.cn/bbs/home.php?mod=space&uid=93897 http://www.euds.net/piwigo/picture.php?/138/list/178,21,142,238,216,115,... http://www.tyjktz.net/home.php?mod=space&uid=1743087 http://www.920hqw.net/bbs/home.php?mod=space&uid=102249 http://www.315ai.com/home.php?mod=space&uid=51187 http://www.szmami.com/home.php?mod=space&uid=27978 http://club-images-et-nature.com/fotos/picture.php?/3128/category/326/st... http://bbs.weiqn.com/home.php?mod=space&uid=23765 http://www.17ws8.com/bbs/home.php?mod=space&uid=337803 http://zgjrbbs.com/home.php?mod=space&uid=452665 http://www.wmkdw.com/home.php?mod=space&uid=8225 http://www.nanfanrencai.com/home.php?mod=space&uid=527586 http://u533awww.china-up.com/bbs/home.php?mod=space&uid=4257787 http://www.zhongshe.com/home.php?mod=space&uid=1047801 http://www.mypresta.com/home.php?mod=space&uid=368593 http://bbs.hzrtv.cn/home.php?mod=space&uid=681312 http://bbs.0730news.com/forum.php?mod=viewthread&tid=123580&fromuid=122674 http://25514.102.250.18www.ttlang123.com/home.php?mod=space&uid=2863415 http://www.boceinfo.com/wyg/bbs/home.php?mod=space&uid=8178 http://sww.china-up.com/bbs/home.php?mod=space&uid=4257786 http://218.26.12.59/jyw/home.php?mod=space&uid=298339 http://bbs.rysmart.com/home.php?mod=space&uid=73404 http://shequ.vfeel.net/home.php?mod=space&uid=22799 http://dsfxht.com/home.php?mod=space&uid=5180 http://www.jk400.net/home.php?mod=space&uid=120724 http://jstfbbs.szkuniu.com/home.php?mod=space&uid=1018043 http://www.menglawang.net/mlclub/home.php?mod=space&uid=61215 http://jis007.com/home.php?mod=space&uid=139112 http://www.hmtqd.com/home.php?mod=space&uid=57241 http://www.tjcs.net/home.php?mod=space&uid=26135 http://www.yileyou8090.com/home.php?mod=space&uid=41976 http://www.ngbx.net/home.php?mod=space&uid=17737

http://www.9t9.cc/forum.php?mod=viewthread&tid=318044 http://www.france-wojtkowiak.com/galerie/picture.php?/86/list/63,52,84,7... http://zg.ekxx.cn/forum.php?mod=viewthread&tid=83267 http://www.kuts.cn/dz2/forum.php?mod=viewthread&tid=404529 http://plataformaisonomia.uji.es/campanyabonrotllo/picture.php?/8/list/3... http://rustika-bogdanovic.com/galerija/picture.php?/313/list/335,519,123... http://guanyuma.com/home.php?mod=space&uid=15051 http://xar168.com/thread-17636-1-1.html http://deminternets.com/elina/picture.php?/692/category/16/start-2380&co... http://center.snxiaowai.com/forum.php?mod=viewthread&tid=670772 http://plataformaisonomia.uji.es/campanyabonrotllo/picture.php?/35/list/... http://198.1.109.31/f.atl168.com/home.php?mod=space&uid=52194&do=blog&qu... http://www.93tyy.com/thread-72760-1-1.html http://ftpmjtxw.synddos.com/thread-38574-1-1.html http://www.9t9.cc/forum.php?mod=viewthread&tid=318043 http://club-images-et-nature.com/fotos/picture.php?/3128/category/326/st... http://www.ait.cn/bbs_2/boke.asp?vul05j5g.showtopic.53214.html http://plataformaisonomia.uji.es/campanyabonrotllo/picture.php?/32/list/... http://www.euds.net/piwigo/picture.php?/138/list/178,21,142,238,216,115,... http://www.yfres.com/bbs/forum.php?mod=viewthread&tid=980554 http://www.wucailige.com/bbs/boke.asp?c0w7j5bb.showtopic.44609.html http://plataformaisonomia.uji.es/campanyabonrotllo/picture.php?/35/list/... http://www.france-wojtkowiak.com/galerie/picture.php?/86/list/63,52,84,7... http://bbs.cnlxjkw.com/thread-4369426-1-1.html http://jtsg.dylsw.net/forum.php?mod=viewthread&tid=1847072 http://www.planinica.info/galerija/picture.php?/58/list/15,71,28,96,59,2... http://www.0935tc.com/home.php?mod=space&uid=80188 http://plataformaisonomia.uji.es/campanyabonrotllo/picture.php?/34/list/... http://237.newfine.net/home.php?mod=spacecp&ac=blog&blogid= http://xiaogushi.9youe.cn/home.php?mod=space&uid=164320 http://villains.elemential.net/wiki/index.php/User:O6x3h5Bq#wholesale_sa... http://www.jiese.cn/home.php?mod=space&uid=60715 http://rustika-bogdanovic.com/galerija/picture.php?/15/list/170,251,354,... http://www.bx5.cn/forum.php?mod=viewthread&tid=281919 http://www.howlu.com/home.php?mod=space&uid=14484 http://www.miaoshuawang.com/forum.php?mod=viewthread&tid=463893 http://www.xc180.com/forum.php?mod=viewthread&tid=149995 http://222.73.18.55:10010/bbs/viewthread.php?tid=2184636&extra= http://bbs.haqcw.com/forum.php?mod=viewthread&tid=130750 http://imluky.com/viewthread.php?tid=571973&extra= http://bbs.90game.cn/home.php?mod=space&uid=1233709 http://bbs.tsing.cn/home.php?mod=space&uid=107694 http://car.ycen.com.cn/bbs/home.php?mod=space&uid=111310&do=blog&quickfo... http://bbs1.iheima.com/home.php?mod=space&uid=55781 http://www.lierener.com/forum.php?mod=viewthread&tid=3524974 http://www.euds.net/piwigo/picture.php?/138/list/178,21,142,238,216,115,... http://bbs.uu66.com/forum.php?mod=viewthread&tid=1700255 http://rustika-bogdanovic.com/galerija/picture.php?/313/list/335,519,123... http://www.nmgqncy.com/bbs/forum.php?mod=viewthread&tid=1113357 http://zg.ekxx.cn/forum.php?mod=viewthread&tid=83266

http://forums.zizzerscape.com/viewtopic.php?f=3&t=48549 http://t5.0517test.com/forum.php?mod=viewthread&tid=912972 http://t5.0517test.com/forum.php?mod=viewthread&tid=912971 http://finpedia.net/Main_Page http://www.creativeavenuedesign.com/support/wiki/index.php?title=User:Xq... http://www.ymaimai.com/forum.php?mod=viewthread&tid=129234 http://28iii.700didi.co.in/forum.php?mod=viewthread&tid=733500 http://28iii.700didi.co.in/forum.php?mod=viewthread&tid=733501 http://www.the4um.net/thread-2504894-1-1.html http://bbs.vviivv.com/forum.php?mod=viewthread&tid=179636 http://plataformaisonomia.uji.es/campanyabonrotllo/picture.php?/8/list/3... http://bbs.91aot.com/forum.php?mod=viewthread&tid=92795 http://bbs.kengbi.com/forum.php?mod=viewthread&tid=1341508 http://www.euds.net/piwigo/picture.php?/138/list/178,21,142,238,216,115,... http://www.yfres.com/bbs/forum.php?mod=viewthread&tid=1028577 http://hualianshe.sakura.ne.jp/forum.php/home.php?mod=space&uid=255609 http://www.euds.net/piwigo/picture.php?/138/list/178,21,142,238,216,115,... http://rustika-bogdanovic.com/galerija/picture.php?/313/list/335,519,123... http://221.206.104.101:8092/showtopic-835688.aspx http://bbs.ichina.cn/forum.php?mod=viewthread&tid=250561 http://www.euds.net/piwigo/picture.php?/138/list/178,21,142,238,216,115,... http://plataformaisonomia.uji.es/campanyabonrotllo/picture.php?/32/list/... http://221.206.104.101:8092/showtopic-835689.aspx http://www.91509.com/m/thread-48873-1-1.html http://dayabbs.vip.yisunet.cn/forum.php?mod=viewthread&tid=220733 http://www.euds.net/piwigo/picture.php?/138/list/178,21,142,238,216,115,... http://innocence-bbs.711vps.info/thread-91336-1-1.html http://plataformaisonomia.uji.es/campanyabonrotllo/picture.php?/32/list/... http://plataformaisonomia.uji.es/campanyabonrotllo/picture.php?/32/list/... http://sj.1-ad.cn/home.php?mod=space&uid=57468 http://www.symbianity.com/viewtopic.php?f=6&t=1128491 http://www.yfres.com/bbs/forum.php?mod=viewthread&tid=1028580 http://www.dgddzpk.com/forum.php?mod=viewthread&tid=758876 http://www.lierener.com/forum.php?mod=viewthread&tid=3656160 http://www.yongbinggonghui.cn/bbs/thread-15803-1-1.html http://www.lierener.com/forum.php?mod=viewthread&tid=3656161 http://www.nmgqncy.com/bbs/forum.php?mod=viewthread&tid=1170983 http://www.gywdjyj.com.cn:808/upload/forum.php?mod=viewthread&tid=227110 http://plataformaisonomia.uji.es/campanyabonrotllo/picture.php?/34/list/... http://guizubbs.net/thread-194573-1-1.html http://www.hunqingdian.com/home.php?mod=space&uid=67840&do=blog&quickfor... http://www.miaoshuawang.com/forum.php?mod=viewthread&tid=502826 http://bbs.pandathumb.com/forum.php?mod=viewthread&tid=132682 http://www.jxxmp.com/forum.php?mod=viewthread&tid=55956 http://www.utsft.com/zxlt/forum.php?mod=viewthread&tid=97389 http://xiaofuyanjiu.com/forum.php?mod=viewthread&tid=408405&fromuid=161138 http://bbs.ydlcw.com/home.php?mod=space&uid=38520 http://www.miaoshuawang.com/forum.php?mod=viewthread&tid=502828 http://bbs.haqcw.com/forum.php?mod=viewthread&tid=141302 http://car.ycen.com.cn/bbs/home.php?mod=space&uid=143103&do=blog&quickfo...

http://www.manxiansheng.com/forum.php?mod=viewthread&tid=514947 http://www.his2012.com/bbs/forum.php?mod=viewthread&tid=79407 http://www.0797city.com/home.php?mod=space&uid=157164&do=blog&quickforwa... http://180.169.23.108:5001/Discuz/showtopic-557683.aspx http://Tgi.kr/index.php/User:L0n0l4Bs#liverpool_suarez_jersey_12.2F13_38329 http://bbs.cnlxjkw.com/thread-5396724-1-1.html http://www.femout.com/forum/entry.php?4351-porto-home-kit-32245 http://cnluan.com/bbs/forum.php?mod=viewthread&tid=355284 http://bbs.150800.com/forum.php?mod=viewthread&tid=3385634 http://game.qdren.net/bbs/forum.php?mod=viewthread&tid=753480 http://515754546a.gicp.net:8083/home.php?mod=space&uid=14195&do=blog&qui... http://symbiosis.so/home.php?mod=space&uid=19255&do=blog&quickforward=1&... http://igem.bio-x.cn/wiki/User:Pyu07r4c#belgium_football_team_shirt_35810 http://www.capslisozluk.com/tr/picture.php?/91/category/4&comments_order... http://my-show.net/Main_Page http://www.yuxingschool.com/home.php?mod=space&uid=502 http://car.ycen.com.cn/bbs/home.php?mod=space&uid=230509&do=blog&quickfo... http://www.game-t9.com/forum.php?mod=viewthread&tid=435542 http://bbs.3ncy.com/home.php?mod=space&uid=12628&do=blog&quickforward=1&... http://www.cn0411.tk/forum.php?mod=viewthread&tid=435851&extra= http://guijiao.yayinhua.com/home.php?mod=space&uid=45923 http://home.wpbst.com/space.php?uid=259692&do=blog&id=1295460 http://www.planinica.info/galerija/picture.php?/65/category/3/start-4220... http://rustika-bogdanovic.com/galerija/picture.php?/15/list/170,251,354,... http://www.photohz.com/bbs/forum.php?mod=viewthread&tid=844992 http://gruot.gicp.net:87/forum.php?mod=viewthread&tid=4434958 http://bbs1.iheima.com/home.php?mod=space&uid=75416 http://www.aetherfoto.com/picture.php?/659/list/438,544,170,602,172,579,... http://gg99.000space.com/read.php?tid=414296 http://ygsq.sq1996.com/thread-623208-1-1.html http://bbs.jzw0575.com/showtopic-990283.aspx http://www.multiversemmo.com/wiki/index.php/User:Lqv201f8#custom_authent... http://www.qzmuseum.net/Review.asp?NewsID=139 http://www.1555666.net/forum.php?mod=viewthread&tid=15384 http://bbs.slyzc.com/showtopic-1411520.aspx http://talgon.com/bbs/forum.php?mod=viewthread&tid=1156514 http://deminternets.com/elina/picture.php?/715/list/146,222,198,194,707,... http://dz.wannajoy.com/forum.php?mod=viewthread&tid=770307 http://senink.net/discuz/forum.php?mod=viewthread&tid=887138 http://bbs.uu66.com/forum.php?mod=viewthread&tid=2581119 http://v.hc0591.com/forum.php?mod=viewthread&tid=37495 http://www.bluegrasscollege.org:8080/jforum/posts/list/0/74452.page#74096 http://www.hmshlyey.com/Review.asp?NewsID=754 http://www.sm999.net/forum.php?mod=viewthread&tid=3695521 http://www.daminggong.com/bbs/forum.php?mod=viewthread&tid=5310889 http://202.109.115.218:8080/read.php?tid=10279112 http://www.ichufaba.com/bbs/showtopic-229948.aspx http://www.aimeiji.cn/forum.php?mod=viewthread&tid=1256613 http://holoing.com/read.php?tid=120520&ds=1 http://xkuaibo.net/home.php?mod=space&uid=10002321&do=blog&quickforward=...

http://plataformaisonomia.uji.es/campanyabonrotllo/picture.php?/32/list/... http://www.danaovip.com/thread-128331-1-1.html http://www.longxiangbbs.com/thread-58609-1-1.html http://bbs.31tw.com/thread-99126-1-1.html http://plataformaisonomia.uji.es/campanyabonrotllo/picture.php?/22/list/... http://www.planinica.info/galerija/picture.php?/65/category/3/start-4220... http://www.t9pingtai.com/forum.php?mod=viewthread&tid=2944124 http://bbs.sanqinyigong.com/forum.php?mod=viewthread&tid=876747 http://bbc.cqyg520.com/showtopic-1030447.aspx http://www.gruot.net:87/forum.php?mod=viewthread&tid=5931520 http://www.168282.com/forum.php?mod=viewthread&tid=12595 http://www.france-wojtkowiak.com/galerie/picture.php?/67/list/1,83,63,67... http://www.zypfb120.net/thread-783152-1-1.html http://www.hngbzx.com/forum/showtopic-320403.aspx http://rustika-bogdanovic.com/galerija/picture.php?/313/list/335,519,123... http://ftpmjtxw.synddos.com/thread-270655-1-1.html http://bbs.86656.net/home.php?mod=space&uid=15075&do=blog&quickforward=1... http://www.france-wojtkowiak.com/galerie/picture.php?/86/list/63,52,84,7... http://rustika-bogdanovic.com/galerija/picture.php?/15/list/170,251,354,... http://qzmuseum.net/Review.asp?NewsID=139 http://180.169.23.108:5001/Discuz/showtopic-860864.aspx http://zhizhuqu.com/home.php?mod=space&uid=8052 http://xige.b2cn.tk/thread-158192-1-1.html http://bbs.zaowan.cn/home.php?mod=space&uid=97482&do=blog&quickforward=1... http://d.smartinfohk.com/house3/home.php?mod=space&uid=60701&do=blog&qui... http://www.hngbzx.com/forum/showtopic-320426.aspx http://plataformaisonomia.uji.es/campanyabonrotllo/picture.php?/19/list/... http://www.gruot.net:87/home.php?mod=space&uid=253069&do=blog&quickforwa... http://rustika-bogdanovic.com/galerija/picture.php?/313/list/335,519,123... http://szbbs.sznews.com/home.php?mod=spacecp&ac=blog&blogid= http://plataformaisonomia.uji.es/campanyabonrotllo/picture.php?/20/list/... http://bbs.0871lt.com/home.php?mod=space&uid=29803 http://rustika-bogdanovic.com/galerija/picture.php?/15/list/170,251,354,... http://www.his2012.com/bbs/forum.php?mod=viewthread&tid=307530 http://www.hmsxzxx.com/Review.asp?NewsID=765 http://chlib.org/Review.asp?NewsID=345 http://www.dooer.in/thread-652276-1-1.html http://bbs.zhibo361.com/forum.php?mod=viewthread&tid=39441 http://www.83host.com/forum.php?mod=viewthread&tid=3912140&extra= http://www.conseptizer.org/wiki/index.php?title=User:J2d5o4Ba#man_united... http://plataformaisonomia.uji.es/campanyabonrotllo/picture.php?/35/list/... http://www.france-wojtkowiak.com/galerie/picture.php?/67/list/1,83,63,67... http://plataformaisonomia.uji.es/campanyabonrotllo/picture.php?/34/list/... http://plataformaisonomia.uji.es/campanyabonrotllo/picture.php?/35/list/... http://www.chhaoes.com/bbs/home.php?mod=space&uid=111970&do=blog&quickfo... http://www.33mskc.com/forum.php?mod=viewthread&tid=394388 http://www.france-wojtkowiak.com/galerie/picture.php?/86/list/63,52,84,7... http://plataformaisonomia.uji.es/campanyabonrotllo/picture.php?/32/list/... http://www.game-t9.com/forum.php?mod=viewthread&tid=571329 http://0515.heibuhei.com/forum.php?mod=viewthread&tid=1074733&fromuid=21...

Add new comment