From nmoore at winona.edu Wed Sep 28 16:07:37 2022 From: nmoore at winona.edu (Moore, Nathan T) Date: Wed, 28 Sep 2022 20:07:37 +0000 Subject: [LON-CAPA-users] display number with "E" scientific notation Message-ID: Imagine I have a variable that's random $length=&random(150,250,1); Specific case, $length = 157; I want this value to be printed for users with the "E" power of 10 notation, eg I want the user to see 1.57E2 The following code displays almost what I want, 1.57x10^2, but what I really want is 1.57E2 $length Thoughts on a workaround? ----------------------------------------------------------------- Nathan Moore, PhD (he/him) Professor, Physics and General Engineering Programs Winona State University Come study on Minnesota's Southeast Coast -------------- next part -------------- An HTML attachment was scrubbed... URL: From lucasm at ohio.edu Wed Sep 28 16:39:35 2022 From: lucasm at ohio.edu (Lucas, Mark) Date: Wed, 28 Sep 2022 20:39:35 +0000 Subject: [LON-CAPA-users] [External] display number with "E" scientific notation In-Reply-To: References: Message-ID: <6CA270DB-CDA0-4A7F-B781-CA71F6F9EB99@ohio.edu> Nathan, A workaround would be to do a sprintf in the script and then use the string in the text of the problem. The length is $result meters. It?s a bit cumbersome, but it looks like it works. Mark > On Sep 28, 2022, at 4:07 PM, Moore, Nathan T via LON-CAPA-users wrote: > > Use caution with links and attachments. > Imagine I have a variable that?s random > > $length=&random(150,250,1); > > Specific case, $length = 157; > > I want this value to be printed for users with the ?E? power of 10 notation, eg I want the user to see > > 1.57E2 > > The following code displays almost what I want, 1.57x10^2, but what I really want is 1.57E2 $length > > Thoughts on a workaround? > > ----------------------------------------------------------------- > Nathan Moore, PhD (he/him) > > Professor, Physics and General Engineering Programs > Winona State University > > Come study on Minnesota?s Southeast Coast > > _______________________________________________ > LON-CAPA-users mailing list > LON-CAPA-users at mail.lon-capa.org > http://mail.lon-capa.org/mailman/listinfo/lon-capa-users -- Mark Lucas Professor of Instruction Department of Physics and Astronomy (College of Arts and Sciences)/Ohio Honors Program (Honors College) 252D Clippinger Lab, Ohio University, Athens, OH 45701 email: lucasm at ohio.edu phone: (740)597-2984 Pronouns: He, Him, His