File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes conversion of 1.0000000000005117E-4 to 0.00001 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "conversion of 1.0000000000005117E-4 to 0.00001" Watch "conversion of 1.0000000000005117E-4 to 0.00001" New topic

conversion of 1.0000000000005117E-4 to 0.00001

Gowrishankar Mudaliar
Ranch Hand

Joined: Oct 20, 2001
Posts: 39
Hi All,

I am having a program like this.

It evaluates an expression like " 1.00*(100-99.99)/100 ".
The result is a number in exponential format. But i only want a number in normal format. Is there a way i can achieve this straight forwardly.

public class ATLDiscount
public static void main(String ar[]) throws ParseException
double dIntermediateCalcCost = 0,dPrice = 0,dVal = 0;

dPrice = 1.00;
dVal= 99.99;

dIntermediateCalcCost = dPrice*(100-dVal)/100;

System.out.println("Intermediate COst double..:"+dIntermediateCalcCost);


Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24195

Use java.text.DecimalFormat.

This isn't an advanced question; I'm moving this to JiG(Intermediate).

[Jess in Action][AskingGoodQuestions]
I agree. Here's the link:
subject: conversion of 1.0000000000005117E-4 to 0.00001
It's not a secret anymore!