print using questions

New to FreeBASIC? Post your questions here.
Post Reply
12val12newakk
Posts: 35
Joined: Nov 14, 2019 17:04

print using questions

Post by 12val12newakk »

How print 208 585 224 782
As 208.5E9
need E9 (gigapaskal)
This
print using "Modul_U= ###.# ^"; Modul_U
printing parasite "%" befor
srvaldez
Posts: 3383
Joined: Sep 25, 2005 21:54

Re: print using questions

Post by srvaldez »

try
print using "####.#^^^^";208585224782
fxm
Moderator
Posts: 12159
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: print using questions

Post by fxm »

The exponent-part consists of from three to five ^ that must immediately follow the decimal-part:
^^^ for the exponent part on one digit (after the sign): E+/-#
^^^^ for the exponent part on two digits (after the sign): E+/-##
^^^^^ for the exponent part on three digits (after the sign): E+/-###

I can update the documentation.
[edit]
DONE:
KeyPgPrintusing → fxm [updated syntax for exponential notation]
Last edited by fxm on Jul 02, 2020 18:13, edited 2 times in total.
badidea
Posts: 2594
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: print using questions

Post by badidea »

12val12newakk wrote:How print 208 585 224 782
As 208.5E9
need E9 (gigapaskal)
This
print using "Modul_U= ###.# ^"; Modul_U
printing parasite "%" befor

Code: Select all

#include "string.bi"

function formatE9(byval number as double) as string
	number /= 1e9
	return format(number, "0.0") & "E9"
end function

dim as double number = 208585224782

print formatE9(number / 100)
print formatE9(number / 10)
print formatE9(number) & " <--"
print formatE9(number * 10)
print formatE9(number * 100)
Post Reply