# Scientific notation question

Page 1 of 1

## 4 Replies - 655 Views - Last Post: 11 July 2016 - 07:25 AM

### #1 tonyal

Reputation: 2
• Posts: 85
• Joined: 23-September 14

# Scientific notation question

Posted 09 July 2016 - 06:58 PM

Hi, I'm new to PERL and I'm trying to figure out how to print out a scientific notation as 1.255000e+2

I put down:

```printf "The number in scientific notation is %.6e  \n", 1.255000;

```

the printout is 1.255000e+00. Any help would be greatly appreciated!
Is This A Good Question/Topic? 0

## Replies To: Scientific notation question

### #2 andrewsw

• blow up my boots

Reputation: 6519
• Posts: 26,386
• Joined: 12-December 12

## Re: Scientific notation question

Posted 09 July 2016 - 11:37 PM

1.255000e+00 this is correct. If you want 1.255000e+2 then this represents the value 125.5.

### #3 tonyal

Reputation: 2
• Posts: 85
• Joined: 23-September 14

## Re: Scientific notation question

Posted 10 July 2016 - 05:40 PM

andrewsw, on 09 July 2016 - 11:37 PM, said:

1.255000e+00 this is correct. If you want 1.255000e+2 then this represents the value 125.5.

Thanks, but it's supposed to print out "1.255000e+2" for the assignment it's we have to make our text print out the same as the question in the book. Thank you though!

### #4 sepp2k

• D.I.C Lover

Reputation: 2548
• Posts: 4,066
• Joined: 21-June 11

## Re: Scientific notation question

Posted 10 July 2016 - 06:01 PM

If you want it to print out as that, you'll need to multiply it by 100 (or just write 125.5 as Andrew suggested). By itself 1.255 is not equal to 1.255e+2, so there's no reason why print would ever print it out as such. That's like writing print 42 and expecting that to come out as 23.

### #5 tonyal

Reputation: 2
• Posts: 85
• Joined: 23-September 14

## Re: Scientific notation question

Posted 11 July 2016 - 07:25 AM

sepp2k, on 10 July 2016 - 06:01 PM, said:

If you want it to print out as that, you'll need to multiply it by 100 (or just write 125.5 as Andrew suggested). By itself 1.255 is not equal to 1.255e+2, so there's no reason why print would ever print it out as such. That's like writing print 42 and expecting that to come out as 23.

Ah, okay thanks!

Page 1 of 1

 .related ul { list-style-type: circle; font-size: 12px; font-weight: bold; } .related li { margin-bottom: 5px; background-position: left 7px !important; margin-left: -35px; } .related h2 { font-size: 18px; font-weight: bold; } .related a { color: blue; }