My Math Forum  

Go Back   My Math Forum > Science Forums > Computer Science

Computer Science Computer Science Forum


Reply
 
LinkBack Thread Tools Display Modes
March 10th, 2019, 07:55 PM   #1
Banned Camp
 
Joined: Nov 2018
From: Mumbai

Posts: 32
Thanks: 1

Programs for floating point numbers to text.

Reference :

https://www.google.com/amp/s/www.gee...-to-words/amp/

Can we write computer programs which will
convert a floating point or decimal number in words?

Programming languages could be C,C++,Java,C#, Python etc.

Example :

Input

375.50

Output

Three hundred seventy five and fifty only.

Thanks & Regards,
Prashant S Akerkar
akerkarprash is offline  
 
March 10th, 2019, 08:11 PM   #2
Math Team
 
topsquark's Avatar
 
Joined: May 2013
From: The Astral plane

Posts: 2,157
Thanks: 878

Math Focus: Wibbly wobbly timey-wimey stuff.
Yes.

Please let us know what you have tried and we'll give you a hand where you need it.

-Dan
topsquark is offline  
March 10th, 2019, 08:41 PM   #3
Senior Member
 
Joined: Aug 2012

Posts: 2,308
Thanks: 706

Quote:
Originally Posted by akerkarprash View Post
Reference :

https://www.google.com/amp/s/www.gee...-to-words/amp/

Can we write computer programs which will
convert a floating point or decimal number in words?

Programming languages could be C,C++,Java,C#, Python etc.

Example :

Input

375.50

Output

Three hundred seventy five and fifty only.

Thanks & Regards,
Prashant S Akerkar
Yes, that would be a nice exercise for late in the semester of a beginning programming class. You should take a shot at it, it's a fun challenge.

What's more interesting is that you CAN'T write a computer program to tell you whether a floating point number is zero. That problem is noncomputable. Many rounding errors lurk therein; and chaos theory tells us that rounding errors matter.
Maschke is offline  
March 10th, 2019, 09:11 PM   #4
Global Moderator
 
Joined: Dec 2006

Posts: 20,632
Thanks: 2080

Quote:
Originally Posted by akerkarprash View Post
convert a floating point or decimal number in words?
What did you mean by "floating point number"? Did you mean "into words" rather than "in words"?
skipjack is offline  
March 10th, 2019, 09:56 PM   #5
Banned Camp
 
Joined: Nov 2018
From: Mumbai

Posts: 32
Thanks: 1

Thanks.

Examples of floating point or decimal numbers :

2.3,43.11,567.50,89.23 etc

Thanks & Regards,
Prashant S Akerkar
akerkarprash is offline  
March 11th, 2019, 05:52 AM   #6
Global Moderator
 
Joined: Dec 2006

Posts: 20,632
Thanks: 2080

Can you define "floating point number" precisely (without giving examples), rather than give examples that might instead be decimals? Also, can you answer regarding the wording you used?
skipjack is offline  
March 11th, 2019, 07:54 AM   #7
Senior Member
 
Joined: Apr 2014
From: UK

Posts: 918
Thanks: 331

Quote:
Originally Posted by akerkarprash View Post
375.50

Output

Three hundred seventy five and fifty only.
That's incorrect, the output should be:

Three hundred (and) seventy five point five zero
weirddave is offline  
March 11th, 2019, 09:47 PM   #8
Banned Camp
 
Joined: Nov 2018
From: Mumbai

Posts: 32
Thanks: 1

Programs for floating point to Words.

Thanks.

I agree.

Thanks & Regards,
Prashant S Akerkar

Last edited by akerkarprash; March 11th, 2019 at 09:48 PM. Reason: Content updates.
akerkarprash is offline  
Reply

  My Math Forum > Science Forums > Computer Science

Tags
floating, numbers, point, programs, text



Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reverse of a floating or decimal point number akerkarprashant Computer Science 6 November 2nd, 2018 10:06 AM
exercise problem IEEE 754 floating point abdel Computer Science 4 June 14th, 2017 12:30 AM
floating point numbers with modulus(mod) abady-1 Number Theory 5 September 21st, 2013 02:08 PM
Floating Point Notation... Primalscientist Computer Science 9 June 2nd, 2011 06:29 AM
Floating Point Numbers - Single Precision Format (help!) RonnieStokie Algebra 3 December 12th, 2007 09:36 PM





Copyright © 2019 My Math Forum. All rights reserved.