Skip to main content

Converting floating-point values to integers

  • Chapter
  • First Online:
The Mathematical-Function Computation Handbook
  • 1925 Accesses

Abstract

This chapter treats the important subject of converting arbitrary floating-point numbers to whole numbers, where the results may be in either floating-point or integer data formats. A few important historical machines targeted at the scientific computing market, and described in Appendix H on page 947, make such conversions easy by virtue of not having a separate integer storage format. Integers are then just floating-point values with a zero exponent, and conversions may require little more than bit shifting, and possibly, rounding. Some scripting languages provide only numbers and strings, where all numbers are represented as floating-point values.

I have found a bug on qemu SPARC: the floating point to integer conversion instructions (fstoi, fdtoi, fstox, fdtox) are not correctly emulated.

— Aurelien Jarno

bug report to qemu-devel mailing list (2007).

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 109.00
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 139.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info
Hardcover Book
USD 199.99
Price excludes VAT (USA)
  • Durable hardcover edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Nelson H. F. Beebe .

Rights and permissions

Reprints and permissions

Copyright information

© 2017 Springer International Publishing AG

About this chapter

Cite this chapter

Beebe, N.H.F. (2017). Converting floating-point values to integers. In: The Mathematical-Function Computation Handbook. Springer, Cham. https://doi.org/10.1007/978-3-319-64110-2_6

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-64110-2_6

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-64109-6

  • Online ISBN: 978-3-319-64110-2

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics