• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Wrong value using JavaCast Float calling HSSFWorkbook

Explorer ,
May 04, 2007 May 04, 2007

Copy link to clipboard

Copied

I am running the HSSFWorkbook java object to create Excel Spreadsheets. The "est_outgoing_cost" variable is getting populated at 1.51. When I open the created spreadsheet the cell displays 1.51. However the actual value for the cell is 1.50999999046325. Any ideas why it's subtracting from 1.51?
TOPICS
Advanced techniques

Views

417

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guide , May 04, 2007 May 04, 2007
> cellValue = javaCast(arguments[3], val);
> cell.setCellValue(cellValue);

You're casting the value as a "float". You might try casting it to "double"

<cfscript>
cell.setCellValue(javaCast("double", val));
</cfscript>


Votes

Translate

Translate
Guide ,
May 04, 2007 May 04, 2007

Copy link to clipboard

Copied

LATEST
> cellValue = javaCast(arguments[3], val);
> cell.setCellValue(cellValue);

You're casting the value as a "float". You might try casting it to "double"

<cfscript>
cell.setCellValue(javaCast("double", val));
</cfscript>


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation